Attributee
Attributee is a Python 3 library for declarative object initialization. Input arguments are defined as class attributes and are automatically processed when creating an object. It is in a way similar to Django ORM or some other ORMs, but the main purpose of this library is to simplify parsing input arguments to object constructors.
The library is a work-in-progress, I am adding stuff that I consider useful for my other projects.
Simple use case
from attributee import Attributee, String, Float
class Model(Attributee):
# Simply list the attributes of the object ...
name = String(default="noname")
value1 = Float()
value2 = Float(default=0, val_min=-10, val_max=10)
# ... no constructor needed
# default arguments assigned
model1 = Model(value1=10)
# automatic type conversion where possible
model2 = Model(value1=10, value2="5")
Documentation
I am working on it.
Authors
Luka Čehovin Zajc
License
The library is available under the simplified BSD license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
attributee-0.1.9.tar.gz
(11.9 kB
view details)
File details
Details for the file attributee-0.1.9.tar.gz.
File metadata
- Download URL: attributee-0.1.9.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/5.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbcf645821f1f88174cf72aa11ca2d6a8b615e2557b7f3539a4bc4f97ba5a113
|
|
| MD5 |
5b16deb9ad9ea81075b1760df1e54d6a
|
|
| BLAKE2b-256 |
03ef5474c00800d0b52149907702b78a49627618d74f5da81c8708288378a200
|