Skip to main content

arcane-typing

PyPI

This package provides advanced typing patterns for Python projects that use ty.

Usage

Add arcane-typing as a dependency to your project:

uv add arcane-typing

Use one of its typing features in your code, for example:

from arcane_typing import has_attr_of_type

def get_name(obj: object) -> str:
    if has_attr_of_type(obj, "name", str):
        return obj.name.upper()
    else:
        return "<unknown>"

Use ty to type-check your code:

uv add --dev ty  # If you are not already using it

uv run ty check

Features

Core functionality and types

  • TypeOf[Keys[T]] gives a union of string literals for the keys that can appear in a TypedDict T.
  • TypeOf[Values[T]] gives the union of value types that can appear in a TypedDict T.

Type-narrowing helpers

  • has_attr_of_type(obj, "name", T) narrows obj.name to type T if the attribute exists and if it is an instance of T (which can be a class or a union of classes)
  • has_item_of_type(obj, "key", T) narrows obj["key"] to T if the mapping contains the key and its value is an instance of T.
  • is_sequence_of(obj, T) checks that obj is a sequence and that every element is an instance of T (which can be a class or a union of classes). It narrows obj to Sequence[T] on success.

Development

Use uv to run the following development tasks:

# Linting and formatting
uv run ruff check
uv run ruff format --check

# Type checking
TY_UV=scripts uv run ty check

# Markdown tests
uv run mdtest.py

Metadata

Release files for arcane-typing 0.2.1

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

Source distribution (sdist)

Source distribution for arcane-typing 0.2.1
File Size Uploaded Provenance Actions
arcane_typing-0.2.1.tar.gz 5.6 kB Without provenance Details for arcane_typing-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arcane-typing 0.2.1
File Interpreter ABI Platform Actions
arcane_typing-0.2.1-py3-none-any.whl Python 3 none any Details for arcane_typing-0.2.1-py3-none-any.whl

Total release size: 13.5 kB

Release files / arcane_typing-0.2.1.tar.gz

Download URL arcane_typing-0.2.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
850736ca6e859934737f5a58d831a33d7bd7c537b7d3197c4fa72c6bee3e7747
BLAKE2b-256 checksum
How to use checksums
4cf626664d740eaa30769a799dc3d6b7aa29b84ba3a9c702b88094220c9543c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / arcane_typing-0.2.1-py3-none-any.whl

Download URL arcane_typing-0.2.1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee27b9954789b24eba978a91f328700fe3f3fae8dec96011f861cb67e52c42dc
BLAKE2b-256 checksum
How to use checksums
e3a758d609bfb715d4258c2250ba9ba672c4c275808720921e1fe7b268f1d798
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for arcane-typing 0.2.1

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.

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