Skip to main content

literate-dataclasses

This is a work-in-progress library to add documentation functionality to dataclasses introduced in Python 3.7. The library can be used as a drop-in replacement for the standard dataclasses and can be installed from PyPI.

$ pip install literate_dataclasses

Literate dataclasses modify their own class docstrings and add attribute docs in [Google code style](https://google.github.io/styleguide/pyguide.html) with the goal of removing redundant code. The docs can be written as follows:

from literate_dataclasses import dataclass, field

@dataclass(test_arg = "hello")
class Test:
    """My dataclass

    Some comment.

    Args:
        See dataclass signature.
    """

    x: int = field(default = 42, doc = \
    """Some value x."""
    )

    y: int = field(default = 72, doc = \
    """Some value x."""
    )

    name: int = field(default = 'foo', doc = \
    """The object name.""",
    )

test = Test(x = 5, y = 3)
help(Test)

which will generate the output

Help on class Test in module __main__:

class Test(builtins.object)
|  Test(x: int = 42, y: int = 72, name: int = 'foo') -> None
|
|  My dataclass
|
|  Some comment.
|
|  Args:
|      x: Some value x.
|      y: Some value x.
|      name: The object name.

Metadata

Release files for literate-dataclasses 0.0.6

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

Source distribution (sdist)

Source distribution for literate-dataclasses 0.0.6
File Size Uploaded Provenance Actions
literate_dataclasses-0.0.6.tar.gz 4.6 kB Without provenance Details for literate_dataclasses-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for literate-dataclasses 0.0.6
File Interpreter ABI Platform Actions
literate_dataclasses-0.0.6-py3-none-any.whl Python 3 none any Details for literate_dataclasses-0.0.6-py3-none-any.whl

Total release size: 9.5 kB

Release files / literate_dataclasses-0.0.6.tar.gz

Download URL literate_dataclasses-0.0.6.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bac03b318aa19504dc69b7ce3b1a03c17304b8f2a9156337ec8ac2c02a78072d
BLAKE2b-256 checksum
How to use checksums
556e4dec6ba9484821799bab1b529e37cdae6d05dd2caf8ab61746a5e4bca4fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / literate_dataclasses-0.0.6-py3-none-any.whl

Download URL literate_dataclasses-0.0.6-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8617f7e8e838b224053bdde86005bd48fa83de71733aa61accb78fd215744b3
BLAKE2b-256 checksum
How to use checksums
9c9af8294a4f52408b228f8fdb447b2e842f40b3ab37780b48d6a5d12afcabae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for literate-dataclasses 0.0.6

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.

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