parameterizable


Nameparameterizable JSON
Version 0.10.0 PyPI version JSON
download
home_pageNone
SummaryLibrary for work with parameterizable classes.
upload_time2025-09-12 02:52:12
maintainerNone
docs_urlNone
authorVlad (Volodymyr) Pavlov
requires_python>=3.10
licenseMIT
keywords parameters
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 an object's parameters to a 'portable' dictionary that 
has sorted str keys and contains values with only basic (builtin) types 
and portable sub-dictionaries. 
* Recreate an object from its parameters, stored in a 'portable' dictionary.

## Why Is It Useful?

`parameterizable` is useful for developers working with 
configurable Python objects, especially in scenarios involving 
machine learning, scientific computing, or any domain where 
object's behavior is defined by the object's parameters. It provides:

* **Consistency**: Ensures a standardized way to handle parameters 
across different classes.
* **Serialization**: Simplifies saving and loading object configurations 
using portable dictionaries.
* **Reproducibility**: Facilitates recreating objects with the same configuration, 
which is critical for debugging and sharing experiments.
* **Extensibility**: Allows easy integration with custom classes 
by subclassing `ParameterizableClass`.

By abstracting parameter handling, this library reduces boilerplate code and improves maintainability.

## Usage
Inherit from `ParameterizableClass` class and define method `.get_params()`. 
If the class has default parameters, and its `.__init__()` method 
has side effects, you should also define method `.get_default_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 regular dictionary.
* `ParameterizableClass.get_default_params()` - returns the default parameters
of the class as a regular 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_params()` - recreates an object from
a 'portable' dictionary. Only works for classes that were previously 
registered with `register_parameterizable_class()`.

## Short Example

Visit this Colab notebook for a short demonstration of the package usage:
[https://colab.research.google.com/drive/1myLzvM2g43_bLhEMazb4a4OZx8lsPrzd](https://colab.research.google.com/drive/1myLzvM2g43_bLhEMazb4a4OZx8lsPrzd)

## 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)

Using uv :
```
uv add parameterizable
```

Using pip (legacy alternative to uv):
```
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": null,
    "name": "parameterizable",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "parameters",
    "author": "Vlad (Volodymyr) Pavlov",
    "author_email": "Vlad (Volodymyr) Pavlov <vlpavlov@ieee.org>",
    "download_url": "https://files.pythonhosted.org/packages/89/fb/8f44be6bb18fa38f80fc60f1573030a9000a11a7198bc91b428214f84934/parameterizable-0.10.0.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 an object's parameters to a 'portable' dictionary that \nhas sorted str keys and contains values with only basic (builtin) types \nand portable sub-dictionaries. \n* Recreate an object from its parameters, stored in a 'portable' dictionary.\n\n## Why Is It Useful?\n\n`parameterizable` is useful for developers working with \nconfigurable Python objects, especially in scenarios involving \nmachine learning, scientific computing, or any domain where \nobject's behavior is defined by the object's parameters. It provides:\n\n* **Consistency**: Ensures a standardized way to handle parameters \nacross different classes.\n* **Serialization**: Simplifies saving and loading object configurations \nusing portable dictionaries.\n* **Reproducibility**: Facilitates recreating objects with the same configuration, \nwhich is critical for debugging and sharing experiments.\n* **Extensibility**: Allows easy integration with custom classes \nby subclassing `ParameterizableClass`.\n\nBy abstracting parameter handling, this library reduces boilerplate code and improves maintainability.\n\n## Usage\nInherit from `ParameterizableClass` class and define method `.get_params()`. \nIf the class has default parameters, and its `.__init__()` method \nhas side effects, you should also define method `.get_default_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 regular dictionary.\n* `ParameterizableClass.get_default_params()` - returns the default parameters\nof the class as a regular 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_params()` - recreates an object from\na 'portable' dictionary. Only works for classes that were previously \nregistered with `register_parameterizable_class()`.\n\n## Short Example\n\nVisit this Colab notebook for a short demonstration of the package usage:\n[https://colab.research.google.com/drive/1myLzvM2g43_bLhEMazb4a4OZx8lsPrzd](https://colab.research.google.com/drive/1myLzvM2g43_bLhEMazb4a4OZx8lsPrzd)\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\nUsing uv :\n```\nuv add parameterizable\n```\n\nUsing pip (legacy alternative to uv):\n```\npip install parameterizable\n```\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": "MIT",
    "summary": "Library for work with parameterizable classes.",
    "version": "0.10.0",
    "project_urls": {
        "Homepage": "https://github.com/pythagoras-dev/parameterizable"
    },
    "split_keywords": [
        "parameters"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "522851e49570e387c950dc2a49f75462fccc8605c66b3bba862e3a5cd779d5c7",
                "md5": "754d28e772b205a6ddd97f3351a1839e",
                "sha256": "66d20dda7d758ce83c26d7bdf0e02c0410b66df17a1fadf6dcd1d60f49a775de"
            },
            "downloads": -1,
            "filename": "parameterizable-0.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "754d28e772b205a6ddd97f3351a1839e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 9029,
            "upload_time": "2025-09-12T02:52:10",
            "upload_time_iso_8601": "2025-09-12T02:52:10.780883Z",
            "url": "https://files.pythonhosted.org/packages/52/28/51e49570e387c950dc2a49f75462fccc8605c66b3bba862e3a5cd779d5c7/parameterizable-0.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "89fb8f44be6bb18fa38f80fc60f1573030a9000a11a7198bc91b428214f84934",
                "md5": "2336287fca819d03bd6b2c9a0f5a0461",
                "sha256": "7e846956ae0766afc5ad7182d5f5f341cfa3c482db1424e9f943c71e72543020"
            },
            "downloads": -1,
            "filename": "parameterizable-0.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2336287fca819d03bd6b2c9a0f5a0461",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 7324,
            "upload_time": "2025-09-12T02:52:12",
            "upload_time_iso_8601": "2025-09-12T02:52:12.112899Z",
            "url": "https://files.pythonhosted.org/packages/89/fb/8f44be6bb18fa38f80fc60f1573030a9000a11a7198bc91b428214f84934/parameterizable-0.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-12 02:52:12",
    "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"
}
        
Elapsed time: 1.48231s