{"id":20924178,"url":"https://github.com/hashberg-io/optmanage","last_synced_at":"2026-02-25T19:34:49.567Z","repository":{"id":217502744,"uuid":"744016222","full_name":"hashberg-io/optmanage","owner":"hashberg-io","description":"Flexible option managers.","archived":false,"fork":false,"pushed_at":"2024-09-23T12:00:52.000Z","size":759,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-27T16:50:50.455Z","etag":null,"topics":["library","utility"],"latest_commit_sha":null,"homepage":"https://optmanage.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hashberg-io.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-01-16T13:19:01.000Z","updated_at":"2025-12-11T06:28:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef4b0c6c-ce5f-4a33-9162-24bde4219787","html_url":"https://github.com/hashberg-io/optmanage","commit_stats":null,"previous_names":["hashberg-io/optmanage"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hashberg-io/optmanage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Foptmanage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Foptmanage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Foptmanage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Foptmanage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hashberg-io","download_url":"https://codeload.github.com/hashberg-io/optmanage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Foptmanage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29836314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T19:08:47.527Z","status":"ssl_error","status_checked_at":"2026-02-25T18:59:04.705Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","utility"],"created_at":"2024-11-18T20:19:54.570Z","updated_at":"2026-02-25T19:34:49.548Z","avatar_url":"https://github.com/hashberg-io.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"optmanage: A library to create flexible option managers.\n========================================================\n\n.. image:: https://img.shields.io/badge/python-3.10+-green.svg\n    :target: https://docs.python.org/3.10/\n    :alt: Python versions\n\n.. image:: https://img.shields.io/pypi/v/optmanage.svg\n    :target: https://pypi.python.org/pypi/optmanage/\n    :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/status/optmanage.svg\n    :target: https://pypi.python.org/pypi/optmanage/\n    :alt: PyPI status\n\n.. image:: http://www.mypy-lang.org/static/mypy_badge.svg\n    :target: https://github.com/python/mypy\n    :alt: Checked with Mypy\n\n.. image:: https://readthedocs.org/projects/optmanage/badge/?version=latest\n    :target: https://optmanage.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://github.com/hashberg-io/optmanage/actions/workflows/python-pytest.yml/badge.svg\n    :target: https://github.com/hashberg-io/optmanage/actions/workflows/python-pytest.yml\n    :alt: Python package status\n\n.. image:: https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square\n    :target: https://github.com/RichardLitt/standard-readme\n    :alt: standard-readme compliant\n\n\nFlexible option managers, supporting options with default values, static type hints, runtime type checking, and custom runtime validation logic.\n\n.. contents::\n\n\nInstall\n-------\n\nYou can install the latest release from `PyPI \u003chttps://pypi.org/project/optmanage/\u003e`_ as follows:\n\n.. code-block:: console\n\n    $ pip install --upgrade optmanage\n\n\nUsage\n-----\n\nCustom option manager classes can be created by subclassing `OptionManager \u003chttps://optmanage.readthedocs.io/en/latest/api/optmanage.manager.html#optionmanager\u003e`_ and using the `Option \u003chttps://optmanage.readthedocs.io/en/latest/api/optmanage.option.html#option\u003e`_ descriptor to set options.\nAn option manager object can then be obtained by instantiating the option manager class:\n\n.. code-block:: python\n\n    from optmanage import Option, OptionManager\n\n    class MyOptions(OptionManager):\n        \"\"\" Options of some library. \"\"\"\n\n        validate = Option(bool, True)\n        \"\"\" Whether to validate arguments to functions and methods. \"\"\"\n\n        eq_atol = Option(float, 1e-8, lambda x: x \u003e= 0)\n        \"\"\" Absolute tolerance used for equality comparisons.\"\"\"\n\n        scaling = Option(\n            Mapping[Literal[\"x\", \"y\", \"z\"], float],\n            {\"x\": 1.0, \"y\": 2.0, \"z\": 1.0},\n            lambda scaling: all(v \u003e= 0 for v in scaling.values())\n        )\n        \"\"\" Scaling for coordinate axes used in plots.  \"\"\"\n\n    options = MyOptions()\n\nEach option takes a default value, a type, and an optional validator function:\n\n.. code-block:: python\n\n    validate = Option(bool, True)\n    #     option type ^^^^  ^^^^ default value\n\n    eq_atol = Option(float, 1e-8, lambda x: x \u003e= 0)\n    #           optional validator ^^^^^^^^^^^^^^^^\n\nAny type supported by the `typing-validation \u003chttps://github.com/hashberg-io/typing-validation\u003e`_ library can be used for options, including `PEP 484 \u003chttps://peps.python.org/pep-0484/\u003e`_ type hints:\n\n.. code-block:: python\n\n    scaling: Option(\n        Mapping[Literal[\"x\", \"y\", \"z\"], float], # \u003c- type hints supported\n        {\"x\": 1.0, \"y\": 2.0, \"z\": 1.0},\n        lambda scaling: all(v \u003e= 0 for v in scaling.values())\n    )\n\nOptions can be accessed and set like attributes of the ``options`` object:\n\n.. code-block:: python\n\n    print(options.scaling)  # {'x': 1.0, 'y': 2.0, 'z': 1.0}\n    options.scaling = {\"x\": 2.5, \"y\": 1.5, \"z\": 1.0}\n    print(options.scaling) # {'x': 2.5, 'y': 1.5, 'z': 1.0}\n\nIt is possible to set multiple options simultaneously using the `set \u003chttps://optmanage.readthedocs.io/en/latest/api/optmanage.manager.html#optmanage.manager.OptionManager.set\u003e`_ method of the ``options`` object:\n\n.. code-block:: python\n\n    options.set(validate=False, eq_atol=1e-3)\n    print(options.validate) # False\n    print(options.eq_atol)  # 0.001\n\nIt is also possible to use the options object as a context manager, for temporary option setting:\n\n.. code-block:: python\n\n    with options(validate=False, eq_atol=1e-3):\n        print(options.validate) # False\n        print(options.eq_atol)  # 0.001\n    print(options.validate) # True\n    print(options.eq_atol)  # 0.00000001\n\nAll options can be reset to their default values by using the `OptionManager.reset \u003chttps://optmanage.readthedocs.io/en/latest/api/optmanage.manager.html#optmanage.manager.OptionManager.reset\u003e`_ method of the ``options`` object:\n\n.. code-block:: python\n\n    options.set(validate=False, eq_atol=1e-3)\n    print(options.validate) # False\n    print(options.eq_atol)  # 0.001\n    options.reset()\n    print(options.validate) # True\n    print(options.eq_atol)  # 0.00000001\n\nAn individual option can be reset to its default value by using the `Option.reset \u003chttps://optmanage.readthedocs.io/en/latest/api/optmanage.option.html#optmanage.option.Option.reset\u003e`_ method of the `Option \u003chttps://optmanage.readthedocs.io/en/latest/api/optmanage.option.html#option\u003e`_ object, accessed from the option manager class:\n\n.. code-block:: python\n\n    options.set(validate=False, eq_atol=1e-3)\n    print(options.validate) # False\n    print(options.eq_atol)  # 0.001\n    MyOptions.eq_atol.reset(options) # resets 'eq_atol' on the 'options' object\n    print(options.validate) # True\n    print(options.eq_atol)  # 0.001\n\n\nAPI\n---\n\nFull documentation is available at https://optmanage.readthedocs.io/\n\n\nContributing\n------------\n\nThis project is currently in private development. Public contribution guidelines are available at `\u003cCONTRIBUTING.md\u003e`_.\n\n\nLicense\n-------\n\n`MIT © Hashberg Ltd. \u003cLICENSE\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashberg-io%2Foptmanage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhashberg-io%2Foptmanage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashberg-io%2Foptmanage/lists"}