Some tiny python utils so I can be lazier.
Project description
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/` before retrying
twine upload dist/*
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
Built Distribution
Close
Hashes for mbforbes_python_utils-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bf8de36da01a25873f78d773a662dd1df9298cff294d3c570e1024c40bdbad0 |
|
MD5 | fb3a2477893997e82c4805595d5c3143 |
|
BLAKE2b-256 | 48974c63bd08d603b1e3afbacb175bee40f8ef3ac5fc8ac161b9d2a43bbd994d |
Close
Hashes for mbforbes_python_utils-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fa30aa024346d274c3418d5b253acf4895504732da1d7c4b4ecb53bf0f39d34 |
|
MD5 | 7b69c8da9cda604f3394d029d0771db2 |
|
BLAKE2b-256 | 12c873568772f41d4bf6e5c30c89fa908267bfd10d40692bb538408ffc8ceb97 |