Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for initable, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size initable-0.1.2-py3-none-any.whl (23.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size initable-0.1.2.tar.gz (23.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page