zut 4.0.6
Reusable Python utilities to avoid reinventing the wheel.
Requires Python: >=3.7
Keywords: reusable, util, utils, wheel, common, commons, base, csv, excel, db, database, load, bulk, insert, sqlite, postgresql, pg, mysql, maria, mariadb, sqlserver, mssql

Zut
===

Reusable Python utilities to avoid reinventing the wheel.

This library provides many general-purpose classes and functions, that I found myself needing in many contexts over the years, as complements to the Python standard library.


## Installation

Zut package is published [on PyPI](https://pypi.org/project/zut/). It requires Python version >= 3.7.

Install without any dependency (none is mandatory):

```sh
pip install zut
```

It is also possible to install with an _extra_ specifier to add optional dependencies, for example:

```sh
pip install zut[pg]
```


## Avalable _extra_ specifiers

Please note that no dependency is mandatory to use Zut.

### Database backends

For `zut.db` package:

- `pip install zut[pg]` (synonym: `zut[postgresql]`): access PostgreSQL databases (installs `psycopg` and `sqlparse`).
- `pip install zut[mysql]` (synonyms: `zut[mariadb]`): access MySQL and MariaDB databases (installs `mysqlclient` and `sqlparse`).
- `pip install zut[sqlserver]` (synonym: `zut[mssql]`): access Microsoft SQL Server databases (installs `pyodbc`, `sqlparams` and `sqlparse`).
- `pip install zut[sqlite]`: access SQLite databases (installs `sqlparse`).

The `tz` extra specifier (see below) is automatically included with all database extra specifiers.

### Miscellaneous features

- `pip install zut[tz]` : parse timezones from string, get local timezone name or convert between naive and aware datetimes in various timezones (installs `tzdata` and `tzlocal` on Windows). This extra specifier does not install anything on Linux (for Python >= 3.9) because this feature is natively available.
- `pip install zut[tabulate]` : 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[excel]` : manage Excel files with `zut.excel` module (installs `openpyxl` and `defusedxml`).
- `pip install zut[perf]` : track memory performance using `zut.perf` package (installs `psutil`).

### All features

Use `pip install zut[all]` to install all optional dependencies.


## Features

| Module        | Summary
|---------------|------------------------------------------------------------------------------------------------------------------------------------
| `zut.api` | A JSON-oriented API client using only Python standard library.                                                   
| `zut.callback` | HTTP callback server (for redirects of authorization flows).
| `zut.choices` | Allow usage of Django-like Choices classes for libraries that have optional Django dependency.
| `zut.commands` | Define and run commands and command-line applications.
| `zut.console` | Console colors and other terminal utilities (live/transient output that can be erased).
| `zut.convert` | Flexible conversion functions.
| `zut.csv` | Write and read CSV tables.
| `zut.db` | A standardized abstraction to access different database backends.
| `zut.db.mariadb` | Implementation of `zut.db` for the MariaDB database backend.
| `zut.db.mysql` | Implementation of `zut.db` for the MySQL database backend.
| `zut.db.pg` | Implementation of `zut.db` for the PostgreSQL database backend.
| `zut.db.sqlite` | Implementation of `zut.db` for the SQLite database backend.
| `zut.db.sqlserver` | Implementation of `zut.db` for the Sql Server database backend.
| `zut.desktop` | Desktop utilities.
| `zut.docker` | Docker utilities.
| `zut.encoding` | Encoding helpers: skip UTF8 BOM, fix encoding issues for files opened with surrogateescape, etc.
| `zut.env` | Load `.env` file and get values from environment.
| `zut.errors` | Error classes.
| `zut.excel` | Write and read Excel tables.
| `zut.geo` | Geography/spatial utilities.
| `zut.gpg` | Encryption and decryption using GnuPG, including management of passwords with `pass`, "the standard unix password manager" (see: https://www.passwordstore.org/).
| `zut.graph` | Graph utilities.
| `zut.json` | Write and read using JSON format.
| `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 network information (DNS resolution with a timeout, port status, system proxy, etc).
| `zut.numbers` | Parse and convert numbers.
| `zut.paths` | Path and file helpers: find directories and files, archivate, etc.
| `zut.perf` | Measurement of elapsed time and memory consumption.
| `zut.process` | Run processes and handle process errors (wrappers and extensions on stdlib's `subprocess`).
| `zut.pypi` | PyPI and pip utilities.
| `zut.secrets` | Definition and resolution of delayable secrets (specified with `keyring:`, `file:`, `pass:`, `systemd:` or `env:` prefixes) and other secret/password helpers.
| `zut.slugs` | Generate slugs and provide flexible string filters.
| `zut.source` | Building blocks for extraction tools.
| `zut.sql` | Formatting and parsing for SQL queries.
| `zut.tables` | General-purpose utilities for tabular data: Column class, tabulate functions (including a polyfill if necessary).
| `zut.time` | Parse and convert datetimes and timezones.
| `zut.types` | Type and Python language utilities.
| `zut.unittest` | Utilities for unit tests.
| `zut.urls` | Build URLs.


## Contribute

Pull requests are welcome.

See [contributing guidelines](CONTRIBUTING.md).


## Credits

This project is licensed under the terms of the [MIT license](LICENSE.txt).

Logo by [Eric Watson - Dreamstime.com](https://www.dreamstime.com/dreamstime-template-image140091035) (_"Royalty-free vector"_).