diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..269b401 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,25 @@ +name: Code-Quality + +on: [push] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + max-parallel: 4 + matrix: + python-version: [3.9] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install pre-commit + run: | + python -m pip install pre-commit + - name: Check pre-commit + run: | + pre-commit run -a diff --git a/.gitignore b/.gitignore index bf7c2f1..3024716 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ coverage.xml # Sphinx documentation docs/_build/ +docs/html/ # PyBuilder target/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 06c8fd2..13dc8c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,6 @@ repos: - id: black - repo: https://github.com/pre-commit/mirrors-prettier rev: "v2.7.1" - exclude: .*\.html hooks: - id: prettier - repo: https://github.com/rtts/djhtml @@ -20,4 +19,4 @@ repos: - id: djhtml default_language_version: - python: python3.9.7 + python: python3.9 diff --git a/docker/Dockerfile b/docker/Dockerfile index 38e1a37..93a9724 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -26,6 +26,7 @@ USER wooey RUN wooify -p ${WOOEY_PROJECT} WORKDIR ${BUILD_DIR}/${WOOEY_PROJECT} +ENV PYTHONPATH=${BUILD_DIR}/${WOOEY_PROJECT}:${PYTHONPATH} COPY docker/scripts/run-server run-server diff --git a/docker/docker-compose.override.template.yml b/docker/docker-compose.override.template.yml index 99440e4..bfbf9de 100644 --- a/docker/docker-compose.override.template.yml +++ b/docker/docker-compose.override.template.yml @@ -6,7 +6,8 @@ services: wooey: volumes: &package-volumes - ../wooey:$BUILD_DIR/wooey - - ../../clinto/clinto:/usr/local/lib/python3.6/site-packages/clinto + # Mount over the clinto parser install if desired. + # - ../../clinto/clinto:/usr/local/lib/python3.6/site-packages/clinto ports: - 8080:8080 diff --git a/docker/manage b/docker/manage index b301763..7fd8381 100755 --- a/docker/manage +++ b/docker/manage @@ -1,2 +1,2 @@ #!/bin/bash -docker-compose run --rm wooey python manage.py "$@" +docker-compose run --rm wooey django-admin "$@" diff --git a/docs/dev_setup.rst b/docs/dev_setup.rst new file mode 100644 index 0000000..fb29ad8 --- /dev/null +++ b/docs/dev_setup.rst @@ -0,0 +1,43 @@ +Developer Setup +=============== + +Dev Environment +--------------- + +Docker +~~~~~~ + +The `docker` folder contains the Docker setup. Wooey can be built and run by simply +running + +:: + + docker-compose up --build + +To mount the local installation directory in the docker container, create a local version +of the docker-compose overrides by running + +:: + + cp docker-compose.override.template.yml docker-compose.override.yml + +Several convenience scripts exist for common scenarios: + +* manage -- run a django-admin command +* run -- run a command in the wooey container. For example, a bash shell can be started by `run bash` +* run-server -- run the Django server that is locally accessible. This offers some advantages over `docker-compose up` such as allowing debugging via `pdb` +* test -- run all unit tests. + +System +~~~~~~ + +For developers not using Docker, dependenices can be installed via + +:: + + pip install .[dev] + +Style +----- + +`Pre-commit `_ is used to standardize the tools used for linting and code formatting. diff --git a/docs/index.rst b/docs/index.rst index 860c7f4..edcc236 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -44,10 +44,10 @@ Getting Started security -Developers -========== +Contributing +============ .. toctree:: :maxdepth: 2 - dev_install + dev_setup