No project description provided
Project description
Extra Types
Extra types and type utilities for Python. It provides some useful types that can be easily integrated into your code. Documentation available at https://george-ogden.github.io/extra-types/
Example
PosInt represents positive integers.
from extra_types.types import PosInt
isinstance(0, PosInt) # False
isinstance(1, PosInt) # True
isinstance(2, PosInt) # True
isinstance(1.5, PosInt) # False
isinstance(object(), PosInt) # False
# Use it as a type hint
def setup_agents(num_agents: PosInt) -> None:
...
# Validate with attrs
import attrs
@attrs.define
class AgentConfig:
agent_size: PosInt = attrs.field(validator=attrs.validators.instance_of(PosInt))
# Check with strict cast
from extra_types.type_utils import strict_cast
def generate_positive_integer() -> PosInt:
number = ...
return strict_cast(PosInt, number) # raises a TypeError if not a positive integer
Install
Quick Install
uv pip install extra-type-helpers
Slow Install
pip install extra-type-helpers
Bugs/Feedback
Use the issue tracker for bugs/feedback, please.
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 extra_type_helpers-0.8.3.tar.gz.
File metadata
- Download URL: extra_type_helpers-0.8.3.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3f6a6f1e51da03316571c365d5ce883dbeb5683213c3d2c35c94d94a3169ea4
|
|
| MD5 |
5411e6ebfd3dd1369801eb0884bd920d
|
|
| BLAKE2b-256 |
50a181d9de9de0ae5570ff616af76531eb931e40790e4e7eae7b78edf9c966f1
|
Provenance
The following attestation bundles were made for extra_type_helpers-0.8.3.tar.gz:
Publisher:
pypi-publish.yaml on George-Ogden/extra-types
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
extra_type_helpers-0.8.3.tar.gz -
Subject digest:
b3f6a6f1e51da03316571c365d5ce883dbeb5683213c3d2c35c94d94a3169ea4 - Sigstore transparency entry: 1809235720
- Sigstore integration time:
-
Permalink:
George-Ogden/extra-types@1940df455150573255eea9a5ef72dfd2e1341631 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/George-Ogden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@1940df455150573255eea9a5ef72dfd2e1341631 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file extra_type_helpers-0.8.3-py3-none-any.whl.
File metadata
- Download URL: extra_type_helpers-0.8.3-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf9d19802f71443d44b7020329a32b2c4c62b6d1f054f8d0b569c8ff9a5f648b
|
|
| MD5 |
6e3cf042f2d6931afaaf10a3dba90faa
|
|
| BLAKE2b-256 |
1f23a7de55f74f6db5eb7838cef18aacfb9f31efaa3b8988b131bf4e59d390f9
|
Provenance
The following attestation bundles were made for extra_type_helpers-0.8.3-py3-none-any.whl:
Publisher:
pypi-publish.yaml on George-Ogden/extra-types
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
extra_type_helpers-0.8.3-py3-none-any.whl -
Subject digest:
cf9d19802f71443d44b7020329a32b2c4c62b6d1f054f8d0b569c8ff9a5f648b - Sigstore transparency entry: 1809235739
- Sigstore integration time:
-
Permalink:
George-Ogden/extra-types@1940df455150573255eea9a5ef72dfd2e1341631 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/George-Ogden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@1940df455150573255eea9a5ef72dfd2e1341631 -
Trigger Event:
workflow_run
-
Statement type: