Metadata-Version: 2.4
Name: zut
Version: 3.1.2
Summary: Reusable Python utilities.
Author-email: Sébastien Hocquet <seb@ipamo.net>
Project-URL: Homepage, https://gitlab.com/ipamo/zut
Project-URL: Bug Tracker, https://gitlab.com/ipamo/zut/issues
Keywords: reusable,util,utils,common,commons,base,csv,excel,etl,db,database,load,bulk,insert,merge,upsert,sqlite,postgresql,pg,mysql,maria,mariadb,sqlserver,mssql
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Provides-Extra: smb
Requires-Dist: smbprotocol; extra == "smb"
Provides-Extra: s3
Requires-Dist: boto3; extra == "s3"
Provides-Extra: zip
Requires-Dist: zipp>=3.2.0; python_version < "3.10" and extra == "zip"
Provides-Extra: pg
Requires-Dist: psycopg[binary]; extra == "pg"
Requires-Dist: sqlparse; extra == "pg"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "pg"
Requires-Dist: pytz; python_version < "3.9" and extra == "pg"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "pg"
Provides-Extra: postgresql
Requires-Dist: psycopg[binary]; extra == "postgresql"
Requires-Dist: sqlparse; extra == "postgresql"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "postgresql"
Requires-Dist: pytz; python_version < "3.9" and extra == "postgresql"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "postgresql"
Provides-Extra: mysql
Requires-Dist: mysqlclient; extra == "mysql"
Requires-Dist: sqlparse; extra == "mysql"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "mysql"
Requires-Dist: pytz; python_version < "3.9" and extra == "mysql"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "mysql"
Provides-Extra: mariadb
Requires-Dist: mysqlclient; extra == "mariadb"
Requires-Dist: sqlparse; extra == "mariadb"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "mariadb"
Requires-Dist: pytz; python_version < "3.9" and extra == "mariadb"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "mariadb"
Provides-Extra: sqlserver
Requires-Dist: pyodbc; extra == "sqlserver"
Requires-Dist: sqlparams; extra == "sqlserver"
Requires-Dist: sqlparse; extra == "sqlserver"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "sqlserver"
Requires-Dist: pytz; python_version < "3.9" and extra == "sqlserver"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "sqlserver"
Provides-Extra: mssql
Requires-Dist: pyodbc; extra == "mssql"
Requires-Dist: sqlparams; extra == "mssql"
Requires-Dist: sqlparse; extra == "mssql"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "mssql"
Requires-Dist: pytz; python_version < "3.9" and extra == "mssql"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "mssql"
Provides-Extra: sqlite
Requires-Dist: sqlparse; extra == "sqlite"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "sqlite"
Requires-Dist: pytz; python_version < "3.9" and extra == "sqlite"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "sqlite"
Provides-Extra: tz
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "tz"
Requires-Dist: pytz; python_version < "3.9" and extra == "tz"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "tz"
Provides-Extra: tabulate
Requires-Dist: tabulate; extra == "tabulate"
Provides-Extra: excel
Requires-Dist: openpyxl; extra == "excel"
Requires-Dist: defusedxml; extra == "excel"
Provides-Extra: django
Requires-Dist: django; extra == "django"
Provides-Extra: perf
Requires-Dist: psutil; extra == "perf"
Provides-Extra: all
Requires-Dist: smbprotocol; extra == "all"
Requires-Dist: boto3; extra == "all"
Requires-Dist: zipp>=3.2.0; python_version < "3.10" and extra == "all"
Requires-Dist: psycopg[binary]; extra == "all"
Requires-Dist: mysqlclient; extra == "all"
Requires-Dist: pyodbc; extra == "all"
Requires-Dist: sqlparams; extra == "all"
Requires-Dist: sqlparse; extra == "all"
Requires-Dist: tzlocal; (python_version < "3.9" or sys_platform == "win32") and extra == "all"
Requires-Dist: pytz; python_version < "3.9" and extra == "all"
Requires-Dist: tzdata; (python_version >= "3.9" and sys_platform == "win32") and extra == "all"
Requires-Dist: tabulate; extra == "all"
Requires-Dist: openpyxl; extra == "all"
Requires-Dist: defusedxml; extra == "all"
Requires-Dist: django; extra == "all"
Requires-Dist: psutil; extra == "all"
Dynamic: license-file

Zut
===

Reusable Python utilities.


## 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` 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` 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 interface 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) | Shared utils between web, cli and module 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 interface 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) | Emulate commonly used fonctions, either for older Python versions, or in case an optional dependency is missing.                   
| [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.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](https://gitlab.com/ipamo/zut/-/blob/main/CONTRIBUTING.md).


## Credits

This project is licensed under the terms of the [MIT license](https://gitlab.com/ipamo/zut/-/raw/main/LICENSE.txt).

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