# parameterizable
Parameter manipulation for Python classes.
## What Is It?
`parameterizable` provides functionality for work with parameterizable
classes: those that have (hyper) parameters which define object's configuration,
that is different from the object's internal contents or data. Such parameters
are typically passed to the `.__init__()` method when an object is created.
`parameterizable` allows to:
* Get parameters of an object as a dictionary.
* Get default parameters of a class as a dictionary.
* Serialize object's parameters to a 'portable' dictionary, that only
contains basic (builtin) types and portable sub-dictionaries.
* Recreate an object from its parameters, stored in a 'portable' dictionary.
## Usage
Inherit from `ParameterizableClass` class and define method `.get_params()`.
## Key Classes, Functions, and Constants
* `ParameterizableClass` - a base class for parameterizable objects.
You should derive your class from it if you want to
use the functionality of this package.
* `ParameterizableClass.get_params()` - a method to be defined in a subclass,
returns the current parameters of an object as a dictionary.
* `ParameterizableClass.get_default_params()` - returns the default parameters
of the class as a dictionary.
* `ParameterizableClass.__get_portable_params__()` - returns a 'portable'
dictionary of the object's parameters.
* `ParameterizableClass.__get_portable_default_params__()` - returns
a 'portable' dictionary of the class's default parameters.
* `is_parameterizable(obj)` - checks if an object or a class is parameterizable.
* `register_parameterizable_class(cls)` - registers a class as parameterizable.
This is required for `get_object_from_portable_dict()` to work
with objects of the class.
* `get_object_from_portable_dict()` - recreates an object from
a 'portable' dictionary. Only works for classes that were previously
registered with `register_parameterizable_class()`.
## How To Get It?
The source code is hosted on GitHub at:
[https://github.com/pythagoras-dev/parameterizable](https://github.com/pythagoras-dev/parameterizable)
Binary installers for the latest released version are available at the Python package index at:
[https://pypi.org/project/parameterizable](https://pypi.org/project/parameterizable)
pip install parameterizable
## Dependencies
* [pytest](https://pytest.org)
## Key Contacts
* [Vlad (Volodymyr) Pavlov](https://www.linkedin.com/in/vlpavlov/)
Raw data
{
"_id": null,
"home_page": "https://github.com/pythagoras-dev/parameterizable",
"name": "parameterizable",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "parameters",
"author": "Vlad (Volodymyr) Pavlov",
"author_email": "vlpavlov@ieee.org",
"download_url": "https://files.pythonhosted.org/packages/a5/d3/b65f58de10d9dffb1b2e2e600bc18a08c019b402b39cc662f1c1496c2dde/parameterizable-0.2.1.tar.gz",
"platform": null,
"description": "# parameterizable\n\nParameter manipulation for Python classes.\n\n## What Is It?\n\n`parameterizable` provides functionality for work with parameterizable \nclasses: those that have (hyper) parameters which define object's configuration,\nthat is different from the object's internal contents or data. Such parameters \nare typically passed to the `.__init__()` method when an object is created.\n\n`parameterizable` allows to:\n* Get parameters of an object as a dictionary.\n* Get default parameters of a class as a dictionary.\n* Serialize object's parameters to a 'portable' dictionary, that only \ncontains basic (builtin) types and portable sub-dictionaries. \n* Recreate an object from its parameters, stored in a 'portable' dictionary.\n\n## Usage\nInherit from `ParameterizableClass` class and define method `.get_params()`. \n\n## Key Classes, Functions, and Constants\n\n* `ParameterizableClass` - a base class for parameterizable objects. \nYou should derive your class from it if you want to \nuse the functionality of this package.\n* `ParameterizableClass.get_params()` - a method to be defined in a subclass,\nreturns the current parameters of an object as a dictionary.\n* `ParameterizableClass.get_default_params()` - returns the default parameters\nof the class as a dictionary.\n* `ParameterizableClass.__get_portable_params__()` - returns a 'portable'\ndictionary of the object's parameters.\n* `ParameterizableClass.__get_portable_default_params__()` - returns \na 'portable' dictionary of the class's default parameters.\n* `is_parameterizable(obj)` - checks if an object or a class is parameterizable.\n* `register_parameterizable_class(cls)` - registers a class as parameterizable.\nThis is required for `get_object_from_portable_dict()` to work \nwith objects of the class.\n* `get_object_from_portable_dict()` - recreates an object from\na 'portable' dictionary. Only works for classes that were previously \nregistered with `register_parameterizable_class()`.\n\n## How To Get It?\n\nThe source code is hosted on GitHub at:\n[https://github.com/pythagoras-dev/parameterizable](https://github.com/pythagoras-dev/parameterizable) \n\nBinary installers for the latest released version are available at the Python package index at:\n[https://pypi.org/project/parameterizable](https://pypi.org/project/parameterizable)\n\n pip install parameterizable\n\n## Dependencies\n\n* [pytest](https://pytest.org)\n\n## Key Contacts\n\n* [Vlad (Volodymyr) Pavlov](https://www.linkedin.com/in/vlpavlov/)\n",
"bugtrack_url": null,
"license": null,
"summary": "Library for work with parameterizable classes.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/pythagoras-dev/parameterizable"
},
"split_keywords": [
"parameters"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a5d3b65f58de10d9dffb1b2e2e600bc18a08c019b402b39cc662f1c1496c2dde",
"md5": "d93407a94da63d0a63e92eed502ac3ad",
"sha256": "7c52016f85c4b1da9eaa9648357662ea19cab535f831e62750ecad0102dec0a2"
},
"downloads": -1,
"filename": "parameterizable-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "d93407a94da63d0a63e92eed502ac3ad",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4196,
"upload_time": "2024-12-07T21:03:38",
"upload_time_iso_8601": "2024-12-07T21:03:38.063043Z",
"url": "https://files.pythonhosted.org/packages/a5/d3/b65f58de10d9dffb1b2e2e600bc18a08c019b402b39cc662f1c1496c2dde/parameterizable-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-07 21:03:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pythagoras-dev",
"github_project": "parameterizable",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "parameterizable"
}