Skip to main content

Classes to provide name-to-object registry-like support

Project description

Catalogus

A Python library providing classes for name-to-object registry-like support.

Overview

Catalogus provides a simple and extensible registry system that allows you to:

  • Register objects by name
  • Retrieve objects by name
  • Support lazy loading of objects
  • Maintain type safety with generic support

This library was extracted from the Breezy version control system to provide a reusable registry implementation.

Installation

pip install catalogus

Quick Start

from catalogus import Registry

# Create a registry
my_registry = Registry()

# Register objects directly
my_registry.register('item1', some_object)

# Register with lazy loading
my_registry.register_lazy('item2', 'my.module', 'MyClass')

# Retrieve objects
obj = my_registry.get('item1')

Features

  • Type-safe: Full generic type support with TypeVar
  • Lazy loading: Objects can be loaded on-demand from modules
  • Flexible registration: Support for direct objects and lazy imports
  • Iterator support: Iterate over registered items
  • Python 3.9+: Modern Python support

Development

Install development dependencies:

pip install -e .[dev]

Run tests:

pytest

Format code:

ruff format

Check code style:

ruff check
mypy catalogus

License

This project is licensed under the GNU General Public License v2 or later (GPLv2+).

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

catalogus-0.1.0.tar.gz (19.9 kB view details)

Uploaded Source

File details

Details for the file catalogus-0.1.0.tar.gz.

File metadata

  • Download URL: catalogus-0.1.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for catalogus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bea432f5611e29b5e1988ac9242cfb679c2ca0cb5f8591915eabc39d49c629c3
MD5 2493380bc899751e80f015401dc6f91a
BLAKE2b-256 a83e8c9e87e4fc3c6c987a7f663730994fca8bfd8b61b821e401507384ee41f0

See more details on using hashes here.

Supported by

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