python-attribute-access-modifiers
Tired of typing @property just to make a read-only instance variable? Find yourself wishing for C#'s {get; set;} syntax? Look no further than PAAM, which auto-generates property getters, setter, and deleters for you!
Quickstart
Once installed, just use the overloaded | operator between an instance variable and one of the predefined constants GET, SET, or DEL. Make sure to subclass from PaamBase.
from paam import SET, PaamBase
class Test(PaamBase):
def __init__(self, a: int):
self.a = a | GET # write to self.a (not self._a) because PAAM creates setters/getters/deleters *after* __init__ finishes
>>> obj = Test(15)
>>> obj.a
>>> 15
>>> obj.a = 5 # raises AttributeError: can't set attribute
Property access modifiers can also be chained (order doesn't matter):
from paam import SET, GET, DEL, PaamBase
class Test(PaamBase):
def __init__(self, a: int):
self.a = a | GET | SET
>>> obj = Test(15)
>>> obj.a
>>> 15
>>> obj.a = 5
>>> obj.a
>>> 5
>>> del obj.a # raises AttributeError: can't delete attribute
Caveats (all planned to be fixed in future release)
- The type of any variable "annotated" with
GET,SET, orDELis_PropertyAccessModifierBase. This meansmypysupport and IDE type hinting are most likely broken. - No tests
Metadata
Release files for python-attribute-access-modifiers 1.0.0
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 |
|---|---|---|---|---|
| python-attribute-access-modifiers-1.0.0.tar.gz | 3.6 kB | Without provenance | Details for python-attribute-access-modifiers-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_attribute_access_modifiers-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for python_attribute_access_modifiers-1.0.0-py3-none-any.whl |
Total release size: 7.5 kB
Release files / python-attribute-access-modifiers-1.0.0.tar.gz
| Download URL | python-attribute-access-modifiers-1.0.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aae95b92a35ac1761941c5c0cab387b3639e9056b0b03ef2fcb19436e536ac84
|
|
BLAKE2b-256 checksum How to use checksums |
9ce6b6e603965cd08e898e4dd1966645ba1a388c253ea43ab8e36dd9e1a43775
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2
|
Release files / python_attribute_access_modifiers-1.0.0-py3-none-any.whl
| Download URL | python_attribute_access_modifiers-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6966dd3288241fb9d4640cb9c0e8808154cc4e11d9666e20a8caf56db95cf0e
|
|
BLAKE2b-256 checksum How to use checksums |
ee115eb595530bac552b68b53326f24161d45d08d435fa7a5247fcfc4a2937af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2
|
Security for python-attribute-access-modifiers 1.0.0
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.