mpu
Martins Python Utilities (mpu) is a collection of utility functions and classes with no other dependencies.
The total size of the package will never be bigger than 10 MB and currently it is 15.7 kB in zipped form. This makes it a candidate to include into AWS Lambda projects.
Installation
$ pip install git+https://github.com/MartinThoma/mpu.git
It can, of course, also be installed via PyPI.
Usage
Datastructures
>>> from mpu.datastructures import EList
>>> l = EList([2, 1, 0])
>>> l[2]
0
>>> l[[2, 0]]
[0, 2]
>>> l[l]
[0, 1, 2]
Shell
To enhance your terminals output, you might want to do something like:
from mpu.shell import Codes
print('{c.GREEN}{c.UNDERLINED}Works{c.RESET_ALL}'.format(c=Codes))
Quick Examples
Creating small example datastructures is a task I encounter once in a while for StackExchange answers.
from mpu.pd import example_df
df = example_df()
print(df)
gives
country population population_time EUR
0 Germany 82521653.0 2016-12-01 True
1 France 66991000.0 2017-01-01 True
2 Indonesia 255461700.0 2017-01-01 False
3 Ireland 4761865.0 NaT True
4 Spain 46549045.0 2017-06-01 True
5 Vatican NaN NaT True
Money
import mpu
from fractions import Fraction
gross_income = mpu.units.Money('2345.10', 'EUR')
net_income = gross_income * Fraction('0.80')
apartment = mpu.units.Money('501.23', 'EUR')
savings = net_income - apartment
print(savings)
prints 1375.31 Euro
IO
- Download files with
mpu.io.download(source, sink) - Read CSV, JSON and pickle with
mpu.io.read(filepath) - Write CSV, JSON and pickle with
mpu.io.write(filepath, data)
Metadata
Release files for mpu 0.19.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mpu-0.19.0.tar.gz | 58.7 kB | Without provenance | Details for mpu-0.19.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mpu-0.19.0-py3-none-any.whl | Python 3 | none | any | Details for mpu-0.19.0-py3-none-any.whl |
Total release size: 124.2 kB
Release files / mpu-0.19.0.tar.gz
| Download URL | mpu-0.19.0.tar.gz |
|---|---|
| Size | 58.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4bcef1d5d664ff91129e9fc02d7b09aabae633ec38cbe221db7795507b83c62
|
|
BLAKE2b-256 checksum How to use checksums |
e69bd5215ca90e92d1a8c18ac6f9969f14bccfbc902339cada4ff3b89a309475
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
|
Release files / mpu-0.19.0-py3-none-any.whl
| Download URL | mpu-0.19.0-py3-none-any.whl |
|---|---|
| Size | 65.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d32f2848ad821451dc086651295c0029cad582cb738403c46ee95bfde116e9d
|
|
BLAKE2b-256 checksum How to use checksums |
2e9745e827ebe4bd35d0242dd07696f2459e75ec8c669bb8e60bd57c3b7583f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
|
Security for mpu 0.19.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.