Propy
About
This package contains convenience functions for creating class properties with type conversion and validation characteristics in Python. While Python's lack of typecasting is certainly one of the features that make it an easy to learn and code language, there are certainly times when you might want to implement controls on the types of values a class property can assume. This package provides a few functions to hopefully handle those situations a little easier.
To provide an example, let's assume you have a property that you want to restrict
to boolean values. To do this normally, you would need to setup a property
manually by creating custom setter, getter, and deleter functions. With this
package, however, you can use the provided bool_property function instead
as follows:
import propy
class Example():
bool_prop = propy.bool_property('bool_prop')
The bool_property function creates the setter, getter, and deleter that you
would have needed to manually define. The 'bool_prop' name supplied to the
function is used to create a "private" _bool_prop attribute behind the scenes,
then the "public" bool_prop attribute simply calls the defined setter, getter,
and deleter to perform the respective action on that private attribute.
It's not a huge gain, but it reduces to a single line of code what may
have taken about 10 lines.
Installation
This package may be installed via pip:
pip install propy
Metadata
Release files for propy 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 | |
|---|---|---|---|
| propy-1.0.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| propy-1.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / propy-1.0.0.tar.gz
| Download URL | propy-1.0.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4397ac9c4e3f357033b54654e6ef1916c196f18b438f49d77278b9199b67c13
|
|
BLAKE2b-256 checksum How to use checksums |
49cebd9108cdb154884a9eab6c59b4ecc1146f2f6a57df39cd7a66f413892075
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|
Release files / propy-1.0.0-py2.py3-none-any.whl
| Download URL | propy-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a15f8c55705c2d40e75a2c65903f44a68b90328b2222f4289c66fe3e67d3e42b
|
|
BLAKE2b-256 checksum How to use checksums |
8f4f51031fabc8783c57f863048f5ab1dcea21826478497d7c49896da6f1723c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
|