Initable is a Python package that helps create DRY-er classes.
Project description
Initable
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
Run 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.
License
Initable is licensed under the GNU Public License v3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file initable-0.1.2.tar.gz
.
File metadata
- Download URL: initable-0.1.2.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4 Darwin/18.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4153c40d13e9e97aa441a6114d1c4ed5fabda7a361761e1468f58e34fb07b2 |
|
MD5 | 43590866b383e1f6fd665989a8877606 |
|
BLAKE2b-256 | 7322688ad73f5b83820e1fa34306e580b4aab2e88c4ec76c1ef98bf648838020 |
File details
Details for the file initable-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: initable-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4 Darwin/18.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ac9f0f9b29a19840ae31d892cdcc478687fbf040f451868568b0ef1ae01b2ad |
|
MD5 | 2eb325de82c1e23b190dee9fa8e4c460 |
|
BLAKE2b-256 | 4b321b5842e0cce22c0201c9d1cc162da6af0e89d2a7e0caf4a7961e5588a41b |