Contributing
Dependencies
Create test environment
Get source code
- If you have forked django-gesha, use the URL of your fork here instead.
Create Python environment
Create a virtual environment,
for example, in a directory named venv
:
Activate the virtual environment:
Upgrade pip:
Install editable django-gesha to Python environment:
Create Node.js environment
Develop
Python
Apply formatting
Run the format
tox environment to apply formatting using black and isort rules:
Type-hinting
Include the following import at the top of Python modules to enable the latest typing features for all Python versions supported by django-gesha:
Typing features enabled by future import
The following features are available by default in Python 3.10, but the future import is required to enable them in previous Python versions.
PEP | Title | Python |
---|---|---|
563 | Postponed Evaluation of Annotations | 3.8, 3.9 |
585 | Type Hinting Generics In Standard Collections | 3.8 |
604 | Allow writing union types as X | Y |
3.8, 3.9 |
Declaring custom types
When declaring custom types use the
TYPE_CHECKING
constant
to prevent execution during runtime:
Example using TYPE_CHECKING constant | |
---|---|
Otherwise, declarations like this may cause runtime errors in Python 3.9 or lower.
TypeScript
Build assets
To watch source files and continuously build when changes occur:
Test
Python
Lint and type-check
Run tests
To run tests for all supported Django versions for a specific Python version:
- See the
labels
section intox.ini
for available Python labels.
Run test project
$ cd test_project
$ uvicorn fake.asgi:application --reload
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
TypeScript
Lint
Run tests
Generating test.html
fixture for TypeScript tests
The fixture js_tests/test.html
is generated from the test Django project located
in test_project
. If the test project has been modified the fixture can be
regenerated using the following command:
Documentation
Preview changes to documentation by running the builtin development server:
Pull request
-
django-gesha supports Python 3.8 or higher, but type-checking requires or Python 3.10 or higher. ↩