Skip to main content

Reduce a complex Python structure to basic types

[Home | sourcehut | PyPI | ReadTheDocs]

Overview

The as-dict-rec Python library mainly provides the [as_dict_rec()][as_dict_rec.as_dict_rec] function that takes an arbitrarily complex Python data structure (a dictionary, a dataclass, a set of lists of complex numbers, etc) and converts it to a form that may be serialized into an e.g. JSON, TOML, or similar representation.

Installation

A program that uses the as-dict-rec library should specify it in its list of requirements, e.g. using PEP508 syntax:

as-dict-rec >= 0.1.1, < 0.2

Basic usage

Convert a structure to a JSON representation:

print(json.dumps(as_dict_rec.as_dict_rec(complex_data), indent=2))

Skip null values in lists, dictionaries, etc, since TOML cannot represent them:

print(tomli_w.dumps(as_dict_rec.as_dict_rec(complex_data, skip_null=True), indent=2))

Contact

The as-dict-rec library was written by Peter Pentchev. It is developed in a sourcehut repository. This documentation is hosted at Ringlet with a copy at ReadTheDocs.

Metadata

Release files for as-dict-rec 0.1.2

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

Source distribution (sdist)

Source distribution for as-dict-rec 0.1.2
File Size Uploaded Provenance Actions
as_dict_rec-0.1.2.tar.gz 262.1 kB Without provenance Details for as_dict_rec-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for as-dict-rec 0.1.2
File Interpreter ABI Platform Actions
as_dict_rec-0.1.2-py3-none-any.whl Python 3 none any Details for as_dict_rec-0.1.2-py3-none-any.whl

Total release size: 267.6 kB

Release files / as_dict_rec-0.1.2.tar.gz

Download URL as_dict_rec-0.1.2.tar.gz
Size 262.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5752b53e173d8255b554ee8382a9f5c30963d21c839e2b0e357cd69bc9244ed5
BLAKE2b-256 checksum
How to use checksums
b765fb952d0f79bb2cc01d6efc311e4616047083bc033d1b3fd00f513f0800c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / as_dict_rec-0.1.2-py3-none-any.whl

Download URL as_dict_rec-0.1.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
177335b332e25c69733715d9baab1ab6b10a24c8ed642003eaa7d7a47e33f0b3
BLAKE2b-256 checksum
How to use checksums
13b1892ed820a806788cfa2ab20bb57d7e5c2573304535e93c355748f9d3e8cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for as-dict-rec 0.1.2

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