Zut
General-purpose utility Python library to minimize boilerplate code by reusing common code and patterns.
Install
Zut is published on PyPI.
Install with pip:
pip install zut
Zut is designed to work with the Python standard library (version >= 3.7) as its sole mandatory dependency.
Optional dependencies may be installed using an extra specifier:
pip install zut[excel]: write and read Excel files with modulezut.excel(installsopenpyxl defusedxml).pip install zut[tab]: display tabular data elegantly (installstabulate). If this dependency is not included, the library provides a polyfill for thetabulatefunction to handle simple cases.pip install zut[time]: parse timezones from string, get local timezone name or convert between naive and aware datetimes in various timezones (installstzdataandtzlocalon Windows; does not install anything on Linux if Python >= 3.9 because this feature is natively available).pip install zut[perf]: track elapsed time and memory consumption with modulezut.perf(installspsutil).pip install zut[sql]: advanced SQL parsing in modulezut.sql(installssqlparse).
Database adapters:
pip install zut[maria]: access MariaDB databases (installsmysqlclientandsqlparse).pip install zut[mysql]: access MySQL databases (installsmysqlclientandsqlparse).pip install zut[pg]: access PostgreSQL databases (installspsycopgandsqlparse).pip install zut[sqlserver]: access Microsoft SQL Server databases (installspyodbc,sqlparamsandsqlparse).pip install zut[sqlite]: access SQLite databases (installssqlparse).
Use pip install zut[all] to install all extras.
Features
| Module | Summary |
|---|---|
zut.api |
A JSON-oriented API client depending only on the Python standard library. |
zut.build |
Build helpers: get information about Git repositories, transpile makrdown files. |
zut.callback |
HTTP callback server, typically used for redirects of authorization flows. |
zut.choices |
Polyfills for Django's Choices classes so that shared libraries may define choice models without depending on Django. |
zut.collection |
Parse and convert lists and dicts. |
zut.command |
Define and run command-line interfaces. |
zut.config |
Extend ways to access ConfigParser sections. |
zut.context |
Information about the execution context: script path and name, user scopes, SID, etc. |
zut.convert |
Flexible conversion of types. |
zut.csv |
Write and read CSV using flexible format options. |
zut.db |
Generic database access and tools. |
zut.db.base |
Base abstraction to access different database backends. |
zut.db.maria |
Adapter for MariaDB databases. |
zut.db.mysql |
Adapter for MySQL databases. |
zut.db.pg |
Adapter for PostgreSQL databases. |
zut.db.sqlite |
Adapter for SQLite databases. |
zut.db.sqlserver |
Adapter for Microsoft SQL Server databases. |
zut.env |
Load .env files and read environment handling type conversions and default values. |
zut.excel |
Write and read Excel tables (requires zut[excel] extra: openpyxl defusedxml). |
zut.file |
Archivate files. |
zut.geo |
Find geographical libraries. |
zut.gpg |
Encryption and decryption using GnuPG. |
zut.graph |
Topological sort of dependency graphs |
zut.json |
Write and read JSON using extended encoder and decoder. |
zut.locale |
Registration of locales and retrieval of information about locales. |
zut.logging |
Configuration of logging and helpers for specific use cases. |
zut.net |
Resolve DNS with a timeout, check port status, determine proxy, etc. |
zut.numeric |
Parse and convert numbers. |
zut.passwordstore |
Manage passwords with GPG using pass file structure. |
zut.path |
Normalize and check paths, find paths to the root hierarchy, get default application directories. |
zut.perf |
Track elapsed time and memory consumption (requires zut[perf] extra: psutil). |
zut.pip |
Install PyPi dependencies with pip. |
zut.process |
Run processes and handle process errors (wrappers and extensions on stdlib's subprocess). |
zut.secret |
Define and resolve secrets. |
zut.sql |
Format and parse SQL queries. |
zut.tab |
Provide a polyfill for the tabulate function to handle simple cases. |
zut.term |
Console ANSI colors and live, interactive Console output. |
zut.text |
Manage UTF8 BOM, fix encoding issues, generate slugs, provide flexible filters. |
zut.time |
Parse and convert dates, times and time zones. |
zut.typing |
Python typing helpers. |
zut.unittest |
Test runner wrapper and polyfills for unittest. |
zut.url |
Build and manipulate URLs. |
Contribute
Pull requests are welcome.
Legal
This project is licensed under the terms of the MIT license.
Logo by Eric Watson - Dreamstime.com ("Royalty-free vector").
Metadata
Release files for zut 4.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zut-4.1.2-py3-none-any.whl | Python 3 | none | any | Details for zut-4.1.2-py3-none-any.whl |
Release files / zut-4.1.2-py3-none-any.whl
| Download URL | zut-4.1.2-py3-none-any.whl |
|---|---|
| Size | 150.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8f6bd657cf2169cad761c6c48671337e3b59b4f21b6d53dae27b61639d9ffb4
|
|
BLAKE2b-256 checksum How to use checksums |
18dfca63a40596107a4061bc17f71f7fa147e32f9dbf8547520a5306383e35c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for zut 4.1.2
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.