swarmauri_typing
swarmauri_typing
Dynamic typing utilities for Swarmauri annotated unions, intersection metadata, and registry-driven component models.
Overview · Installation · Quick Start · Usage · API · Contributing · Governance · License
Overview
Summary
swarmauri_typing provides typing utilities for Swarmauri's dynamic component model. It exposes annotated intersection and union helpers used by swarmauri_base to build Pydantic-compatible component unions from runtime registries.
Why This Package
swarmauri_typing isolates the small dynamic typing helpers used by Swarmauri's component model. It lets foundational packages generate metadata-rich Annotated unions without coupling those helpers to a specific component family.
When to Use
Use swarmauri_typing directly when you need dynamic Annotated type construction in a Swarmauri-compatible package. Most application developers interact with it indirectly through swarmauri_base.ComponentBase, DynamicBase, and SubclassUnion.
Features
Intersectioncreates an annotated union of common classes from multiple input types.IntersectionMetadatapreserves the source classes used to build the intersection annotation.UnionFactorybuilds annotated union types from a user-supplied type lookup function.UnionFactoryMetadatarecords the source model or key used to build a dynamic union.- Annotation extenders allow callers to attach additional metadata such as Pydantic discriminators.
- Python 3.10, 3.11, 3.12, 3.13, and 3.14 support.
Non-Goals
swarmauri_typing owns dynamic typing utilities for Swarmauri annotated unions, intersection metadata, and registry-driven component models. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
Getting Started
Prerequisites
Python >=3.10,<3.15 is required. The manifest declares no direct runtime dependencies. Read the example’s inputs and service requirements before execution.
Installation
Install with uv:
uv add swarmauri_typing
Install with pip:
pip install swarmauri_typing
uv
uv add swarmauri_typing
pip
python -m pip install swarmauri_typing
Poetry
poetry add swarmauri_typing
Quick Start
Example
Source: docs/readme/quick_start.py.
from typing import get_args
from swarmauri_typing import Intersection, IntersectionMetadata
class Root:
pass
class Left(Root):
pass
class Right(Root):
pass
Common = Intersection[Left, Right]
metadata = [
item
for item in get_args(Common)[1:]
if isinstance(item, IntersectionMetadata)
]
assert metadata[0].classes == (Left, Right)
Expected Result
The example demonstrates the documented swarmauri_typing source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
Usage
Common Workflows
Source: docs/readme/usage.py.
from typing import get_args
from swarmauri_typing import Intersection, IntersectionMetadata
class Root:
pass
class Left(Root):
pass
class Right(Root):
pass
Common = Intersection[Left, Right]
metadata = [
item
for item in get_args(Common)[1:]
if isinstance(item, IntersectionMetadata)
]
assert metadata[0].classes == (Left, Right)
Create an intersection annotation:
Create a dynamic annotated union:
from typing import Any
from swarmauri_typing import UnionFactory, UnionFactoryMetadata
class JsonStore:
pass
class SqlStore:
pass
def store_types(model_name: str) -> list[type]:
if model_name == "Store":
return [JsonStore, SqlStore]
return []
StoreUnion = UnionFactory(store_types, name="store_union")["Store"]
assert any(
isinstance(item, UnionFactoryMetadata) and item.name == "store_union"
for item in getattr(StoreUnion, "__metadata__", ())
)
Configuration
Configure swarmauri_typing through the APIs in package source; its manifest describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
Error Handling
The inspected swarmauri_typing source does not establish a package-wide exception hierarchy. Preserve errors from its declared dependencies and validate inputs using the specific public contract in package source.
Best Practices
Use the explicit swarmauri_typing imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing Intersection, IntersectionMetadata, UnionFactory, UnionFactoryMetadata; an import or successful installation alone does not establish its runtime guarantees.
Package Boundary
What It Owns
swarmauri_typing is located in typing and owns dynamic typing utilities for Swarmauri annotated unions, intersection metadata, and registry-driven component models. Source-declared APIs include Intersection, IntersectionMetadata, UnionFactory, UnionFactoryMetadata. The manifest records its direct dependency boundary.
Public API and Import Surfaces
Import namespace: swarmauri_typing.
Source-declared exports or types: Intersection, IntersectionMetadata, UnionFactory, UnionFactoryMetadata.
Inspect package source for exact signatures; this inventory does not designate every internal module as stable.
Entry Points
This package declares no command-line, GUI, or plugin entry points in its manifest.
Injected Dependencies
The direct installation dependencies of swarmauri_typing are empty in the manifest. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in package source.
Protocol Consumers
Direct consumers in this checkout’s package manifests include swarmauri_base. These edges describe declared dependencies, not protocol-conformance evidence.
Extensions
For swarmauri_typing, use the source-declared public interfaces (Intersection, IntersectionMetadata, UnionFactory, UnionFactoryMetadata) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
Operations and Readiness
Operational Requirements
Operate swarmauri_typing according to its actual entry points and collaborators. The dependency and Python requirements in the manifest are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
Health and Observability
This README does not establish a standalone health endpoint for swarmauri_typing. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
Security and Resource Limits
Apply the input, credential, and resource constraints implemented in package source. The swarmauri_typing README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
Compatibility
This source version of swarmauri_typing declares Python >=3.10,<3.15. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
Verification
Tests
Run python -m pytest tests/unit/test_readme_sources.py from the swarmauri_typing package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
- tests/i9n/test_swarmauri_typing__init__.py
- tests/unit/test_Intersection.py
- tests/unit/test_MetadataRepr.py
- tests/unit/test_UnionFactory.py
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
Certification Status
No external certification is asserted for swarmauri_typing by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
Evidence
The README standards CI records mechanical documentation results for its tested commit. The package source and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
FAQ
Why
Q: What does UnionFactory do?
A: UnionFactory builds an Annotated[Union[...], ...] type from a caller-provided lookup function. swarmauri_base uses this pattern for dynamic component subtype unions.
Q: What does Intersection do?
A: Intersection computes common classes from input types and returns an annotated type that carries IntersectionMetadata.
Q: Do most application developers import this package directly?
A: Usually no. Most users get this behavior through swarmauri_base.DynamicBase and SubclassUnion.
How
How do I start? Install or synchronize the environment under Getting Started, follow the maintained example for swarmauri_typing, and consult package source for the exact types and signatures involved.
When
When should I validate an upgrade? Recheck swarmauri_typing whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
Documentation and Related Packages
More Documentation
The repository contribution guide, package source, and manifest provide the supporting context for swarmauri_typing. The README policy defines the common document structure.
Related Packages
Foundational packages:
- swarmauri_base uses these typing helpers for dynamic component deserialization.
- swarmauri_core provides the interface contracts for Swarmauri component families.
- swarmauri provides the namespace importer and plugin discovery layer.
- swarmauri_standard provides first-party components that depend on the core/base typing model.
Component-kind packages that benefit from dynamic typing:
- swarmauri_signing_ed25519
- swarmauri_crypto_composite
- swarmauri_keyprovider_inmemory
- swarmauri_storage_memory
- swarmauri_transport_stdio
Project Links
Contributing
How to Contribute
When changing these helpers, keep the API small and compatible with Pydantic metadata usage in swarmauri_base, add focused tests for generated annotations, and follow the Swarmauri SDK contribution guide.
Development Setup
Work from the pkgs/00-typing/swarmauri_typing checkout. Synchronize its declared development environment with uv, then run the relevant package tests and python -m pytest tests/unit/test_readme_sources.py. The repository’s dedicated README job installs readme-standards==0.1.3 without resolving unrelated runtime packages.
Notes for Maintainers
Swarmauri Component Usage
swarmauri_base.DynamicBase uses UnionFactory to turn registered component subtypes into discriminated unions. This lets models typed with SubclassUnion[BaseComponent] hydrate concrete subclasses from serialized payloads that include a type field.
from pydantic import Field
from swarmauri_typing import UnionFactory
def component_types(model_name: str) -> list[type]:
return []
SubclassUnion = UnionFactory(
component_types,
name="subclass_union",
annotation_extenders=[Field(discriminator="type")],
)
Governance
Ownership and Decision Making
Changes to swarmauri_typing follow the maintainer review process of swarmauri/swarmauri-sdk and its contribution guide. Author attribution remains in the manifest; this README does not assign new publishing or administrative authority.
Standards and Policies
swarmauri_typing follows the versioned package-guide-v1 outline. All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
Lifecycle and Migration
The swarmauri_typing source version is 0.11.0.dev4. This change standardizes documentation and adds a development-only gate; it does not publish a new runtime version or declare a previously unpublished package released. Preserve explicit deprecation and replacement instructions where present.
License and Attribution
License
Licensed under Apache-2.0. See LICENSE.
Apache-2.0
Notices
See NOTICE for attribution.
Metadata
Release files for swarmauri_typing 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_typing-0.11.0.tar.gz | 17.9 kB | Without provenance | Details for swarmauri_typing-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_typing-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_typing-0.11.0-py3-none-any.whl |
Total release size: 32.0 kB
Release files / swarmauri_typing-0.11.0.tar.gz
| Download URL | swarmauri_typing-0.11.0.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
640e5bd6893deef920279b87c12f322fe7ae63257673ac94030b5ef64be60a05
|
|
BLAKE2b-256 checksum How to use checksums |
bea3a590a000f8d6ded9ac52a4ffbb27427d150be8aa9d53ae76beaac8cbab4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_typing-0.11.0-py3-none-any.whl
| Download URL | swarmauri_typing-0.11.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba6ff96a4563661d9e9b83dd4622def0fee929dc42bb4bbbb795a52d17df3a8b
|
|
BLAKE2b-256 checksum How to use checksums |
684c1d04dd960cf322f91941fa7314ec6ca42503940ad6a4d6dc1c4f66c18672
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri_typing 0.11.0
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.