|
| 1 | +[Poetry]: https://python-poetry.org/ |
| 2 | +[Pylint]: https://www.pylint.org/ |
| 3 | +[isort]: https://pycqa.github.io/isort/ |
| 4 | +[mypy]: http://mypy-lang.org/ |
| 5 | +[django-pytest]: https://pytest-django.readthedocs.io/en/latest/ |
| 6 | +[pytest]: https://docs.pytest.org/en/stable/ |
| 7 | +[Sphinx]: https://www.sphinx-doc.org/en/master/ |
| 8 | +[readthedocs]: https://readthedocs.org/ |
| 9 | +[me]: https://github.com/bckohan |
| 10 | +[black]: https://black.readthedocs.io/en/stable/ |
| 11 | +[pyright]: https://github.com/microsoft/pyright |
| 12 | + |
| 13 | +# Contributing |
| 14 | + |
| 15 | +Contributions are encouraged! Please use the issue page to submit feature |
| 16 | +requests or bug reports. Issues with attached PRs will be given priority and |
| 17 | +have a much higher likelihood of acceptance. Please also open an issue and |
| 18 | +associate it with any submitted PRs. That said, the aim is to keep this library |
| 19 | +as lightweight as possible. Only features with broad-based use cases will be |
| 20 | +considered. |
| 21 | + |
| 22 | +We are actively seeking additional maintainers. If you're interested, please |
| 23 | +[contact me](https://github.com/bckohan). |
| 24 | + |
| 25 | +## Installation |
| 26 | + |
| 27 | +`django-typer` uses [Poetry](https://python-poetry.org/) for environment, package, and dependency |
| 28 | +management: |
| 29 | + |
| 30 | +```shell |
| 31 | +poetry install |
| 32 | +``` |
| 33 | + |
| 34 | +## Documentation |
| 35 | + |
| 36 | +`django-typer` documentation is generated using [Sphinx](https://www.sphinx-doc.org/en/master/) with the |
| 37 | +[readthedocs](https://readthedocs.org/) theme. Any new feature PRs must provide updated documentation for |
| 38 | +the features added. To build the docs run doc8 to check for formatting issues |
| 39 | +then run Sphinx: |
| 40 | + |
| 41 | +```bash |
| 42 | +cd ./doc |
| 43 | +poetry run doc8 --ignore-path build --max-line-length 100 |
| 44 | +poetry run make html |
| 45 | +``` |
| 46 | + |
| 47 | +## Static Analysis |
| 48 | + |
| 49 | +`django-typer` uses [Pylint](https://www.pylint.org/) for Python linting and [mypy](http://mypy-lang.org/) and [pyright](https://github.com/microsoft/pyright) for static type |
| 50 | +checking. Header imports are also standardized using [isort](https://pycqa.github.io/isort/) and formatting is |
| 51 | +done with [black](https://black.readthedocs.io/en/stable/). Before any PR is accepted the following must be run, and |
| 52 | +static analysis tools should not produce any errors or warnings. Disabling |
| 53 | +certain errors or warnings where justified is acceptable: |
| 54 | + |
| 55 | +```bash |
| 56 | +poetry run isort django_typer |
| 57 | +poetry run black django_typer |
| 58 | +poetry run pylint django_typer |
| 59 | +poetry run mypy django_typer |
| 60 | +pyright |
| 61 | +poetry check |
| 62 | +poetry run pip check |
| 63 | +poetry run python -m readme_renderer ./README.md |
| 64 | +``` |
| 65 | + |
| 66 | +## Running Tests |
| 67 | + |
| 68 | +`django-typer` is set up to use [pytest](https://docs.pytest.org/en/stable/) to run unit tests. All the tests are |
| 69 | +housed in `django_typer/tests/tests.py`. Before a PR is accepted, all tests |
| 70 | +must be passing and the code coverage must be at 100%. A small number of |
| 71 | +exempted error handling branches are acceptable. |
| 72 | + |
| 73 | +To run the full suite: |
| 74 | + |
| 75 | +```shell |
| 76 | +poetry run pytest |
| 77 | +``` |
| 78 | + |
| 79 | +To run a single test, or group of tests in a class: |
| 80 | + |
| 81 | +```shell |
| 82 | +poetry run pytest <path_to_tests_file>::ClassName::FunctionName |
| 83 | +``` |
| 84 | + |
| 85 | +For instance, to run all tests in BasicTests, and then just the |
| 86 | +test_call_command test you would do: |
| 87 | + |
| 88 | +```shell |
| 89 | +poetry run pytest django_typer/tests/tests.py::BasicTests |
| 90 | +poetry run pytest django_typer/tests/tests.py::BasicTests::test_call_command |
| 91 | +``` |
0 commit comments