Create a virtual environment:
python -m venv .venv
Install runtime dependencies and development dependencies:
# Windows
.venv\Scripts\activate.ps1
# Linux
source .venv/bin/activate
# install dependencies
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade -r requirements-dev.txt -r requirements.txt
# check for outdated packages
pip list --outdated
Run the tests and linters with multiple python versions using tox.
If the pip dependencies have changed, it might be necessary to
(un)comment recreate = true
in the tox section in pyproject.toml
.
To run using all available python versions:
python -X dev -m tox
To run using the active python:
python -X dev -m tox -e py
Generate the docs using pdoc:
pdoc --docformat google \
--edit-url gather_vision_gov_au_plugin=https://github.com/anotherbyte-net/gather-vision/blob/main/src/gather_vision_gov_au_plugin/ \
--search --show-source \
--output-directory docs \
./src/gather_vision_gov_au_plugin
Generate the distribution package archives.
python -X dev -m build
Upload archives to Test PyPI first.
python -X dev -m twine upload --repository testpypi dist/*
When uploading:
- for username, use
__token__
- for password, create a token at https://test.pypi.org/manage/account/#api-tokens
Go to the test project page and check that it looks ok.
Then create a new virtual environment, install the dependencies, and install from Test PyPI.
python -m venv .venv-test
source .venv-test/bin/activate
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade -r requirements.txt
GATHER_VISION_GOV_AU_PLUGIN_VERSION='0.0.1'
pip install --index-url https://test.pypi.org/simple/ --no-deps gather-vision-gov-au-plugin==$GATHER_VISION_GOV_AU_PLUGIN_VERSION
# or
pip install dist/gather_vision_gov_au_plugin-$GATHER_VISION_GOV_AU_PLUGIN_VERSION-py3-none-any.whl
Test the installed package.
from gather_vision import app
from gather_vision.plugin import entry
app_args = entry.ListArgs()
main_app = app.App()
main_app.list(app_args)
If the package seems to work as expected, upload it to the live PyPI.
python -X dev -m twine upload dist/*
When uploading:
- for username, use
__token__
- for password, create a token at https://pypi.org/manage/account/#api-tokens
Go to the live project page and check that it looks ok.
Done!