Registerer
Sometimes you may want to use a string to identify a specific function or class. This is a common way of designing your code, but it can be tricky to do it without repeating yourself. Registerer is a tool that helps you to do this easily, and also makes sure that your code is explicit and type safe.
TLDR
Write this:
import registerer
command_handler_registry = registerer.Registerer()
@command_handler_registry.register()
def info(args):
return "how can i help you?"
@command_handler_registry.register()
def play(args):
return "let me play a song for you"
command = "info"
args = {}
assert command_handler_registry[command](args) == "how can i help you?"
Instead of this, which violates the Open-Closed Principle (OCP):
def info(args):
return "how can i help you?"
def play(args):
return "let me play a song for you"
def command_handler(command, args):
if command == "info":
return info(args)
if command == "play":
return play(args)
command = "play"
args = {}
assert command_handler(command, args) == "let me play a song for you"
Links
- For more information Read the docs.
Installation
You can install the latest version of registerer from PyPI:
pip install registerer
Features
- It's completely type-safe, thus you will get suggestions from your IDE.
- Writing custom validations for registered items is provided without any inheritance.
- generate choices for Django from registered items.
- And so on...
Metadata
Release files for registerer 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| registerer-1.0.0.tar.gz | 5.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| registerer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / registerer-1.0.0.tar.gz
| Download URL | registerer-1.0.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c810852e108a32412a05dbde26f6db183047bab41ee471cd3f121a669f75c500
|
|
BLAKE2b-256 checksum How to use checksums |
59fe6b060afdb5af97be33e72b5ddbb84d7fa43302f0645ae89501d7cee5a985
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2025.
Transparency logRelease files / registerer-1.0.0-py3-none-any.whl
| Download URL | registerer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53d93ea5c8753ad9806bd1fc846a5eb3bc33131bce5823cf6ea6a80e0d09abf4
|
|
BLAKE2b-256 checksum How to use checksums |
51d0e124647adb09dd69294bb43d46b8fc449271b52216792ecdfebd3870bbd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2025.
Transparency logSecurity for registerer 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for registerer-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.