Skip to main content

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

xju.cmc.io - pure context management for e.g. file reading and writing

xju.cmc.tstore

xju.cmc.perflog

xju.pq

  • jquery-like html inspection and modification

  • see xju/pq.py.test for sample code

xju.assert_

  • assert functions that capture term values e.g. x and y in Assert(x)==y

  • see xju/assert_.py.test for sample code

xju.cmd

  • 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

xju.json_codec

  • 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

xju.jsonschema

  • 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

xju.patch

  • 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

xju.time

xju.xn

  • Exception wrapping to provide human readable context gathering

  • see xju/xn.py.test for sample code

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xju-1.2.5.tar.gz (65.1 kB view details)

Uploaded Source

Built Distribution

xju-1.2.5-py3-none-any.whl (94.5 kB view details)

Uploaded Python 3

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

Hashes for xju-1.2.5.tar.gz
Algorithm Hash digest
SHA256 9adc85b084536badd37da658d968f143898d970117da131a49ff17d304707174
MD5 65a62aba38159febe33a8c43be7692bb
BLAKE2b-256 5f30253f7d149c5a764a00924f6b659e6c48bd96ad017f277860cf5b1c6e3b26

See more details on using hashes here.

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

Hashes for xju-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e68ca7cd84e9a21abf78c4f60844c3d5224511c160693e077d12354524e23fc6
MD5 cc4dd53625c6725ed7391077bf34bf94
BLAKE2b-256 1fa3203555d5c9442c542c36d2228acd1129a30660c27b7f7f97925de84f1a56

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page