Utilities for CJWorkbench modules.
Workbench modules may optionally depend on the latest version of this Python package for its handy utilities:
cjwmodule.arrow.condition: functions to create Arrow table masks.cjwmodule.arrow.format: functions to convert Arrow arrays to text.cjwmodule.arrow.types: types your Arrow module may accept and return.cjwmodule.arrow.testing: helpers for programming tests.cjwmodule.http: HTTP helpers, including the handyhttpfileformat.cjwmodule.i18n: Atrans()function for producing translatable text.cjwmodule.testing: Functions to help in unit testing.cjwmodule.util.colnames: Functions to help build a valid table's column names.cjwmodule.spec: Functions to load and validate module spec files.cjwmodule.types: Types your module may accept and return.
Developing
- Run
toxto confirm that unit tests pass - Write a failing unit test in
tests/. (toxshould fail now.) - Make it pass by editing code in
cjwmodule/ - Run
poetry run extract-messagesif i18n data changed - Run
toxto confirm that unit tests pass again - Submit a pull request
Preserve a consistent API. Workbench will upgrade this dependency without module authors' consent. Add new features; fix bugs. Don't alter existing behavior.
I18n
Marking strings for translation
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"
with_arguments = _trans_cjwmodule(
"greatapi.exception.message",
"Something is wrong: {error}",
{"error": err}
)
without_arguments = _trans_cjwmodule(
"greatapi.exception.general",
"Something is wrong",
)
Workbench is wired to accept the return value of _trans_cjwmodule wherever an
error/warning or quick fix is expected.
Creating po catalogs
Calls to _trans_cjwmodule can (and must) be parsed to create cjwmodule's
.po files. Update the .po files with:
poetry run extract-messages
Unit testing
In case a _trans_cjwmodule invocation needs to be unit tested, you can use
cjwmodule.testing.i18n.cjwmodule_i18n_message like this:
from cjwmodule.testing.i18n import cjwmodule_i18n_message
import with_arguments, without_arguments
assert with_arguments == cjwmodule_i18n_message("greatapi.exception.message", {"error": "Error 404"})
assert without_arguments == cjwmodule_i18n_message("greatapi.exception.general")
Message deprecation
For backwards compatibility, messages in cjwmodule's po files are never deleted!
Publishing
- Prepend notes to
CHANGELOG.mdabout the new version git commitgit pushand wait for Travis to report successgit tag v1.x.y && git push --tags- Wait for Travis to push our changes to PyPI
Metadata
Release files for cjwmodule 4.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cjwmodule-4.1.12.tar.gz | 43.8 kB | Without provenance | Details for cjwmodule-4.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cjwmodule-4.1.12-py3-none-any.whl | Python 3 | none | any | Details for cjwmodule-4.1.12-py3-none-any.whl |
Total release size: 96.1 kB
Release files / cjwmodule-4.1.12.tar.gz
| Download URL | cjwmodule-4.1.12.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38fa54384bf84f469d5e241ac958c7abb5fde360e7d4df0d8ca64312a7087f02
|
|
BLAKE2b-256 checksum How to use checksums |
614e7dc981c8307966da0039a13fe5c2aae14afce7bb0e8bc84a9365268624fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.3 Linux/5.4.0-1042-gcp
|
Release files / cjwmodule-4.1.12-py3-none-any.whl
| Download URL | cjwmodule-4.1.12-py3-none-any.whl |
|---|---|
| Size | 52.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b282a64595809f98c92d383ede664903093fdf9b12748d63199546f6466f2b55
|
|
BLAKE2b-256 checksum How to use checksums |
f96d57764ddf94d665b556c8c299bf1d28c933d3371f01a27f96712798daf81e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.3 Linux/5.4.0-1042-gcp
|
Security for cjwmodule 4.1.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.