documented
Templated docstrings for Python classes.
Features
- Describe your business logic in docstrings of your classes and exceptions;
- When printing an object or an exception, the library will substitute the placeholders in the docstring text with runtime values,
- And you (or your user) will see a human-readable text.
Installation
pip install documented
Example
from dataclasses import dataclass
from documented import DocumentedError
@dataclass
class InsufficientWizardryLevel(DocumentedError):
"""
🧙 Your level of wizardry is insufficient ☹
Spell: {self.spell}
Minimum level required: {self.required_level}
Actual level: {self.actual_level} {self.comment}
Unseen University will be happy to assist in your training! 🎓
"""
spell: str
required_level: int
actual_level: int
@property
def comment(self) -> str:
if self.actual_level <= 0:
return '(You are Rincewind, right? Hi!)'
else:
return ''
raise InsufficientWizardryLevel(
spell='Animal transformation',
required_level=8,
actual_level=0,
)
which prints:
---------------------------------------------------------------------
InsufficientWizardryLevel Traceback (most recent call last)
<ipython-input-1-d8ccdb953cf6> in <module>
27
28
---> 29 raise InsufficientWizardryLevel(
30 spell='Animal transformation',
31 required_level=8,
InsufficientWizardryLevel:
🧙 Your level of wizardry is insufficient ☹
Spell: Animal transformation
Minimum level required: 8
Actual level: 0 (You are Rincewind, right? Hi!)
Unseen University will be happy to assist in your training! 🎓
For more examples, see: https://anatoly-scherbakov.github.io/documented/
This project was generated with wemake-python-package.
Metadata
Release files for documented 0.1.4
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 |
|---|---|---|---|---|
| documented-0.1.4.tar.gz | 3.9 kB | Without provenance | Details for documented-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| documented-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for documented-0.1.4-py3-none-any.whl |
Total release size: 9.0 kB
Release files / documented-0.1.4.tar.gz
| Download URL | documented-0.1.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f02ff67419b5d2403e6fad6c992fb5d3392673a2825ebb7d93a97f825102d4f2
|
|
BLAKE2b-256 checksum How to use checksums |
bef1ee7c58862854fb5778aee40c15a0926415eaa9ed03d8a33bae5728f8e685
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.0 Linux/6.2.0-33-generic
|
Release files / documented-0.1.4-py3-none-any.whl
| Download URL | documented-0.1.4-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de3fd47c1f11f01c3237a8857d6dc730809c32b252d5b53e16bccdf6b6bb0894
|
|
BLAKE2b-256 checksum How to use checksums |
5e0de61fc5e2e6423fdb68d6bae00e3f7c6d61fb1be1737f987d38473aab227e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.0 Linux/6.2.0-33-generic
|
Security for documented 0.1.4
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.