Small python package that provides a @classproperty decorator for python classes that works just like @property except for class variables!
$ pip install classpropUse it just like builtin @property's:
from classprop import classprop class TestClass: _internal = "Hello, World" @classprop def my_class_prop(self) -> str: return self._internal @my_class_prop.setter def my_class_prop(self, value: str) -> None: self._internal = value foo = TestClass() assert foo.my_class_prop == "Hello, World" baz = TestClass() assert baz.my_class_prop == "Hello, World" baz.my_class_prop = "Changed" assert foo.my_class_prop == "Changed"For detailed instructions see CONTRIBUTING.
You can run tests with
$ invoke test $ invoke test --min-coverage=90 # Fail when code coverage is below 90% $ invoke type-check # Run mypy type checksLint and format the code with
$ invoke format $ invoke lintAll of this happens when you run invoke pre-commit.
This project is still in the alpha stage and should not be considered production ready.