An extensive utility library for python, focusing especially on iterables and a Regex 'Store'.
Project description
myBasis: Ergonomic Python Utilities
Status: Pre-launch — under active development. APIs may change before 1.0.
{align="center"}
An extensive utility library for python, focusing especially on iterables and a Regex "Store".
Install
my-basis is not yet published to PyPI. Every consumer in this ecosystem depends on it the
same way: as an editable local path added via uv.
# pyproject.toml
dependencies = [
"my-basis",
# ...
]
[tool.uv.sources]
my-basis = { path = "../libs/basis", editable = true }
Adjust the relative path to wherever this repo lives on disk from the consuming project,
then run uv sync.
Quickstart
The core loop: cast untyped data into a target type, check whether a value already fits one,
and introspect a type itself as a MyType node.
from my import ty, MyType
# Cast: coerce arbitrary data into a target type, best-effort.
ty.cast('42', int) # -> 42
ty.cast('a,b,c', list[str]) # -> ['a', 'b', 'c']
ty.cast({'a': '1', 'b': '2'}, dict[str, int]) # -> {'a': 1, 'b': 2}
# Check: does this value already conform to a type, without coercing it?
ty.check(42, int) # -> True
ty.check('42', int) # -> False
# MyType: parse any type expression into an introspectable node.
t = MyType(dict[str, int])
t.main # -> <class 'dict'>
t.args # -> (MyType[str], MyType[int])
t.root # -> dict[str, int]
ty is the package-wide Typist singleton -- cast/check/match chambers composed onto
one object. See docs/ (built locally with task docs, or the hosted site once published)
for the full subpackage tour: typing (this cast/check/match/MyType machinery), types,
regex, caches, apis, utils, and files.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file my_basis-0.8.1.tar.gz.
File metadata
- Download URL: my_basis-0.8.1.tar.gz
- Upload date:
- Size: 217.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bc6dbffeadab597495b38400bfb725542d7a81a7c130ebcafc4a0d09ba5b76e
|
|
| MD5 |
058a9f4daa35cd8a2323cc3e13a1c0b3
|
|
| BLAKE2b-256 |
473deaa1637a1aefd8639981971cb489e533f6a3df54b84b16e794f97ba002c1
|
File details
Details for the file my_basis-0.8.1-py3-none-any.whl.
File metadata
- Download URL: my_basis-0.8.1-py3-none-any.whl
- Upload date:
- Size: 254.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35c508f1eace4488a45d3bcd02ac804f2ee1ad892aa474e3fc581c6bd2ff407d
|
|
| MD5 |
0a61539930a7964f3b30729490a256aa
|
|
| BLAKE2b-256 |
386d1e71029c4ea8100851de8b186260dec9fd58ecf800aedf6de7bfa435fd34
|