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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb2a1026acf5856d82371e02bd9ba7dc564fac2be548ecde72e0f246511af567 |
|
MD5 | e44b049dbf9326aa295245d8cb62f333 |
|
BLAKE2b-256 | 122b631e0f235bf83d9133e8c1dfc8855e7109a6c63ff725a9ae8aa07e43dfa8 |
Close
Hashes for mbforbes_python_utils-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ddf6591e1c3b305aeaa25ed2b288183b88a45c3fbf6eb9965449e0ab208313a |
|
MD5 | a776eab905686c512f255b9dbb560b12 |
|
BLAKE2b-256 | d78ad1f5a8145420caafc597a02ed9e698df087b691aa1f30c2ca02eb37f6e0f |