Skip to main content

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

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.

Project details


Download files

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

Source Distribution

initable-0.2.1.tar.gz (14.5 kB view hashes)

Uploaded Source

Built Distribution

initable-0.2.1-py3-none-any.whl (14.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page