Development and releases¶
Local development¶
git clone https://github.com/stblassitude/pretix-plugin-payment-sumup.git
cd pretix-plugin-payment-sumup
python3 -m venv .venv
. .venv/bin/activate
pip install pretix -e '.[dev]'
Run the tests and linters:
The tests use pretix' own test settings (an SQLite database) and mock the SumUp API with
responses. They don't need network access or SumUp
credentials. To test against SumUp for real, use the Docker sandbox.
Code layout¶
| File | Purpose |
|---|---|
pretix_payment_sumup/client.py |
Small wrapper around the SumUp REST API |
pretix_payment_sumup/payment.py |
The pretix payment provider: settings, checkout creation, status sync, refunds |
pretix_payment_sumup/views.py |
Return URL (customer) and webhook (SumUp) |
pretix_payment_sumup/signals.py |
Provider registration and the periodic poller |
pretix_payment_sumup/templates/ |
Customer- and backend-facing HTML snippets |
pretix_payment_sumup/locale/ |
Translations |
All three status sources (return, webhook, cron) call SumUpHostedCheckout.sync_payment(). That
method is the only place where payments are confirmed or failed.
Translations¶
Update the message catalog after changing translatable strings:
cd pretix_payment_sumup
DJANGO_SETTINGS_MODULE=pretix.testutils.settings django-admin makemessages -l de --no-location
Translate the new entries in locale/de/LC_MESSAGES/django.po. The .mo files are not committed.
They are compiled automatically during the package build (setup.py, needs GNU gettext's
msgfmt) and when the sandbox container starts.
Documentation¶
The documentation is built with MkDocs Material:
The docs workflow publishes it to GitHub Pages on every push to main. Enable it once under
Repository → Settings → Pages → Source: GitHub Actions.
Releasing¶
Releases are made by pushing a version tag. The release GitHub Actions workflow then:
- runs the tests (the same jobs as
ci), - takes the version from the tag (
v1.2.3→1.2.3). The tag must be a normalized PEP 440 version, sov1.2.3,v1.3.0rc1orv2.0.0b2, - writes that version into
pyproject.tomland builds the sdist and wheel, including the compiled translations, - uploads both to PyPI with trusted publishing, so no API token is stored in GitHub,
- creates a GitHub release for the tag. The release notes list the summaries of all commits since
the previous
v*tag, and the built files are attached. Tags witha,b,rcordevversions are marked as pre-releases.
Version number
The version in pyproject.toml is always the placeholder 0.0.0.dev0, and there is no
version number anywhere else in the source tree. Don't change it by hand; the git tag is the
only source of the version. At runtime the plugin reads its version from the installed package
metadata, so pretix shows the released version.
One-time setup¶
-
On PyPI, go to Your account → Publishing → Add a new pending publisher (or, once the project exists, Project → Settings → Publishing) and enter:
Field Value PyPI project name pretix-payment-sumupOwner stblassitudeRepository name pretix-plugin-payment-sumupWorkflow name release.ymlEnvironment name pypi -
In GitHub, create an environment named
pypiunder Repository → Settings → Environments. Add required reviewers if you want to approve every upload by hand. You can also restrict the environment to tags matchingv*.
Making a release¶
Write commit messages with a meaningful first line, because those summaries become the release notes. Then tag the commit you want to release and push the tag:
If the workflow fails before uploading to PyPI (for example because a test fails), fix the problem, then delete and recreate the tag:
Once a version is on PyPI it can't be uploaded again. In that case, release a new version.