Skip to main content

roster

Python object registers. Keep track of your classes, functions and data.

Installation

roster can be installed from PyPI

pip install roster

Usage:

Record

Default Record

from roster import Record

numbers: Record[int] = Record()

numbers(1)
numbers(2)
numbers(3)
>>> numbers
[1, 2, 3]

Generate each item

from roster import Record

characters: Record[str] = Record()

@characters.item
def character(char: str, /) -> str:
    return char.upper()

character('a')
character('b')
character('c')
>>> characters
['A', 'B', 'C']

Register

Default Register

from roster import Register

services: Register[str, type] = Register()

@services('youtube')
class YouTube: pass

@services('spotify')
class Spotify: pass
>>> services
{'youtube': <class '__main__.YouTube'>, 'spotify': <class '__main__.Spotify'>}

Generate each key

from roster import Register
from typing import Callable

functions: Register[str, Callable] = Register()

@functions.key
def function(name: str, /) -> str:
    return name.upper()

@function('foo')
def foo(): pass

@function('bar')
def bar(): pass
>>> functions
{'FOO': <function foo at 0x7f9c4f065790>, 'BAR': <function bar at 0x7f9c4f065820>}

Generate each value

from roster import Register
from typing import Callable

functions: Register[str, Callable] = Register()

@functions.value
def function(name: str, /) -> str:
    return name.upper()

@function('foo')
def foo(): pass

@function('bar')
def bar(): pass
>>> functions
{<function foo at 0x7f26443aa790>: 'FOO', <function bar at 0x7f26443aa820>: 'BAR'}

Generate each entry

from roster import Register
from typing import Tuple

identifiers: Register[str, str] = Register()

@identifiers.entry
def identifier(code: str, /) -> Tuple[str, str]:
    return (code[0], code.upper())

identifier('foo')
identifier('bar')
>>> identifiers
{'f': 'FOO', 'b': 'BAR'}

Metadata

Release files for roster 0.1.11

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

Source distribution (sdist)

Source distribution for roster 0.1.11
File Size Uploaded
roster-0.1.11.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for roster 0.1.11
File Interpreter ABI Platform
roster-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / roster-0.1.11.tar.gz

Download URL roster-0.1.11.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
467c44075d554b387c52cddf025419c46af4daa74c6d900a057d6ad6fdec5f4d
BLAKE2b-256 checksum
How to use checksums
6129b60739c2887f15c025f49c8ad3a08c11d573e81c602586105d6e9316d8cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.10 Linux/5.4.0-131-generic

Release files / roster-0.1.11-py3-none-any.whl

Download URL roster-0.1.11-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4703c3ff53b694452ff727e7b9e6e74616dd6c2df3b9de5c5dc9151936a315ba
BLAKE2b-256 checksum
How to use checksums
692adf77b20618387e2a7d3c2f43131a2a899b440969350fda72af29c5aa737c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.10 Linux/5.4.0-131-generic

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.10

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.0.1

3 release files

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