Dataclass to be CLI and logger compatible
This package does only two things:
- it takes a dataclass and converts it to a command line str.
- it takes a dataclass and converts it to a loggable dict for 3rd party logging like MLFlow.
Contrary to
asdictit also converts nested dataclasses by separting their attributes by prefix.
By inheriting from the class ReverseCli you can use the to_command_string method to get the command line str and the property loggable_dict to get the loggable dict.
Example
@dataclass(kw_only=True)
class Parameters(ReverseCli):
a: int
b: str
c: bool
d: list[int]
@dataclass(kw_only=True)
class Nested(ReverseCli):
a: int
b: Parameters
parameters = Nested(a=1, b=Parameters(a=1, b="2", c=True, d=[3, 4]))
print(parameters.to_command_string())
# --a 1 --b.a 1 --b.b 2 --b.c --b.d 3 --b.d 4
print(parameters.loggable_dict)
# {'a': 1, 'b.a': 1, 'b.b': '2', 'b.c': True, 'b.d': [3, 4]}
Installation
We use UV for installation and RUFF for formating and linting.
Metadata
Release files for dataclasses-reverse-cli 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dataclasses_reverse_cli-0.0.7.tar.gz | 25.8 kB | Without provenance | Details for dataclasses_reverse_cli-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dataclasses_reverse_cli-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for dataclasses_reverse_cli-0.0.7-py3-none-any.whl |
Total release size: 40.8 kB
Release files / dataclasses_reverse_cli-0.0.7.tar.gz
| Download URL | dataclasses_reverse_cli-0.0.7.tar.gz |
|---|---|
| Size | 25.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a56b68a6286814c6e2ed0e0224b73bca98de86d7536bc9ea9339f607c1ba6cdc
|
|
BLAKE2b-256 checksum How to use checksums |
64f0e5fe4394b5b0470f575d1d3a393c464f4f1899426ab16df0b18d96888783
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","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 / dataclasses_reverse_cli-0.0.7-py3-none-any.whl
| Download URL | dataclasses_reverse_cli-0.0.7-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea6ab7341172f5071225e71245f200a38ea4dd5ae2cff6efccb70696a6b7733b
|
|
BLAKE2b-256 checksum How to use checksums |
56a4872d435a34d458c7afd0898801c9de9cea4aa5e3f7c10ade21ef2b1726ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","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}
|
Security for dataclasses-reverse-cli 0.0.7
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.