Skip to main content

attributedict PyPI version Build Status Coverage Status

A dictionary object with attributes support.

Install

Install using pip:

$ pip install attributedict

Use

Example:

from attributedict.collections import AttributeDict

data = AttributeDict({'foo': {'bar': [1, 2, 3]}})

data.foo # => `{'bar': [1, 2, 3]}}`
data.foo.bar # => `[1, 2, 3]`

data.foo = {'baz': True}
data.foo = # => `{'baz': True}`

del data.foo.baz

# and/or...

data = AttributeDict({'foo': {'bar': [1, 2, 3]}})

data['foo'] # => `{'bar': [1, 2, 3]}}`
data['foo']['bar'] # => `[1, 2, 3]`

data['foo'] = {'baz': True}
data['foo'] = # => `{'baz': True}`

del data['foo']['baz']

# instance of `dict`...

isinstance(data, dict) # => True
isinstance(data, attributedict.collections.AttributeDict) # => True

isinstance(data.__dict__, dict) # => True
isinstance(data.__dict__, attributedict.collections.AttributeDict) # => False

# no need for custom encoders...

data = AttributeDict({'foo': {'bar': [1, 2, 3]}})

json.dumps(data) # => `{"foo": {"bar": [1, 2, 3]}}`
json.dumps(data.__dict__) # => `{"foo": {"bar": [1, 2, 3]}}`

# etc.

Test

Clone down source code and run:

$ make install
$ make test

License

Released under the MIT license.

Metadata

Release files for attributedict 0.3.0

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

Source distribution (sdist)

Source distribution for attributedict 0.3.0
File Size Uploaded Provenance Actions
attributedict-0.3.0.tar.gz 12.2 kB Without provenance Details for attributedict-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 26.6 kB

Release files / attributedict-0.3.0.tar.gz

Download URL attributedict-0.3.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
983c3ab52ca1817785a3cd22f7d975ead4b1cbe7bc466c5ec1d4728eae791c7a
BLAKE2b-256 checksum
How to use checksums
1fd4a7cd4dfa9eb0e9dfa2d59c29851b6c9067e149a45a17270301d46b0daec5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / attributedict-0.3.0-py3-none-any.whl

Download URL attributedict-0.3.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
501f09c6f4c5d8b6d2d12972e8b777bc4b26db3afdf54cc4ef7e31376809a955
BLAKE2b-256 checksum
How to use checksums
dedb337b36e8d85a07293f5a792644fa972b53a52b13587f484c627009206697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Security for attributedict 0.3.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.

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