candv: Constants & Values

Version of PyPI package Number of downloads of PyPI package Supported versions of Python Package license

unix_build Test coverage

candv stands for Constants & Values. It is a little Python library which provides an easy way for creating complex constants.


You can click a version name to see a diff with the previous one.

  • 1.3.1 (Aug 1, 2015)

    1. Fix the way constants are compared. Now comparison is based on constant’s full_name attribute (issue #11).
  • 1.3.0 (Dec 31, 2014)

    1. Implement to_primitive() method, which can be used for serialization, for example, into JSON (issue #1). See usage and customization for more info.
  • 1.2.0 (Oct 11, 2014)

    1. Core classes were significantly refactored.
    2. constant_class uses Constant as default value (instead of None, see Custom containers for more info).
    3. Support of groups was reimplemented: now they are classes just as other constants containers (earlier groups were instances of patched containers). So, groups automatically gain all those attributes and methods which usual containers have.
    4. Constant’s container attribute was made public. Groups of constants now have it too (see Hierarchies).
    5. API of containers was made really close to API of Python’s dict (see usage for more info):
      • __getitem__, __contains__, __len__ and __iter__ magic methods were implemented;
      • contains method was renamed to has_name;
      • get_by_name method was removed in favor of __getitem__ method.
      • get method with support of default value was introduced.
    6. All objects (contaners, groups and constants) now have name and full_name attributes. This may be useful if you use names of constants as key values (e.g. for Redis).
    7. Also, all objects have good repr now.
    8. Mixin factory with_constant_class() was introduced. It may help you to define more readable containers.
    9. A potential bug of uninitialized unbounded constants was fixed. Unbounded constant is an instance of a class which is differ from container’s constant_class or its subclasses. This is unnatural case, but if you really need it, it will not break now.
    10. Exception messages are more informative now.
    11. Tests were moved out the package.
    12. Introductory documentation was improved. Other docs were updated too.
  • 1.1.2 (Jul 6, 2014)

    • add values and itervalues attributes to ConstantsContainer.
  • 1.1.1 (Jun 21, 2014)

    • switch license from GPLv2 to LGPLv3.
  • 1.1.0 (Jun 21, 2014)

    1. remove Choices container, move it to django-candv-choices library;
    2. update docs and fix typos;
    3. strip utils from requirements.
  • 1.0.0 (Apr 15, 2014)

    Initial version.


Feel free to explore, fork or contribute:


Alexander Oblovatniy (@oblalex) created candv and these fine people have contributed.

Indices and tables