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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 918f3fd7a499cbe6857f5327dedd6d21365a89e03bcd49d7751ffe5c0dc99685 |
|
MD5 | 5483bb1dbcd9375c7f42d23d6c67666c |
|
BLAKE2b-256 | e23c4520ec47830cdeabc8599ff72279775e55fe52913eaeb9e9694cb71f32c8 |
Close
Hashes for mbforbes_python_utils-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf31204899c67ad84137e7199ac273ba98ca841cc95a8adca21ed165fd286b62 |
|
MD5 | 041dd357d26d730057bb93851e8cdc33 |
|
BLAKE2b-256 | 4a8884789dae64e95863b5bab2ae6f4061f1ac9d21ef7b905a434910095746fa |