Zut
===
Reusable classes, functions and abstractions 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.
It also defines common [database abstractions](https://ipamo.net/zut/latest/api/zut.db.html) to access various backends (Postgres, MariaDB, etc) as well as [file abstractions](https://ipamo.net/zut/latest/api/zut.files.html) on various backends (Samba/NFS, S3, etc), in a standardized way, for usual operations.
It also has a specific focus on easing transfer of tabular data to and from different sources (Excel, databases, etc) using CSV as a common communication (dump and load functions).
## Installation
Zut package is published [on PyPI](https://pypi.org/project/zut/). It requires Python version >= 3.7.
Install without any dependency (no dependency 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, if you don't need any of the features below.
### File backends
For [zut.files](https://ipamo.net/zut/latest/api/zut.files.html) package:
- `pip install zut[smb]`: access to Samba/Windows shares (installs `smbprotocol`).
- `pip install zut[s3]`: access to S3 buckets (installs `boto3`).
- `pip install zut[zip]`: access to Zip archives (installs `zipp`, necessary only for Python < 3.10 to mitigate [a bug in the standard library](https://bugs.python.org/issue40564)).
### Database backends
For [zut.db](https://ipamo.net/zut/latest/api/zut.db.html) 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[django]` : Django utilities available in `zut.django` package (installs `django`).
- `pip install zut[perf]` : track memory performance using `zut.perf` package (installs `psutil`).
## Features
See [full documentation](https://ipamo.net/zut) (including [API reference](https://ipamo.net/zut/latest/api-reference.html)).
| Module | Summary
|---------------|------------------------------------------------------------------------------------------------------------------------------------
| [zut](https://ipamo.net/zut/latest/api/zut.html) | Top-level API: most commonly reused utilities (Color, encoding, errors, etc).
| [zut.api](https://ipamo.net/zut/latest/api/zut.api.html) | A JSON-oriented API client using only Python standard library.
| [zut.callback](https://ipamo.net/zut/latest/api/zut.callback.html) | HTTP callback server (for redirects of authorization flows).
| [zut.choices](https://ipamo.net/zut/latest/api/zut.choices.html) | Allow usage of entity classes defined in libraries that may or may not have Django as a dependency depending on the library usage.
| [zut.commands](https://ipamo.net/zut/latest/api/zut.commands.html) | Define and run command-line applications.
| [zut.config](https://ipamo.net/zut/latest/api/zut.config.html) | Configure and access configuration of the system: logging, dotenv, locale.
| [zut.convert](https://ipamo.net/zut/latest/api/zut.convert.html) | Flexible convert functions.
| [zut.csv](https://ipamo.net/zut/latest/api/zut.csv.html) | Write and read CSV tables.
| [zut.db](https://ipamo.net/zut/latest/api/zut.db.html) | A standardized abstraction to access different database backends.
| [zut.db.mariadb](https://ipamo.net/zut/latest/api/zut.db.mariadb.html) | Implementation of `zut.db` for the MariaDB database backend.
| [zut.db.mysql](https://ipamo.net/zut/latest/api/zut.db.mysql.html) | Implementation of `zut.db` for the MySQL database backend.
| [zut.db.pg](https://ipamo.net/zut/latest/api/zut.db.pg.html) | Implementation of `zut.db` for the PostgreSQL database backend.
| [zut.db.sqlite](https://ipamo.net/zut/latest/api/zut.db.sqlite.html) | Implementation of `zut.db` for the SQLite database backend.
| [zut.db.sqlserver](https://ipamo.net/zut/latest/api/zut.db.sqlserver.html) | Implementation of `zut.db` for the Sql Server database backend.
| [zut.django](https://ipamo.net/zut/latest/api/zut.django.html) | Common utilities for Django applications.
| [zut.excel](https://ipamo.net/zut/latest/api/zut.excel.html) | Write and read Excel tables.
| [zut.files](https://ipamo.net/zut/latest/api/zut.files.html) | A standardized abstraction to access different kinds of "files": entries of ZIP archives, samba shares, S3 objects, access via sudo.
| [zut.files.s3](https://ipamo.net/zut/latest/api/zut.files.s3.html) | Implementation of `zut.files` for S3-compatible buckets.
| [zut.files.smb](https://ipamo.net/zut/latest/api/zut.files.smb.html) | Implementation of `zut.files` for Windows/Samba shares.
| [zut.files.sudo](https://ipamo.net/zut/latest/api/zut.files.sudo.html) | Implementation of `zut.files` to access files via sudo.
| [zut.files.zip](https://ipamo.net/zut/latest/api/zut.files.zip.html) | Implementation of `zut.files` for entries of ZIP archives.
| [zut.gpg](https://ipamo.net/zut/latest/api/zut.gpg.html) | GPG and pass utilities.
| [zut.graph](https://ipamo.net/zut/latest/api/zut.graph.html) | Graph utilities.
| [zut.json](https://ipamo.net/zut/latest/api/zut.json.html) | Write and read using JSON format.
| [zut.net](https://ipamo.net/zut/latest/api/zut.net.html) | Resolve network information (DNS resolution with a timeout, port status, system proxy, etc).
| [zut.perf](https://ipamo.net/zut/latest/api/zut.perf.html) | Measurement of elapsed time and memory consumption.
| [zut.polyfills](https://ipamo.net/zut/latest/api/zut.polyfills.html) | Implement features used within Zut, that are currently part of the Python standard library, for older versions of Python.
| [zut.process](https://ipamo.net/zut/latest/api/zut.process.html) | Common wrappers over subprocess.run.
| [zut.slugs](https://ipamo.net/zut/latest/api/zut.slugs.html) | Generate slugs and provide flexible string filters.
| [zut.tabulate](https://ipamo.net/zut/latest/api/zut.tabulate.html) | Emulate a basic _tabulate_ function in case the original _tabulate_ package (developped by Sergey Astanin) is not available as a dependency.
| [zut.term](https://ipamo.net/zut/latest/api/zut.term.html) | Write temporary text on the console.
| [zut.tz](https://ipamo.net/zut/latest/api/zut.tz.html) | Parse and convert timezones.
| [zut.unittest](https://ipamo.net/zut/latest/api/zut.unittest.html) | Utilities for unit tests.
| [zut.urls](https://ipamo.net/zut/latest/api/zut.urls.html) | 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"_).
Raw data
{
"_id": null,
"home_page": null,
"name": "zut",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "reusable, util, utils, wheel, common, commons, base, csv, excel, db, database, load, bulk, insert, sqlite, postgresql, pg, mysql, maria, mariadb, sqlserver, mssql",
"author": null,
"author_email": "S\u00e9bastien Hocquet <seb@ipamo.net>",
"download_url": null,
"platform": null,
"description": "Zut\n===\n\nReusable classes, functions and abstractions to avoid reinventing the wheel.\n\nThis 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.\n\nIt also defines common [database abstractions](https://ipamo.net/zut/latest/api/zut.db.html) to access various backends (Postgres, MariaDB, etc) as well as [file abstractions](https://ipamo.net/zut/latest/api/zut.files.html) on various backends (Samba/NFS, S3, etc), in a standardized way, for usual operations.\n\nIt also has a specific focus on easing transfer of tabular data to and from different sources (Excel, databases, etc) using CSV as a common communication (dump and load functions).\n\n\n## Installation\n\nZut package is published [on PyPI](https://pypi.org/project/zut/). It requires Python version >= 3.7.\n\nInstall without any dependency (no dependency is mandatory):\n\n```sh\npip install zut\n```\n\nIt is also possible to install with an _extra_ specifier to add optional dependencies, for example:\n\n```sh\npip install zut[pg]\n```\n\n## Avalable _extra_ specifiers\n\nPlease note that no dependency is mandatory to use Zut, if you don't need any of the features below.\n\n### File backends\n\nFor [zut.files](https://ipamo.net/zut/latest/api/zut.files.html) package:\n\n- `pip install zut[smb]`: access to Samba/Windows shares (installs `smbprotocol`).\n- `pip install zut[s3]`: access to S3 buckets (installs `boto3`).\n- `pip install zut[zip]`: access to Zip archives (installs `zipp`, necessary only for Python < 3.10 to mitigate [a bug in the standard library](https://bugs.python.org/issue40564)).\n\n### Database backends\n\nFor [zut.db](https://ipamo.net/zut/latest/api/zut.db.html) package:\n\n- `pip install zut[pg]` (synonym: `zut[postgresql]`): access PostgreSQL databases (installs `psycopg` and `sqlparse`).\n- `pip install zut[mysql]` (synonyms: `zut[mariadb]`): access MySQL and MariaDB databases (installs `mysqlclient` and `sqlparse`).\n- `pip install zut[sqlserver]` (synonym: `zut[mssql]`): access Microsoft SQL Server databases (installs `pyodbc`, `sqlparams` and `sqlparse`).\n- `pip install zut[sqlite]`: access SQLite databases (installs `sqlparse`).\n\nThe `tz` extra specifier (see below) is automatically included with all database extra specifiers.\n\n### Miscellaneous features\n\n- `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.\n- `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.\n- `pip install zut[excel]` : manage Excel files with `zut.excel` module (installs `openpyxl` and `defusedxml`).\n- `pip install zut[django]` : Django utilities available in `zut.django` package (installs `django`).\n- `pip install zut[perf]` : track memory performance using `zut.perf` package (installs `psutil`).\n\n\n## Features\n\nSee [full documentation](https://ipamo.net/zut) (including [API reference](https://ipamo.net/zut/latest/api-reference.html)).\n\n| Module | Summary\n|---------------|------------------------------------------------------------------------------------------------------------------------------------\n| [zut](https://ipamo.net/zut/latest/api/zut.html) | Top-level API: most commonly reused utilities (Color, encoding, errors, etc).\n| [zut.api](https://ipamo.net/zut/latest/api/zut.api.html) | A JSON-oriented API client using only Python standard library. \n| [zut.callback](https://ipamo.net/zut/latest/api/zut.callback.html) | HTTP callback server (for redirects of authorization flows).\n| [zut.choices](https://ipamo.net/zut/latest/api/zut.choices.html) | Allow usage of entity classes defined in libraries that may or may not have Django as a dependency depending on the library usage. \n| [zut.commands](https://ipamo.net/zut/latest/api/zut.commands.html) | Define and run command-line applications. \n| [zut.config](https://ipamo.net/zut/latest/api/zut.config.html) | Configure and access configuration of the system: logging, dotenv, locale. \n| [zut.convert](https://ipamo.net/zut/latest/api/zut.convert.html) | Flexible convert functions. \n| [zut.csv](https://ipamo.net/zut/latest/api/zut.csv.html) | Write and read CSV tables.\n| [zut.db](https://ipamo.net/zut/latest/api/zut.db.html) | A standardized abstraction to access different database backends.\n| [zut.db.mariadb](https://ipamo.net/zut/latest/api/zut.db.mariadb.html) | Implementation of `zut.db` for the MariaDB database backend.\n| [zut.db.mysql](https://ipamo.net/zut/latest/api/zut.db.mysql.html) | Implementation of `zut.db` for the MySQL database backend.\n| [zut.db.pg](https://ipamo.net/zut/latest/api/zut.db.pg.html) | Implementation of `zut.db` for the PostgreSQL database backend.\n| [zut.db.sqlite](https://ipamo.net/zut/latest/api/zut.db.sqlite.html) | Implementation of `zut.db` for the SQLite database backend.\n| [zut.db.sqlserver](https://ipamo.net/zut/latest/api/zut.db.sqlserver.html) | Implementation of `zut.db` for the Sql Server database backend.\n| [zut.django](https://ipamo.net/zut/latest/api/zut.django.html) | Common utilities for Django applications.\n| [zut.excel](https://ipamo.net/zut/latest/api/zut.excel.html) | Write and read Excel tables. \n| [zut.files](https://ipamo.net/zut/latest/api/zut.files.html) | A standardized abstraction to access different kinds of \"files\": entries of ZIP archives, samba shares, S3 objects, access via sudo.\n| [zut.files.s3](https://ipamo.net/zut/latest/api/zut.files.s3.html) | Implementation of `zut.files` for S3-compatible buckets.\n| [zut.files.smb](https://ipamo.net/zut/latest/api/zut.files.smb.html) | Implementation of `zut.files` for Windows/Samba shares.\n| [zut.files.sudo](https://ipamo.net/zut/latest/api/zut.files.sudo.html) | Implementation of `zut.files` to access files via sudo.\n| [zut.files.zip](https://ipamo.net/zut/latest/api/zut.files.zip.html) | Implementation of `zut.files` for entries of ZIP archives.\n| [zut.gpg](https://ipamo.net/zut/latest/api/zut.gpg.html) | GPG and pass utilities. \n| [zut.graph](https://ipamo.net/zut/latest/api/zut.graph.html) | Graph utilities. \n| [zut.json](https://ipamo.net/zut/latest/api/zut.json.html) | Write and read using JSON format. \n| [zut.net](https://ipamo.net/zut/latest/api/zut.net.html) | Resolve network information (DNS resolution with a timeout, port status, system proxy, etc). \n| [zut.perf](https://ipamo.net/zut/latest/api/zut.perf.html) | Measurement of elapsed time and memory consumption. \n| [zut.polyfills](https://ipamo.net/zut/latest/api/zut.polyfills.html) | Implement features used within Zut, that are currently part of the Python standard library, for older versions of Python.\n| [zut.process](https://ipamo.net/zut/latest/api/zut.process.html) | Common wrappers over subprocess.run. \n| [zut.slugs](https://ipamo.net/zut/latest/api/zut.slugs.html) | Generate slugs and provide flexible string filters.\n| [zut.tabulate](https://ipamo.net/zut/latest/api/zut.tabulate.html) | Emulate a basic _tabulate_ function in case the original _tabulate_ package (developped by Sergey Astanin) is not available as a dependency.\n| [zut.term](https://ipamo.net/zut/latest/api/zut.term.html) | Write temporary text on the console.\n| [zut.tz](https://ipamo.net/zut/latest/api/zut.tz.html) | Parse and convert timezones. \n| [zut.unittest](https://ipamo.net/zut/latest/api/zut.unittest.html) | Utilities for unit tests. \n| [zut.urls](https://ipamo.net/zut/latest/api/zut.urls.html) | Build URLs. \n\n\n## Contribute\n\nPull requests are welcome.\n\nSee [contributing guidelines](CONTRIBUTING.md).\n\n\n## Credits\n\nThis project is licensed under the terms of the [MIT license](LICENSE.txt).\n\nLogo by [Eric Watson - Dreamstime.com](https://www.dreamstime.com/dreamstime-template-image140091035) (_\"Royalty-free vector\"_).\n",
"bugtrack_url": null,
"license": null,
"summary": "Reusable classes, functions and abstractions to avoid reinventing the wheel.",
"version": "4.0.0",
"project_urls": {
"Bug Tracker": "https://codeberg.org/ipamo/zut/issues",
"Homepage": "https://codeberg.org/ipamo/zut"
},
"split_keywords": [
"reusable",
" util",
" utils",
" wheel",
" common",
" commons",
" base",
" csv",
" excel",
" db",
" database",
" load",
" bulk",
" insert",
" sqlite",
" postgresql",
" pg",
" mysql",
" maria",
" mariadb",
" sqlserver",
" mssql"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4bd7e63ce10ae45d1667ed8ffb9a3d670554ded24f1d19172b1ea027eb1dcd3a",
"md5": "7b52ec606a10cb76dae87e9b06fa6927",
"sha256": "bf6c298ab575d0c7db4e2300b12cba9602d76cda926ef0730cfa4556fb1241b7"
},
"downloads": -1,
"filename": "zut-4.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7b52ec606a10cb76dae87e9b06fa6927",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 159276,
"upload_time": "2025-08-24T08:46:53",
"upload_time_iso_8601": "2025-08-24T08:46:53.819145Z",
"url": "https://files.pythonhosted.org/packages/4b/d7/e63ce10ae45d1667ed8ffb9a3d670554ded24f1d19172b1ea027eb1dcd3a/zut-4.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-24 08:46:53",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": true,
"codeberg_user": "ipamo",
"codeberg_project": "zut",
"lcname": "zut"
}