Skip to main content

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 module zut.excel (installs openpyxl defusedxml).
  • pip install zut[tab] : display tabular data elegantly (installs tabulate). If this dependency is not included, the library provides a polyfill for the tabulate function 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 (installs tzdata and tzlocal on 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 module zut.perf (installs psutil).
  • pip install zut[sql] : advanced SQL parsing in module zut.sql (installs sqlparse).

Database adapters:

  • pip install zut[maria]: access MariaDB databases (installs mysqlclient and sqlparse).
  • pip install zut[mysql]: access MySQL databases (installs mysqlclient and sqlparse).
  • pip install zut[pg]: access PostgreSQL databases (installs psycopg and sqlparse).
  • pip install zut[sqlserver]: access Microsoft SQL Server databases (installs pyodbc, sqlparams and sqlparse).
  • pip install zut[sqlite]: access SQLite databases (installs sqlparse).

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.

See contributing guidelines.

Legal

This project is licensed under the terms of the MIT license.

Logo by Eric Watson - Dreamstime.com ("Royalty-free vector").

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zut-4.1.1-py3-none-any.whl (149.9 kB view details)

Uploaded Python 3

File details

Details for the file zut-4.1.1-py3-none-any.whl.

File metadata

  • Download URL: zut-4.1.1-py3-none-any.whl
  • Upload date:
  • Size: 149.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.5

File hashes

Hashes for zut-4.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13d5b19ca2dba24768ab0629552c21923dc8a4a5e8d674fa9c298392c47dc0e0
MD5 064caa3e7e3b781c0b629966f00f750c
BLAKE2b-256 66d0dea5632acaa9c356c6a8f71e82e445dc71356f8de89e7067cf66645f90f8

See more details on using hashes here.

Release history Release notifications | RSS feed

4.1.2

1 file

This release

4.1.1 This release

1 file

4.1.0

1 file

3.2.1

1 file

3.2.0

1 file

3.1.3

1 file

3.1.2

1 file

3.1.1

1 file

3.1.0

1 file

3.0.1

1 file

2.1.1

1 file

2.1.0

1 file

2.0.0

1 file

1.2.1

1 file

1.2.0

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.0

1 file

0.9.4

1 file

0.9.3

1 file

0.9.2

1 file

0.9.1

1 file

0.9.0

1 file

0.8.6

1 file

0.8.5

1 file

0.8.4

1 file

0.8.3

1 file

0.8.2

1 file

0.8.1

1 file

0.8.0

1 file

0.7.10

1 file

0.7.9

1 file

0.7.8

1 file

0.7.7

1 file

0.7.6

1 file

0.7.5

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7.0

1 file

0.6.7

1 file

0.6.6

1 file

0.6.5

1 file

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6.0

1 file

0.5.3

1 file

0.5.2

1 file

0.5.1

1 file

0.5.0

1 file

0.4.5

1 file

0.4.4

1 file

0.4.3

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page