Skip to main content

Structutils

Structutils is a Python library for working with structured data.

It supports Python 3.14 and later.

Installation

Structutils is available on PyPI under the name pstructutils.

Types

Inferring a type form from a value

import structutils

structutils.infer_type([1, 2, 3]) # => list[int]

Formatting a type form

import structutils

structutils.format_type(list[int]) # => 'list[int]'

Configuration

Creating and validating a schema

import structutils

@dataclass
class User:
  age: int
  name: str

type Users = list[User]

try:
  structutils.check(Users)
except structutils.SchemaError as e:
  print(f"Invalid schema: {e}")

Generating a JSON schema from a schema

import structutils

with Path('schema.json').open('w') as file:
  json.dump(structutils.generate(Users), file)

Instantiating data using a schema

import structutils

with Path('data.json').open() as file:
  raw_data = json.load(file)

try:
  data = structutils.instantiate(Users, raw_data)
except structutils.InstantiationError as e:
  print(f"Invalid data: {e}")

Miscellaneous

Loading an object from a string specifier

import structutils

pathlib = structutils.load('pathlib', allow_modules=True)
Iterable = structutils.load('collections.abc:Iterable')

Metadata

Release files for pstructutils 1.0

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

Built distribution (wheel)

Table of built distributions (wheels) for pstructutils 1.0
File Interpreter ABI Platform Actions
pstructutils-1.0-py3-none-any.whl Python 3 none any Details for pstructutils-1.0-py3-none-any.whl

Release files / pstructutils-1.0-py3-none-any.whl

Download URL pstructutils-1.0-py3-none-any.whl
Size 34.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3445d2826078afee71b20e8f56ca2f8d1f1dd5970111483f8f637d92823078a
BLAKE2b-256 checksum
How to use checksums
37fd7f0bbc4ca6c7f2e57c93de3cf35b2818f3ecf1698d50b160f71e943d3157
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 May 10, 2026.

Transparency log

Security for pstructutils 1.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.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for pstructutils-1.0-py3-none-any.whl

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 May 10, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file Full provenance

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