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 only (I'm using Python 3.7).
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.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c0637d0e5cfe32f16e102d7976aad9fcdefb72a88e985305f550e572f85284f |
|
MD5 | 495b12986c74a4cc0bdd2ae1309a570b |
|
BLAKE2b-256 | 64e43b9c80174f9d7f1ccbd355b46f58a4e5fb06bb723c3ab8c69d917095cf96 |
Close
Hashes for mbforbes_python_utils-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fca3b902913a43e24a800d250f2b16521c16cc90ac4c15a2bd8550f037bf526 |
|
MD5 | d5a86a6ba1ab6880ac4cc0aa21613c09 |
|
BLAKE2b-256 | 1c6a60fa0cf59fedf3df46d1ae8f4e08dcd8722f3927ad8815e536d0485e9eaa |