Skip to main content

A minimal but opinionated dict/object combo (like Bunch).

Project description

ctx - A minimal but opinionated dict/object combo (like Bunch).


The ctx module should work with all versions of Python.


The ctx module provides the Ctx class which is a subclass of the python ‘dict’ object.

Ctx modifies ‘dict’ in the following ways:

1 The dictionary items can be read or set using attribute access notation.

‘ctx.a’ is identical to ‘ctx[“a”]’ and ‘ctx.a = 5’ is identical to ‘ctx[“a”] = 5’

2 The objects attributes can be read using item access notation.

‘ctx[“__doc__”]’ is identical to ‘ctx.__doc__’

3 The objects attributes can not be set under any circumstances.

4 The dictionary can not have a key with the same name as an objects attribute.

‘’ and ‘ctx[“name”]’ are resolved using the following three steps.

  1. if the object has an attribute ‘name’ then return the attribute.

b) if the dictionary has a key ‘name’ then return the value associated with the key.

  1. raise LookupError.

‘ = 5’ and ‘ctx[“name”] = 5’

  1. If name is an attribute of the class then raise AttributeError.
  2. set the dictionary item as usual.


You can install this package using pip with the following command.

pip install ctx


To report any bugs, or ask any question, please visit


Here is a list of useful links about this project.

Project details

Download files

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

Files for ctx, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size ctx-0.1.2-py2.py3-none-any.whl (4.6 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size ctx-0.1.2.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page