Skip to content

Commit

Permalink
Merge pull request #146 from NTIA/merge-acquisitions-into-results
Browse files Browse the repository at this point in the history
Merge acquisitions into results
  • Loading branch information
djanderson committed Jun 6, 2019
2 parents 29deec7 + b4212de commit 3eba31e
Show file tree
Hide file tree
Showing 135 changed files with 3,596 additions and 4,395 deletions.
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- id: debug-statements
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.1
hooks:
- id: seed-isort-config
language_version: python3.6
args: [--application-directories=./src, --settings-path=./src]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.20
hooks:
- id: isort
language_version: python3.6
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.6
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -26,6 +26,6 @@ before_script:
- pip install -r ./src/requirements-dev.txt

script:
- black --check ./src
- tox -c ./src/tox.ini -e coverage
- tox -c ./src/tox.ini -e lint
- docker ps | grep api | grep -q healthy
38 changes: 35 additions & 3 deletions DEVELOPING.md
Expand Up @@ -38,14 +38,46 @@ recommend you initialize a virtual development environment using a tool such a

```bash
$ cd src
$ python2 -m pip install -r requirements-dev.txt
$ python3 -m pip install -r requirements-dev.txt
$ pytest # faster, but less thorough
$ tox # tests code in clean virtualenv
$ tox --recreate # if you change `requirements.txt`
$ tox -e lint # check that code meets widely accepted coding standards
$ tox -e coverage # check where test coverage lacks
```

Committing
----------

Besides running the test suite and ensuring that all tests are passing, we also
expect all python code that's checked in to have been run through an
auto-formatter.

This project uses a Python auto-formatter called Black. You probably won't like
every decision it makes, but our continuous integration test-runner will reject
your commit if it's not properly formatted.

Additionally, import statement sorting is handled by `isort`.

The continuous integration test-runner verifies the code is auto-formatted by
checking that neither `isort` nor `black` would recommend any changes to the
code. Occasionally, this can fail if these two autoformatters disagree. The
only time I've seen this happen is with a commented-out import statement, which
`isort` parses, and `black` treats as a comment. Solution: don't leave
commented-out import statements in the code.

There are several ways to autoformat your code before committing. First, IDE
integration with on-save hooks is very useful. Second, there is a script,
`scripts/autoformat_python.sh`, that will run both `isort` and `black` over the
codebase. Lastly, if you've already pip-installed the dev requirements from the
section above, you already have a utility called `pre-commit` installed that
will automate setting up this project's git pre-commit hooks. Simply type the
following _once_, and each time you make a commit, it will be appropriately
autoformatted.


```bash
$ pre-commit install
```

Running Production Server with Local Changes
--------------------------------------------
Expand Down Expand Up @@ -100,7 +132,7 @@ $ ./manage.py runserver
outside of it, you may need to allow access to system sitepackages. For
example, if you're using a virtualenv called `scos-sensor`, you can remove
the following text file: `rm -f
~/.virtualenvs/scos-sensor/lib/python2.7/no-global-site-packages.txt`, and
~/.virtualenvs/scos-sensor/lib/python3.6/no-global-site-packages.txt`, and
thereafter use the `ignore-installed` flag to pip: `pip install -I -r
requirements.txt`. This should let the devserver fall back to system
sitepackages for the SDR driver only.
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yml
Expand Up @@ -57,7 +57,7 @@ services:
command: /entrypoints/api_entrypoint.sh

nginx:
image: nginx:1.14-alpine
image: nginx:1.16-alpine
restart: always
ports:
- '80:80'
Expand All @@ -82,14 +82,13 @@ services:
# https://github.com/moby/moby/issues/28400
# https://github.com/willfarrell/docker-autoheal
autoheal:
image: alpine
image: smsntia/autoheal:${DOCKER_TAG} # DOCKER_TAG will always be 'latest' for GitHub source
restart: always
depends_on:
- api
build:
context: .
dockerfile: docker/Dockerfile-autoheal
image: smsntia/autoheal:${DOCKER_TAG} # DOCKER_TAG will always be 'latest' for GitHub source
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./entrypoints/autoheal_entrypoint.sh:/entrypoints/autoheal_entrypoint.sh:ro
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-autoheal
@@ -1,3 +1,3 @@
FROM alpine
FROM alpine:3.9

RUN apk add --no-cache jq curl

0 comments on commit 3eba31e

Please sign in to comment.