Utilities to help build Workbench modules
Project description
Utilities for CJWorkbench modules.
Workbench modules may optionally depend on the latest version of this Python package for its handy utilities:
cjwmodule.http
: HTTP helpers, including the handyhttpfile
format.cjwmodule.i18n
: Atrans()
function for producing translatable text.cjwmodule.util.colnames
: Functions to help build a valid table's column names.
Developing
- Write a failing unit test in
tests/
- Make it pass by editing code in
cjwmodule/
black cjwmodule tests && isort --recursive cjwmodule tests
- Submit a pull request
Be very, very, very careful to preserve a consistent API. Workbench will upgrade this dependency without module authors' explicit consent. Add new features; fix bugs. Never change functionality.
I18n
Strings in cjwmodule
can be marked for translation using cjwmodule.i18n._trans_cjwmodule
.
Each translation message must have a (unique) ID. ICU is supported for the content.
For example,
from cjwmodule.i18n import _trans_cjwmodule
err = "Error 404"
_trans_cjwmodule(
"greatapi.exception.message",
"Something is wrong: {error}",
{"error": err}
)
Workbench is wired to accept the return value of _trans_cjwmodule
wherever an error/warning or quick fix is expected.
Calls to _trans_cjwmodule
can (and must) be automatically parsed to create cjwmodule
's po
message files.
This is accomplished by
python maintenance/i18n.py extract
For backwards compatibility, messages in cjwmodule
's po
files are never deleted!
Publishing
- Write a new
__version__
tocjwmodule/__init__.py
. Adhere to semver. (As changes must be backwards-compatible, the version will always start with1
and look like1.x.y
.) - Prepend notes to
CHANGELOG.md
about the new version git commit
git tag v1.x.y
git push --tags && git push
- Wait for Travis to push our changes to PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.