Skip to main content

Various Python utility functions

Project description

Boxine - bx_py_utils

Various Python utility functions

Quickstart

pip install bx_py_utils

Existing stuff

Here only a simple list about existing utilities. Please take a look into the sources and tests for deeper informations.

bx_py_utils.anonymize

  • anonymize() - Anonymize the given string with special handling for eMail addresses.

bx_py_utils.auto_doc

bx_py_utils.aws.client_side_cert_manager

bx_py_utils.aws.secret_manager

bx_py_utils.compat

bx_py_utils.dict_utils

  • dict_get() - nested dict get()
  • pluck() - Extract values from a dict, if they are present

bx_py_utils.environ

bx_py_utils.error_handling

  • print_exc_plus() - Print traceback information with a listing of all the local variables in each frame.

bx_py_utils.graphql_introspection

bx_py_utils.hash_utils

bx_py_utils.humanize.pformat

  • pformat() - Format given object: Try JSON fist and fallback to pformat()

bx_py_utils.humanize.time

bx_py_utils.iteration

  • chunk_iterable() - Returns a generator that yields slices of iterable of the given chunk_size.

bx_py_utils.path

bx_py_utils.processify

bx_py_utils.stack_info

bx_py_utils.test_utils.assertion

bx_py_utils.test_utils.datetime

  • parse_dt() - Helper for easy generate a datetime instance via string.

bx_py_utils.test_utils.filesystem_utils

  • FileWatcher() - Helper to record which new files have been created.

bx_py_utils.test_utils.log_utils

  • RaiseLogUsage() - A log handler, that raise an error on every log output.

bx_py_utils.test_utils.mock_aws_secret_manager

bx_py_utils.test_utils.mock_boto3session

bx_py_utils.test_utils.requests_mock_assertion

bx_py_utils.test_utils.snapshot

Assert complex output via auto updated snapshot files with nice diff error messages.

bx_py_utils.test_utils.time

Backwards-incompatible changes

v36 -> v37 - Outsourcing Django stuff

We split bx_py_utils and moved all Django related utilities into the separated project:

So, bx_py_utils is better usable in non-Django projects, because Django will not installed as decency of "bx_py_utils"

developing

To start developing e.g.:

~$ git clone https://github.com/boxine/bx_py_utils.git
~$ cd bx_py_utils
~/bx_py_utils$ make
help                 List all commands
install-poetry       install or update poetry
install              install via poetry
update               Update the dependencies as according to the pyproject.toml file
lint                 Run code formatters and linter
fix-code-style       Fix code formatting
tox-listenvs         List all tox test environments
tox                  Run pytest via tox with all environments
tox-py36             Run pytest via tox with *python v3.6*
tox-py37             Run pytest via tox with *python v3.7*
tox-py38             Run pytest via tox with *python v3.8*
tox-py39             Run pytest via tox with *python v3.9*
pytest               Run pytest
pytest-ci            Run pytest with CI settings
publish              Release new version to PyPi
clean                Remove created files from the test project

License

MIT. Patches welcome!

Links

Project details


Release history Release notifications | RSS feed

This version

45

Download files

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

Source Distribution

bx_py_utils-45.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

bx_py_utils-45-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file bx_py_utils-45.tar.gz.

File metadata

  • Download URL: bx_py_utils-45.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for bx_py_utils-45.tar.gz
Algorithm Hash digest
SHA256 ac403213b0f411edc5678ba8a9749f141b9e25fbe5509c3ca817c9b977e15e4f
MD5 3545baa481ee857e49df62594a442f97
BLAKE2b-256 9933b4e621dca531228d85758c7feb3817b4767853b88ed6b0eda845ef86ca95

See more details on using hashes here.

File details

Details for the file bx_py_utils-45-py3-none-any.whl.

File metadata

  • Download URL: bx_py_utils-45-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for bx_py_utils-45-py3-none-any.whl
Algorithm Hash digest
SHA256 276e7f5d06b85de21628eb5cbbdac7e23226a9c760ece2fb93a14116008c0d85
MD5 b1e4876c31e0ca3888effe1cd4059f9a
BLAKE2b-256 2ce7fabe7b183ebef98e537e1b0b04f1d592907ed606ba23492852f1c0dc6193

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