Skip to main content

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.

Release files for extra-type-helpers 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for extra-type-helpers 0.8.3
File Size Uploaded
extra_type_helpers-0.8.3.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for extra-type-helpers 0.8.3
File Interpreter ABI Platform
extra_type_helpers-0.8.3-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / extra_type_helpers-0.8.3.tar.gz

Download URL extra_type_helpers-0.8.3.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b3f6a6f1e51da03316571c365d5ce883dbeb5683213c3d2c35c94d94a3169ea4
BLAKE2b-256 checksum
How to use checksums
50a181d9de9de0ae5570ff616af76531eb931e40790e4e7eae7b78edf9c966f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Release files / extra_type_helpers-0.8.3-py3-none-any.whl

Download URL extra_type_helpers-0.8.3-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf9d19802f71443d44b7020329a32b2c4c62b6d1f054f8d0b569c8ff9a5f648b
BLAKE2b-256 checksum
How to use checksums
1f23a7de55f74f6db5eb7838cef18aacfb9f31efaa3b8988b131bf4e59d390f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.3 This release

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page