Skip to main content

ImplicitDict base class that turns a subclass into a dict indexing attributes, making [de]serialization easy for complex typing-annotated data types.

Project description

implicitdict

This library primarily provides the ImplicitDict base class which enables the inheriting class to implicitly be treated like a dict with entries corresponding to the fields of the inheriting class. Simple example:

class MyData(ImplicitDict):
    foo: str
    bar: int = 0
    baz: Optional[float]

data: MyData = ImplicitDict.parse({'foo': 'asdf', 'bar': 1}, MyData)
assert json.dumps(data) == '{"foo": "asdf", "bar": 1}'

See class documentation for ImplicitDict and test_normal_usage.py for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

implicitdict-4.0.0.tar.gz (57.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

implicitdict-4.0.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file implicitdict-4.0.0.tar.gz.

File metadata

  • Download URL: implicitdict-4.0.0.tar.gz
  • Upload date:
  • Size: 57.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for implicitdict-4.0.0.tar.gz
Algorithm Hash digest
SHA256 d7a799822e6be60884b7a4a91716d1ec805c184040e8b3da3eac6d0d4c012d2e
MD5 30e9f299368280083ed46ad56a4e8e6b
BLAKE2b-256 d13508b36415cd0da95c347ce9e2ad74440d67108a3a14e47ec39ffb8141bd85

See more details on using hashes here.

File details

Details for the file implicitdict-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: implicitdict-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for implicitdict-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0450ce897b982a32c8969c5c7a8d6fe0896add536c64a13403c2b6d2f86ef20
MD5 4eb6951d4765d2fbcceb04a0f10e8f12
BLAKE2b-256 bf0c2b5bc3961cc1d0cc279cb7ef29b0dcdba328a935dfa5c9b8a36d5876d3e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page