A lightweight library to attach and extract metadata from Python classes and functions.
Project description
datadesclib 📊
A lightweight Python library to attach metadata to classes and functions using decorators and extract them into structured JSON/dictionary formats.
Installation
pip install datadesclib
Quick Start
1. Annotate your code
Use the @meta decorator to attach any custom information to your classes or functions.
from datadesclib import meta
@meta(author="Lukas", version="1.0", tags=["internal", "database"])
class UserData:
name: str
age: int = 25
@meta(description="Saves the user to the DB")
def save(self):
pass
2. Extract Metadata
You can extract information from a single object or parse an entire Python file.
Extract from object:
from datadesclib import extract
info = extract(UserData)
print(info)
Parse a whole file to JSON:
from datadesclib import parser
json_data = parser("my_script.py")
print(json_data)
Features
Zero Dependencies: Uses only Python standard library (inspect, json, etc.).
Type Hint Support: Automatically detects type annotations.
Docstring Fallback: Uses docstrings as descriptions if no explicit metadata is provided.
Flexible: Works with classes, methods, and global functions.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datadesclib-0.1.0.tar.gz.
File metadata
- Download URL: datadesclib-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11a5ef9516ac6939fb6f6e37b4b2758970aa919b0584874a46c03fe8a61157a7
|
|
| MD5 |
b85b8e3c85c30e69aaae149f9d9389eb
|
|
| BLAKE2b-256 |
c1fdd554482eed7d02f3cc2f5876cadd2eadabac490d11afd535fc3c2e3c2aa3
|
File details
Details for the file datadesclib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: datadesclib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62d377ba04cc5b3b4850c54e95acf6e558a01086958f498cabcdc7d7aa403109
|
|
| MD5 |
6d974e720bdf9d1036c4919d3a7bfd36
|
|
| BLAKE2b-256 |
b163531c29b6d8321e1f359dd4066cc050c29eab39addb92536c7c973851c554
|