Registry / serialization / classproperties

classproperties

JSON →
library0.2.0pypypi✓ verified 89d ago

A lightweight Python library providing property decorators for classmethods and staticmethods. Version 0.2.0 is the latest release. The project is minimally maintained.

pip install classproperties
INSTALL
IMPORT
SIG · CLASSPROPERTIES
C
classproperties
serializationpythonv0.2.0
Install
2.4s avg
Import
—
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

classproperty
✓ from classproperties import classproperty
No common incorrect import path.

Basic usage of classproperty decorator.

from classproperties import classproperty class MyClass: @classproperty def my_prop(cls): return 'classprop_val' print(MyClass.my_prop)
Debug
Known issues
gotchaThe decorator must be used inside a class definition and the method must accept 'cls' as its first argument. Defining it outside a class will raise an error.
fix
Ensure the decorated function is a classmethod-like method with 'cls' parameter inside a class.
affects: all
gotchaInheritance may not work as expected if subclasses override the property without using the decorator. The parent class property will be used if overridden as a regular attribute.
fix
Always apply @classproperty explicitly in subclasses that need a different value.
affects: all
Errors
Common errors & fixes
TypeError: @classproperty can only be used on methods with 'cls' as first argument
The decorated method does not accept 'cls' as its first parameter, or the decorator is applied to a non-method.
fix
Make sure the method signature is like: def method(cls): and that @classproperty is applied inside a class body.
AttributeError: 'function' object has no attribute '__get__'
Using an incompatible Python version or applying the decorator incorrectly (e.g., on a non-function). The library may not support Python 2.
fix
Ensure Python 3. Use only on methods defined inside a class.
Upgrade
Version history
0.2.0latest on PyPI · released Jan 24, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
classproperties — pip install classproperties · libregistry