Skip to main content

decorated_registry

Implementation of generalised registries for Python.

Allows you to seamlessly create registries of tests, modules, DSLs and RPCs.

Supports arguments and fully typed.

Example

from typing import List, Type
from dataclasses import dataclass
from decorated_registry import Registry, ConstructorPayloadFactory

# framework/abstract.py

@dataclass
class ModuleConfig:
    init_priority: int = -1


class Module:
    pass

# framework/registry.py

application_module: Registry[ModuleConfig, Type[Module]] = Registry(
    payload_factory=ConstructorPayloadFactory(dict)
)

# authentication_mod/impl.py

@application_module
class AuthenticationModule(Module):
    pass


# database_mod/impl.pu

@application_module(init_priority=2)
class DatabaseSessionModule(Module):
    pass

# framework/app.py

def load_modules() -> List[Module]:
    rtn = []
    # ensure modules are loaded in the order given by `ModuleConfig.priority`
    modules_priority = sorted(application_module.items, key=lambda x: x.payload.init_priority)
    for x in modules_priority:
        module_cls: Type[Module] = x.value
        module = module_cls()
        rtn.append(module)
    return rtn


# framework/main.py

def main():
    modules = load_modules()


if __name__ == '__main__':
    main()

Metadata

Release files for decorated-registry 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for decorated-registry 0.0.2
File Size Uploaded Provenance Actions
decorated_registry-0.0.2.tar.gz 3.7 kB Without provenance Details for decorated_registry-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for decorated-registry 0.0.2
File Interpreter ABI Platform Actions
decorated_registry-0.0.2-py3-none-any.whl Python 3 none any Details for decorated_registry-0.0.2-py3-none-any.whl

Total release size: 7.6 kB

Release files / decorated_registry-0.0.2.tar.gz

Download URL decorated_registry-0.0.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e239e849626bcc8ddb9324bcc2478d2b73f0469b14a013b02d558ab650f39660
BLAKE2b-256 checksum
How to use checksums
db98c821f02070e43dff92eb2a9d4e5814a70622ba0f56d192cead01b793625e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / decorated_registry-0.0.2-py3-none-any.whl

Download URL decorated_registry-0.0.2-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbe0414ada9f273b77943bf05507d9bffaf575cf1909c1f3dd9d6c9f1b86d21d
BLAKE2b-256 checksum
How to use checksums
a827d391903026e40576cae23b31843f0f7fa915eb8da270b18b3f746064d046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Security for decorated-registry 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page