Skip to main content

Everything you need to implement maintainable and easy to use registry patterns in your project.

Project description

Registerer

pypi ci codecov license

Implement maintainable and easy to use registry patterns in your project.

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

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...

Project details


Download files

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

Source Distribution

registerer-0.7.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

registerer-0.7.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file registerer-0.7.0.tar.gz.

File metadata

  • Download URL: registerer-0.7.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/6.1.8-arch1-1

File hashes

Hashes for registerer-0.7.0.tar.gz
Algorithm Hash digest
SHA256 b446f08875a8e3a760b1740ea18af0400fdd2a98fae51782f2754764bad65a59
MD5 43c090401f23c429797c76be7df81276
BLAKE2b-256 12e1b7cea17838c63bf58b55acd2c998ffbd2e8121ce68589511d33c4b1fab12

See more details on using hashes here.

File details

Details for the file registerer-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: registerer-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/6.1.8-arch1-1

File hashes

Hashes for registerer-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0da561c008f8d4ae8242c392c6df3585dd5e3be49408b0c3837d2553dc20f631
MD5 4810b9549ddfdef09a5c751df6c82b51
BLAKE2b-256 c4cfc9d102db1a9443c69a55ac58f00bc6ea18ea67b6795ffc9f66853bbb575b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page