Contributing

To set up your development environment, first create a new virtual environment (in the .venv/ folder):

(Linux or macOS)

$ python -m venv .venv
$ source .venv/bin/activate

(Windows/PowerShell)

PS> python -m venv .venv
PS> .venv/Scripts/Activate.ps1

Enter the source code directory and install the package locally with additional development tools:

$ pip install -r requirements-dev.txt

Write some code.

Next, run the static analysis tools (flake8 and mypy)

$ flake8 ./wagtailcache/
$ mypy ./wagtailcache/

Next, run the units tests. A simple Wagtail project using Wagtail Cache is in the testproject/ directory. The tests will generate a visual HTML file at htmlcov/index.html when finished, which you can open in your browser.

$ pytest ./testproject/

To build the documentation, run the following, which will output to the docs/_build/html/ directory.

$ sphinx-build -M html ./docs/ ./docs/_build/ -W

To create a python package, run the following, which will output the package to the dist/ directory.

$ python setup.py sdist bdist_wheel