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