diff --git a/DEV.md b/DEV.md index a679b4a..212cec8 100644 --- a/DEV.md +++ b/DEV.md @@ -15,12 +15,14 @@ environment, run these commands in the same directory as this file: ``` $ python -m venv .venv $ . .venv/bin/activate -$ pip install --editable . +$ ./scripts/setup ``` -After this, you can use PFERD as if it was installed normally. Since PFERD was -installed with `--editable`, there is no need to re-run `pip install` when the -source code is changed. +The setup script installs a few required dependencies and tools. It also +installs PFERD via `pip install --editable .`, which means that you can just run +`pferd` as if it was installed normally. Since PFERD was installed with +`--editable`, there is no need to re-run `pip install` when the source code is +changed. For more details, see [this part of the Python Tutorial][venv-tut] and [this section on "development mode"][ppug-dev]. @@ -29,9 +31,22 @@ For more details, see [this part of the Python Tutorial][venv-tut] and [venv-tut]: "12. Virtual Environments and Packages" [ppug-dev]: "Working in “development mode”" +## Checking and formatting the code + +To run a set of checks against the code, run `./scripts/check` in the repo's +root directory. This script will run a few tools installed by `./scripts/setup` +against the entire project. + +To format the code, run `./scripts/format` in the repo's root directory. + +Before committing changes, please make sure the checks return no warnings and +the code is formatted. + ## Contributing When submitting a PR that adds, changes or modifies a feature, please ensure -that the corresponding documentation is updated. +that the corresponding documentation is updated as well. Also, please ensure +that `./scripts/check` returns no warnings and the code has been run through +`./scripts/format`. In your first PR, please add your name to the `LICENSE` file. diff --git a/scripts/check b/scripts/check new file mode 100755 index 0000000..ba767cd --- /dev/null +++ b/scripts/check @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +mypy PFERD +flake8 PFERD diff --git a/scripts/format b/scripts/format new file mode 100755 index 0000000..cc196ae --- /dev/null +++ b/scripts/format @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +autopep8 --recursive --in-place PFERD +isort PFERD diff --git a/scripts/setup b/scripts/setup new file mode 100755 index 0000000..8a5399b --- /dev/null +++ b/scripts/setup @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +pip install --upgrade pip setuptools +pip install --editable . +pip install --upgrade mypy flake8 autopep8 isort diff --git a/setup.cfg b/setup.cfg index 288cd3c..f6b64ea 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,8 +15,8 @@ install_requires = console_scripts = pferd = PFERD.__main__:main -[pycodestyle] -max-line-length = 110 +[flake8] +max_line_length = 110 -[pylint.FORMAT] -max-line-length = 110 \ No newline at end of file +[isort] +line_length = 110