Development Notes

The development notes below assume a PowerShell prompt is being used on a Windows machine.

Run the following before any of the following tasks (once the virtual environment itself has been built):

# update the following to your local paths


Building the Dev Virtual Environment

Run from the root of the mappyfile project folder:


cd "C:\Python310\Scripts"
.\pip install virtualenv
.\virtualenv $VIRTUALENV
pip install -e .
pip install -r requirements-dev.txt
# optionally install lark_cython
pip install -e .[lark_cython]

Testing Locally

Ensure the development code has been deployed to a virtual environment as in the step above.

Then run from the root of the mappyfile project folder:


To see a list of which tests will run, without actually running them:

pytest --collect-only

To run a single test file:

pytest tests/

To also include doctests:

pytest --doctest-modules --ignore=./docs/examples/


flake8 .

Or to export to file:

flake8 . > D:\Temp\lint.txt


pip install prospector
# or just the main source code folder
prospector ./mappyfile


To run static type checking:

mypy mappyfile tests


To build the Sphinx documentation:

sphinx-build -b html "$MAPPYFILE_PATH\docs" "$MAPPYFILE_PATH\_build"
# to force a rebuild of all files
sphinx-build -a -E -b html "$MAPPYFILE_PATH\docs" "$MAPPYFILE_PATH\_build"

To run in a local browser:

C:\Python310\python -m http.server --directory="$MAPPYFILE_PATH\_build" 57921

# open browser and go to http://localhost:57921

To automatically rebuild docs using watchdog:

# run the following to automatically rebuild the project
# python -m pip install -U "watchdog[watchmedo]"
watchmedo shell-command --patterns="*.rst;*.txt" --recursive --command='sphinx-build -b html "./docs" "./_build"' ./docs