py-utls
Utilities for Python
py-utls is a small Python repository where I put all the useful stuff I regularly need in my projects.
Feel free to use at your discretion with the appropriate license mentions.
NB: I've developed the same kind of libraries for both Go and TypeScript.
Usage
pip install py-utls
This repository contains the following modules:
hex:from_hex: builds the byte array from a string;to_hex: creates the hexadecimal representation of a byte array;
list:chunk: split a list into chunks of a maximum size;flatten: transforms a list of list of items to a list of items;
number:euclidean_division: compute the euclidean division of the passed integers.
from pyutls.hex import from_hex, to_hex
from pyutls.list import chunk, flatten
from pyutls.number import euclidean_division
# Hex utilities
barray = from_hex('1234abcd')
hex_string = to_hex(barray)
assertEqual(hex_string == '1234abcd')
# Flatten a list of list
chunks = chunk(some_list, size)
flat_list = flatten(chunks)
assertListEqual(flat_list == some_list)
# Euclidean division
quotient, remainder = euclidean_division(numerator, denominator)
assertEqual(quotient * denominator + remainder == numerator)
It also constains a CustomLogger class (see its documentation for usage):
import logging
from pyutls import CustomLogger
logger = CustomLogger(level=logging.DEBUG)
logger.with_time("This test line should appear in test logs!", logging.INFO)
Tests
Eventually, add a setup step:
$ git clone https://github.com/cyrildever/py-utls.git
$ cd py-utls/
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install build twine setuptools
Then, proceed to testing:
$ python3 -m unittest discover
License
These modules are distributed under a MIT license.
See the LICENSE file.
© 2022-2026 Cyril Dever. All rights reserved.
Metadata
Release files for py-utls 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_utls-0.3.2.tar.gz | 6.2 kB | Without provenance | Details for py_utls-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_utls-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for py_utls-0.3.2-py3-none-any.whl |
Total release size: 12.3 kB
Release files / py_utls-0.3.2.tar.gz
| Download URL | py_utls-0.3.2.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e82b3ce46b2a1d4c271b96df85f02ae83a2a1b45d4fbb25c2a4cf312a3af479e
|
|
BLAKE2b-256 checksum How to use checksums |
6f06132acbf60decdd1a6a1e852fe87ab94c8217200b1c558003a720847904f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Release files / py_utls-0.3.2-py3-none-any.whl
| Download URL | py_utls-0.3.2-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8d531bdbf1301a501058e2e6d53f3f057657adf93d8f5b343254e816fdf3092
|
|
BLAKE2b-256 checksum How to use checksums |
96e8dc9ce84f6f997254bee24f09366af94333a9b7795aa06da5d74857ecd687
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Security for py-utls 0.3.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.