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-3.0.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

implicitdict-3.0.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for implicitdict-3.0.0.tar.gz
Algorithm Hash digest
SHA256 11b9ea6d849a727b8473e9b41e7a21ebb02611c014a2b0c9e1c597c8764e631e
MD5 d2332eaf1a45766c92d0fa979a3c6eb3
BLAKE2b-256 3f83834fc20d08fc4551868b7062bd266f05d74e17cf1b854f594822cad9dd9b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for implicitdict-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2dc106d148825295c722a9edc6f766fd86cd565923b10fac5015174d3bcb073
MD5 b009b9ed1afe9458409f55302bfa3c2d
BLAKE2b-256 e810396c1f9c22ee9a723f6751090710c32d302d8849c83921ee40a4e9c881ec

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