Skip to main content

python-utils

So maybe I stop writing the same things over and over.

Installation

# Python 3.9+ only (due to PEP 585 type annotations)
pip install mbforbes-python-utils

Usage

from mbforbes_python_utils import read, write, flatten

# read() removes leading/trailing whitespace.
contents = read("foo.txt")

# write() creates intermediate directories if needed.
# Pass `info_print = False` to disable printing.
write("bar/baz.txt", contents)

# flatten() flattens lists.
flatten([[1, [2, [3]]]])  # -> [1, 2, 3]

Tests

python test_mbforbes_python_utils.py

Releasing

I don't do this enough to remember how to do it

# Increment version in setup.py. Then,
pip install twine wheel
python setup.py sdist bdist_wheel
twine check dist/*
# If the above failed, `rm -rf build/ dist/ *.egg-info` before retrying
twine upload dist/*

Metadata

Release files for mbforbes-python-utils 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mbforbes-python-utils 0.5.0
File Size Uploaded Provenance Actions
mbforbes_python_utils-0.5.0.tar.gz 3.2 kB Without provenance Details for mbforbes_python_utils-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mbforbes-python-utils 0.5.0
File Interpreter ABI Platform Actions
mbforbes_python_utils-0.5.0-py3-none-any.whl Python 3 none any Details for mbforbes_python_utils-0.5.0-py3-none-any.whl

Total release size: 7.1 kB

Release files / mbforbes_python_utils-0.5.0.tar.gz

Download URL mbforbes_python_utils-0.5.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c6ac89147e3152531e0c0beb373adb6b2a76d808e20f111721cde5ab4b64ffd3
BLAKE2b-256 checksum
How to use checksums
1f1627eab93b925f93ab190bd6d4b3f589100d00ef58f4d1e7c7cbc91b32d74d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / mbforbes_python_utils-0.5.0-py3-none-any.whl

Download URL mbforbes_python_utils-0.5.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea407a05b1c7321e175a37f8216c62dbf532666d6e234375f630fe30d42a603c
BLAKE2b-256 checksum
How to use checksums
0eabba1d7294cba6535431e5fda182c8eff12f3e81c89cae78485b19645e06da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for mbforbes-python-utils 0.5.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page