reacttrs
Reactive attributes, initially extracted out from Textual, now a fork of Declare.
from reacttrs import Int, Str
class Foo:
name = Str("Paul")
age = Int(34)
birth = Int(1990)
@name.watch
def _watch_name(self, old: str, new: str):
print(f"{old=}, {new=}")
@age.validate
def _validate_age(self, value: int) -> int:
return 2024 - self.birth
foo = Foo()
foo.name = "John" # old='Paul', new='John'
foo.name = "Steve" # old='John', new='Steve'
print(foo.age) # 34
foo.birth = 1991
foo.age = 34
print(foo.age) # 33
Release files for reacttrs 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reacttrs-0.2.1.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reacttrs-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:7.9 kB
Release files / reacttrs-0.2.1.tar.gz
| Download URL | reacttrs-0.2.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a2cbf7a209deb0be056cc30e7c7c5f1ff5a744cba18c427d5418cc32bb1e53c
|
|
BLAKE2b-256 checksum How to use checksums |
909033daccaa6587d18e60ccc48a70d3c36e9e2b48db2606f7829b6c687b31fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / reacttrs-0.2.1-py3-none-any.whl
| Download URL | reacttrs-0.2.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1425357d8d7b0d8bc89fc1dce2544410296b605429571e11b682492a3060caed
|
|
BLAKE2b-256 checksum How to use checksums |
450b888bee634da04d8fd8a7d177d48bca3888388145b8445810550e77de8b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|