skillfed

constantly

Symbolic constants in Python

constantly v23.10.4 14.2M downloads/30d#1,244 on PyPI24
Permissive license MIT Active released

What it is and what it does

Constantly provides a way to define and work with symbolic constants in Python—a more structured alternative to plain module-level variables or enums. It originated from the Twisted project's internal constant system and offers support for text values, numeric values, and bit flags organized into named collections. The library is pure Python with no external dependencies, making it lightweight and easy to integrate.

Developers use it when they need a clean, type-safe way to represent a fixed set of named values—such as status codes, configuration options, or protocol flags—without the overhead of a full enum class. It's particularly useful in projects that already depend on Twisted or in codebases where enum semantics don't quite fit the use case.

Use it for:

  • Define status codes or state constants that need to be grouped and referenced by name.
  • Create bit flag constants for protocol or permission systems where multiple flags combine.
  • Build configuration option sets that are safer than raw strings or integers.
  • Organize numeric constants (e.g., error codes) into named collections for clarity.
  • Replace ad-hoc constant definitions in Twisted-based projects with a standard library.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides symbolic constant support in Python, including collections and constants with text, numeric, and bit flag values.

Yes, if you need a lightweight, dependency-free way to define symbolic constants. The library is actively maintained, has no security vulnerabilities, and works across modern Python versions. It's worth installing for projects that benefit from structured constant definitions—particularly those already using Twisted or preferring this API over Python's built-in enum module.

Install

constantly on PyPI

pip

pip install constantly

uv

uv add constantly

poetry

poetry add constantly

Installing constantly

Before you install

Low install friction; pure Python wheel with no runtime dependencies. Active maintenance with recent commits; last release 1021 days ago but repository remains current.

License in practice

MIT license (permissive); you can use this freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install constantly

from constantly import ValueConstant, Names

class Colors(Names):
    RED = ValueConstant()
    GREEN = ValueConstant()
    BLUE = ValueConstant()

Requires Python 3.8 or later.

Verify before relying

  • Whether the package's constant syntax and API remain stable for long-term use in large codebases.
  • Performance characteristics when working with very large constant collections.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 1,021 days since the last release
Last repo commit
First released
Downloads 14,174,793/month — #1,244 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: constantly-23.10.4-py3-none-any.whl

Keywords: constants, enum, twisted

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules

Tags

symbolic constants pythonenum-like constantsconstant collectionsbit flag constantstyped constants libraryconstant definitionspython constants module
constantsenum-alternativetwisted

More Python Modules packages