Skip to main content

dynrepr

Decorator factory to help create class __repr__ functions.

Example Usage:

# old
class Point:
    def __init__(self, x: int, y: int):
        self.x = x
        self.y = y

print(Point(1, 2))
# <__main__.Point object at 0x848469690>

# new
from dynrepr import dynrepr

@dynrepr
class Point:
    def __init__(self, x: int, y: int):
        self.x = x
        self.y = y

print(Point(1, 2))
# Point(x=1, y=2)

Advanced Usage:

from dynrepr import dynrepr

@dynrepr('x', 'y')
class FilterValuesPoint:
    def __init__(self, x: int, y: int, z: int):
        self.x = x
        self.y = y
        self.z = z

print(FilterValuesPoint(4, 6, 8))
# FilterValuesPoint(x=4, y=6)

@dynrepr(filters=[lambda v: 4 < v < 8])
class FilteredSubclassPoint(FilterValuesPoint): pass

print(FilteredSubclassPoint(4, 6, 8))
# FilteredSubclassPoint(y=6)

Installation

pip install dynrepr

MIT License

Metadata

Release files for dynrepr 1.0.0

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

Source distribution (sdist)

Source distribution for dynrepr 1.0.0
File Size Uploaded
dynrepr-1.0.0.tar.gz 3.3 kB Details

Built distribution (wheel)

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

Total release size: 6.8 kB

Release files / dynrepr-1.0.0.tar.gz

Download URL dynrepr-1.0.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a3056bbd8e68c423aeedd12d8464d9db681e774fd4f3590d76a7c5ab4fa342d
BLAKE2b-256 checksum
How to use checksums
b4ee40c85719216b7fcffd10c579f8f4ba18f888a5f29f67d4a64bd293e5988e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dynrepr-1.0.0-py3-none-any.whl

Download URL dynrepr-1.0.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe7ecdfc81a9d3af221ca5f02efd8de014d6bc1bcca47c2b0fb4ac74a4545697
BLAKE2b-256 checksum
How to use checksums
670898583657a5517b7f5a2d2f8f4d079e5ed84515e0bbd40be029313af18d6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 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