Skip to main content

Attribute-based data structures.

Project description

attrbox

Attribute-based data structures.

Build Status attrbox on PyPI

Changelog - Issues - Documentation

Why?

There are three things I repeatedly have to deal with:

  1. AttrDict deals with shortcomings of the standard python dict:

    • You can use attribute syntax (thing.prop instead of thing["prop"]).
    • Instead of handling KeyError or using .get(None), you can just get a None by default.
    • It's easy to merge nested dict objects using the << operator.
  2. AttrList lets you build a powerful container that can easily query attributes of its members.

  3. JSend is a rough implementation of the JSend sepecification that makes it easy to create standard JSON responses.

Install

pip install attrbox

Example

import json
from attrbox import AttrDict

config = AttrDict() << json.load(open('test/example-appengine.json'))
print(config.deployment.files["example-resource-file1"].sourceUrl)
# => "https://storage.googleapis.com/[MY_BUCKET_ID]/example-application/example-resource-file1"

License

MIT License

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

attrbox-0.1.0.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

attrbox-0.1.0-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

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