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/ *.egg-info` before retrying
twine upload dist/*
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
Close
Hashes for mbforbes_python_utils-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59fb3661e8c2b76017a17d10c1d32039fff1a96bdfdede5b825b176006f7d2a9 |
|
MD5 | e433689c9299aeaaf0fe84c33c278406 |
|
BLAKE2b-256 | 5470c88aaa88a27bf640a991328dba40fe6fdba0847a061e6c81469c0977c425 |
Close
Hashes for mbforbes_python_utils-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51d69ce7a0379def22ac1ba19301140080e07e5874c531605892a2d4f5ef8f0d |
|
MD5 | 94c3a0f28a1314124b6dfeb207f06f69 |
|
BLAKE2b-256 | 79feef9fbb80ead8f52295f31d5fbe9e387600493f2dca4efbd6037319821e42 |