A simple, type-safe, and extensible Python parsing and validation framework
Project description
🔍 v6e
A simple, type-safe, and extensible Python parsing and validation framework
Why the name?
v6e comes from the numeronym of "validate".
Usage
import v6e as v
my_parser = v.int().gte(18).lte(21)
# Use it only to check if the value conforms
my_parser.check(18) # True
my_parser.check(21) # True
my_parser.check(54) # False
# Use `.parse()` (or call it) to validate and get the parsed value
my_parser.parse(21) # Ok -> Returns 21 (int)
my_parser.parse("21") # Ok -> Returns 21 (int)
my_parser.parse(54) # Err -> Raises a ParseException
my_parser(54) # Err -> Raises a ParseException
v6e also supports custom parsers, custom reusable types, unions of parsers, and more. See more in our docs!
Examples
Check out the examples in ./examples! You can run them locally with:
uv run examples/parsers.py
🐍 Type-checking
This library is fully type-checked. This means that all types will be correctly inferred from the arguments you pass in.
In this example your editor will correctly infer the type:
my_parser = v.int().gte(8).lte(4)
t.reveal_type(my_parser) # Type of "my_parser" is "V6eInt"
t.reveal_type(my_parser.check) # Type of "my_parser.check" is "(raw: Any) -> bool"
t.reveal_type(my_parser.safe_parse) # Type of "my_parser" is "(raw: Any) -> V6eResult[int]"
t.reveal_type(my_parser.parse) # Type of "my_parser" is "(raw: Any) -> int"
t.reveal_type(my_parser.__call__) # Type of "my_parser" is "(raw: Any) -> int"
Why should I care?
Type checking will help you catch issues way earlier in the development cycle. It will also provide nice autocomplete features in your editor that will make you faster ⚡.
Alpha notice
This project is still in its alpha phase. Expect frequent and breaking changes. You can see
more in our planned work doc.
Project details
Release history Release notifications | RSS feed
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 v6e-0.1.11.tar.gz.
File metadata
- Download URL: v6e-0.1.11.tar.gz
- Upload date:
- Size: 20.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af783ce346e636c808e75aabb7e4b11936f5e981c51868671412f9b18109b2f8
|
|
| MD5 |
f113f48e6806a1987edef707b39fa1c5
|
|
| BLAKE2b-256 |
dfcd13ad1e0bf67f7ce0b0d93ce2af8f60b32ec84cdf94989275f79bfbbaf907
|
Provenance
The following attestation bundles were made for v6e-0.1.11.tar.gz:
Publisher:
release.yml on danimelchor/v6e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
v6e-0.1.11.tar.gz -
Subject digest:
af783ce346e636c808e75aabb7e4b11936f5e981c51868671412f9b18109b2f8 - Sigstore transparency entry: 173799717
- Sigstore integration time:
-
Permalink:
danimelchor/v6e@cfc89537eb681ab42d6260685dca4eeafbc42423 -
Branch / Tag:
refs/tags/0.1.11 - Owner: https://github.com/danimelchor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cfc89537eb681ab42d6260685dca4eeafbc42423 -
Trigger Event:
push
-
Statement type:
File details
Details for the file v6e-0.1.11-py3-none-any.whl.
File metadata
- Download URL: v6e-0.1.11-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3ed3ccc0dc6b79708b9b0d8995da286ae28bc5f232cd9a81e6af3b4afa06384
|
|
| MD5 |
aca7475ec7166e6195d9d95173739528
|
|
| BLAKE2b-256 |
48607dbba28bcacd9dd48e667c88fa8805a34c119d59e7c7577ddcc06a5eefc5
|
Provenance
The following attestation bundles were made for v6e-0.1.11-py3-none-any.whl:
Publisher:
release.yml on danimelchor/v6e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
v6e-0.1.11-py3-none-any.whl -
Subject digest:
a3ed3ccc0dc6b79708b9b0d8995da286ae28bc5f232cd9a81e6af3b4afa06384 - Sigstore transparency entry: 173799720
- Sigstore integration time:
-
Permalink:
danimelchor/v6e@cfc89537eb681ab42d6260685dca4eeafbc42423 -
Branch / Tag:
refs/tags/0.1.11 - Owner: https://github.com/danimelchor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cfc89537eb681ab42d6260685dca4eeafbc42423 -
Trigger Event:
push
-
Statement type: