xju library
Project description
Various modules implemented to some broad principles:
fine-grained static typing
pure context management
useful functionality that is hard to use incorrectly
100% test coverage
xju.newtype - static and dynamic distinct int, float and str types
unlike typing.NewType the new types are compatible with isinstance, so you can actually use them to do real stuff, like implement overloaded methods
see xju/newtype.py.test for sample code
xju.cmc - context management
unlike python standard library e.g. open(), these are “pure” context managers: resources are never acquired until __enter__
xju.cmc.cmclass - provides context management for class attributes that are context managers
managing multiple resource attributes is clumsy with ExitStack, this module implements __enter__ and __exit__ automatically to ensure correct ordering and cleanup on exceptions
see xju/cmc/cmclass.py.test for sample code
xju.cmc.Dict - dictionary that is a context manager for its (context manager) values
see xju/cmc/Dict.py.test for sample code
xju.cmc.io - pure context management for e.g. file reading and writing
see unit tests for sample code: * FileLock.py.test * FileMode.py.test * FilePosition.py.test * FileReader.py.test * FileWriter.py.test
time-based storage, organised as files covering time-ranges
see xju/cmc/tstore.py.test for sample code
time-based json-format record storage built on xju.cmc.tstore
see xju/cmc/perflog.py.test for sample code
jquery-like html inspection and modification
see xju/pq.py.test for sample code
assert functions that capture term values e.g. x and y in Assert(x)==y
see xju/assert_.py.test for sample code
wrapper for subprocess.Popen that captures very common usage without the option-and-flag-warren of subprocess
see xju/cmd.py.test for sample code
encoding/decoding type-hinted dict/list/int/bool/None/float/str and classes to and from json
designed to fit well with type checking
built in support for xju.newtype described above
generates json schema equivalent schemas for types
see xju/json_codec.py.test for full sample code
represents JSON schemas as straight-foward, easy-to-read python data structures, because life’s too short for jsonschema
see xju/jsonschema.py.test for sample code
minimal, simple, direct patching(/stub/mock) utility, unlike mock-warren. Because one shouldn’t need a degree to read and write a unit test
see xju/patch.py.test for sample code
type-safe time and duration classes
see xju/time.py.test for sample code
Exception wrapping to provide human readable context gathering
see xju/xn.py.test for sample code
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.
Source Distribution
Built Distribution
File details
Details for the file xju-1.2.5.tar.gz
.
File metadata
- Download URL: xju-1.2.5.tar.gz
- Upload date:
- Size: 65.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9adc85b084536badd37da658d968f143898d970117da131a49ff17d304707174 |
|
MD5 | 65a62aba38159febe33a8c43be7692bb |
|
BLAKE2b-256 | 5f30253f7d149c5a764a00924f6b659e6c48bd96ad017f277860cf5b1c6e3b26 |
File details
Details for the file xju-1.2.5-py3-none-any.whl
.
File metadata
- Download URL: xju-1.2.5-py3-none-any.whl
- Upload date:
- Size: 94.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e68ca7cd84e9a21abf78c4f60844c3d5224511c160693e077d12354524e23fc6 |
|
MD5 | cc4dd53625c6725ed7391077bf34bf94 |
|
BLAKE2b-256 | 1fa3203555d5c9442c542c36d2228acd1129a30660c27b7f7f97925de84f1a56 |