Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Recursive attribute tools.

Project Description

Access and inspect attributes shackled to an object. Shackles is MIT Licensed.


To install configit, simply:

$ pip install shackles

API Documentation

shackles.broken(obj, chain)

Return name of first missing named attribute of object.

If chain is not broken (all attributes are represented in chain) nothing is returned.

# obj.a.b.e
assert shackles.broken(obj, 'a.b.c') == 'c'
shackles.get(obj, chain[, default])

Return value of final named attribute in chain of object.

If a named attribute does not exist, default is returned if provided, otherwise AttributeError is raised.

# obj.a.b
assert shackles.get(obj, 'a.b.c', 5) == 5

# obj.a.b.c = 6
assert shackles.get(obj, 'a.b.c', 5) == 6
shackles.has(obj, chain)
Return True if the chain of attributes exists on the object, False if not.
# obj.a.b.c
assert shackles.has(obj, 'a.b.c']) == True
shackles.walk(obj, chain)

Generate the values of the attributes in the chain by walking the named attributes in the chain from the object.

If a named attribute does not exist, default is returned if provided, otherwise AttributeError is raised.

# a = obj; b = obj; c = obj
# = 'a'; = 'b'; = 'c'
# a.b = b; b.c = c
assert next(shackles.walk(a, 'b.c')).name == 'b'

For further examples refer to included tests.


  1. Fork the repository on Github to start making your changes to the develop branch (or branch off of it).

  2. Install to your env or venv by running:

    $ python develop
  3. Write a test which shows that the bug was fixed or that the feature works as expected.

  4. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS.

Release History

This version
History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(3.4 kB) Copy SHA256 Hash SHA256
Source None Sep 27, 2012

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers