@classprop
Small python package that provides a @classproperty decorator for python classes
that works just like @property except for class variables!
$ pip install classprop
Use 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"
Development
For detailed instructions see CONTRIBUTING.
Tests
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 checks
Linting and formatting
Lint and format the code with
$ invoke format
$ invoke lint
All of this happens when you run invoke pre-commit.
Note
This project is still in the alpha stage and should not be considered production ready.
Metadata
Release files for classprop 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| classprop-0.1.1.tar.gz | 5.6 kB | Without provenance | Details for classprop-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| classprop-0.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for classprop-0.1.1-py2.py3-none-any.whl |
Total release size: 10.2 kB
Release files / classprop-0.1.1.tar.gz
| Download URL | classprop-0.1.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
545489c94e7c4b2ac77659d0645a3d855d9091992cf96eb09279b9c0a54515c0
|
|
BLAKE2b-256 checksum How to use checksums |
a7f691f55bfc81d44de7e7b6f2f326ced96a3011fb1111ce9e7e979515383d69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Release files / classprop-0.1.1-py2.py3-none-any.whl
| Download URL | classprop-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2de65ca452044ae86e84f640eac10feaab21720d1932fc3cbab770f85e0bf480
|
|
BLAKE2b-256 checksum How to use checksums |
fed5c936d2528469fa2ddd5268e5ce8bbe97556d9f95acd7e0430a88e044f864
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Security for classprop 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.