Contributing

Development environment

Clone the repository::

git clone git@github.com:accelero-cloud/appkernel.git
cd appkernel

Create and activate a virtual environment::

python3 -m venv .venv
source .venv/bin/activate

Install the package in editable mode with all development dependencies::

pip install -e ".[dev]"

Set up git hooks

The repository ships pre-commit and pre-push hooks that run tests and linting automatically::

cd .git/hooks
ln -sf ../../hooks/pre-commit ./pre-commit
ln -sf ../../hooks/pre-push ./pre-push
cd ../..

Run the tests

Most tests require a running MongoDB instance. The easiest way is Docker::

docker run -d --name mongo -p 27017:27017 mongo:latest

Then run the full test suite from the project root::

pytest ./tests

Some tests also require compiled translations::

cd tests && pybabel compile -d ./translations && cd ..

AppKernel requires MongoDB 4.0+. If you have an older local installation, pull the latest image::

docker pull mongo:latest

PyCharm hint: set your Project Interpreter to the .venv environment, and mark .idea/, appkernel.egg-info/, and .venv/ as excluded directories.

Publishing to PyPI

Build the distribution::

pip install --upgrade build twine
python -m build

Upload to TestPyPI for a dry run::

twine upload --repository testpypi dist/*

When everything looks good, publish to PyPI::

twine upload dist/*

If you maintain a ~/.pypirc with named repositories, you can use the shorthand::

twine upload -r pypi dist/*