Skip to main content

xparameter

A portable configuration tool to manage hyperparameters and settings of your experiments.

Features

✅ Support syntax highlighting and autocompletion for attributes
✅ Support arguments control through command line
✅ Support nested definition (namespaces) to isolate parameters of the same name
✅ Inherent Singleton ensuring consistent revision across files
✅ Support basic type checking

Quickstart

You can install the latest official version of xparameter from PyPI:

pip install xparameter

Define Custom Configuration

# config.py
from xparameter import Configure as C
from xparameter import Field as F

class Config(C):
    """Define your overall description here"""

    class checkpoint(C):
        """Define group description here"""
        directory       = F(str,   default="./checkpoints", help="Directory to save model checkpoints")

Parse Command-line Arguments

Config.parse_sys_args()

Parameters in Config class will be automatically registered onto a argparse.ArgumentParser(), which acts as a parser to extract parameter values from command line. In this example case, we use

python test.py --checkpoint.directory "/path/to/checkpoints"

The argument Config.checkpoint.directory will be set to "/path/to/checkpoints". This parsing process and the following manual revision will trigger an inherent type check.

Use the help command to print automatically generated help menu:

python test.py --help
Usage: config_01.py [-h] [--checkpoint.directory str]

Define your overall description here

Options:
  -h, --help                  show this help message and exit

Checkpoint:
  Define group description here

  --checkpoint.directory str  Directory to save model checkpoints

Revise Arguments Manually

Manual revision of the argument values can be performed either independently or as a post-processing step following the aforementioned command-line parsing, e.g.,

# Config.parse_sys_args()
Config.checkpoint.directory = "/path/to/checkpoints"

Export as Different Formats

Export as python dict:

Config.as_dict()

Export as json string:

Config.as_json()

Metadata

Release files for xparameter 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xparameter 0.0.1
File Size Uploaded Provenance Actions
xparameter-0.0.1.tar.gz 4.2 kB Without provenance Details for xparameter-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xparameter 0.0.1
File Interpreter ABI Platform Actions
xparameter-0.0.1-py3-none-any.whl Python 3 none any Details for xparameter-0.0.1-py3-none-any.whl

Total release size: 8.7 kB

Release files / xparameter-0.0.1.tar.gz

Download URL xparameter-0.0.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
19db36384d513697060726870b73a80fa34c6fdc891596fd696ffaa7b89cc770
BLAKE2b-256 checksum
How to use checksums
3d779762cc3296eba4b829d8faae3dee9665aa410f6828c98604eadaeec351b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / xparameter-0.0.1-py3-none-any.whl

Download URL xparameter-0.0.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
359686c322be68774a6b07d5373e2cd49481758f6ec0fb29fd2ba9fae30991fd
BLAKE2b-256 checksum
How to use checksums
bfe2c8f5c0cf0eaad801994fb0a858e02907fb372e54b9aa790c6472030a2555
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Security for xparameter 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page