Initable is a Python package that helps create DRY-er classes.
Installation
Initable is available through pip.
pip install initable
Usage
Define an instance method you would like to be able to initialize the class with as well.
from initable import initializable
class Foo(object):
@initializable
def bar(self, arg):
self.baz = do_something(arg)
You can now call that method on the class and receive an initialized instance upon completion:
foo = Foo.bar(arg)
Or call the method on an existing instance:
foo = Foo()
# do stuff...
foo.bar(arg) # `bar()` is called on instance `foo`
Testing
To run tests, execute the following from the root of the project:
poetry run pytest tests/
Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Code of Conduct
By participating in this project, you agree to abide by the terms of the Code of Conduct.
License
Initable is licensed under the Hippocratic License.
Release files for initable 0.2.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 | |
|---|---|---|---|
| initable-0.2.1.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| initable-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:28.8 kB
Release files / initable-0.2.1.tar.gz
| Download URL | initable-0.2.1.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b48fcddcfb97907607265b3ee14829210e509f513ecf28376597e6555e3e599
|
|
BLAKE2b-256 checksum How to use checksums |
52749a1e146a876618c2cf4be581500fc7a9e93600fc85df77e856c929b36beb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.2 CPython/3.7.6 Darwin/18.7.0
|
Release files / initable-0.2.1-py3-none-any.whl
| Download URL | initable-0.2.1-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ba07bfb56bec6b3cce62d951e92b75672fc8691ac4b5c132618a8c5eb4a80f6
|
|
BLAKE2b-256 checksum How to use checksums |
0f24e2cba94d958204bd1abb051d67b8c90df56887e51c09b5cc108739d6ecd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.2 CPython/3.7.6 Darwin/18.7.0
|