Skip to main content

raxpy, Python library to rapidly design and execute experiments

|---|---| | Testing | CI - Test | | Meta | License: MIT

Description

raxpy is a Python library that designs and executes experiments on Python annotated functions. Given a Python function provided by the user, raxpy introspects the function signature to derive an experiment input-space. With a function's derived input-space, raxpy utilizes different experiment design algorithms to create a small set of function arguments, i.e., the design points, that attempt to cover the whole input-space. With the experiment design, raxpy maps the design points to the function's arguments to execute the function with each point.

To address limitations in factorial and random point selection algorithms, raxpy provide space-filling design algorithms to generate insightful results from a small number of function executions. For more information about the experiment design algorithms, see https://journals.sagepub.com/doi/10.1177/15485129261481845.

Usage

  1. Install raxpy if not already installed.
  2. Import raxpy, typing, and dataclass
  3. Create a annotated function that is to be the subject of experimentation
from typing import Optional, Union, Annotated
from dataclasses import dataclass

import raxpy


# To prepare for the experiment, each branch of a branching factor, 
# you create a dataclass to specify the nested factors

@dataclass
class HierarchicalFactorThreeA:
    x4: Annotated[int, raxpy.Float(lb=0, ub=5)] # nested factor
    # shared nested factor between HierarchicalFactorThreeA and HierarchicalFactorThreeB
    x5: Annotated[float, raxpy.Float(id="x5", lb=1.0, ub=2.0)] 

@dataclass
class HierarchicalFactorThreeB:
    x4: Annotated[float, raxpy.Float(lb=0.0, ub=1.0)]  # nested factor
    # shared nested factor between HierarchicalFactorThreeA and HierarchicalFactorThreeB
    x5: Annotated[float, raxpy.Float(id="x5", lb=1.0, ub=2.0)] 


def f(
    # The following specify the experiment inputs. Annotations
    # provide details such as the lower and upper bound of the inputs
    x1: Annotated[float, raxpy.Float(lb=0.0, ub=1.0)],
    x2: Annotated[Optional[float], raxpy.Float(lb=-1.0, ub=1.0, portion_null=0.4)],
    # x3 is a branching factor, either "branch" HierarchicalFactorThreeA or "branch" HierarchicalFactorThreeB
    x3: Union[HierarchicalFactorThreeA, HierarchicalFactorThreeB], 
):
    # The following code should execute the computations with these values,
    # such as running a simulation or training a machine learning model.
    # to keep it simple for this demonstration, we simply compute a polynominal.

    # In the function specification above, x2 is annotated as Optional. This 
    # indicates that this parameter is optional (users can call this function
    # with setting x2 to None)
    # The function specification also provides a lower and upper bound for
    # each float input parameter.

    # placeholder f logic
    return x1 + (x2 if x2 is not None else 0) * x3.x4 * x3.x5
  1. Run experiment
experiment_design, inputs, outputs = raxpy.perform_experiment(f, n_points=20)
  1. As needed, assess design of experiment
raxpy.measure.assess_design(experiment_design)

See examples folder for more usage examples.

Features

raxpy can execute experiments on functions with the following types of parameters:

  • float types
  • int types
  • str (categorical) types
  • Optional, None types
  • Nested and Nested Branches (Hierarchical) types based on dataclasses' attributes
  • Union types

Experiment Design Algorithm Support

raxpy provides extended versions of the following algorithms to support optional, hierarchical, and union typed inputs. The space-filling designs work best for exploration use cases when function executions are highly constrained by time and compute resources. Random designs work best when the function needs executed to support the creation of a very large dataset.

  • Space-filling MaxPro
  • Space-filling Uniform (using scipy)
  • Random

Installation

raxpy requires numpy and scipy. To install with pip, execute

pip install raxpy

To execute distributed experiments with MPI, also ensure you have the appropriate MPI cluster and install mpi4py.

Support

For community support, please use GitHub issues.

Roadmap

Version x.x

The following elements are being considered for development but not scheduled.

  • Auto-generated data schema and databases
  • Advanced trial meta-data features (point ids, run-time, status, etc.)
  • Adaptive experimentation algorithms
    • Response surface methodology
    • Sequential design algorithms
  • Support of more input-space constraint types
  • Mixture constraints
  • Multi-dimensional linear constraints
  • Surrogate optimization features
  • Trial artifact management

Contributing

This project is open for new contributions. Contributions should follow the coding style as evident in codebase and be unit-tested. New dependencies should mostly be avoided; one exception is the creation of a new adapter, such as creating an adapter to use raxpy with an optimization library.

Project status

raxpy is being actively developed as of 2026-09-25.

Metadata

Release files for raxpy 1.0.0

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

Source distribution (sdist)

Source distribution for raxpy 1.0.0
File Size Uploaded Provenance Actions
raxpy-1.0.0.tar.gz 107.9 kB With provenance Details for raxpy-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 174.3 kB

Release files / raxpy-1.0.0.tar.gz

Download URL raxpy-1.0.0.tar.gz
Size 107.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bb3c5731393c35ac1de65cfee9fca07fb88387f7510cc99336dc105af0b9ce33
BLAKE2b-256 checksum
How to use checksums
565f6cca10891bee862f5e1a654e66f8c8c7e1ee712bb723a9585da9d7b7828e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / raxpy-1.0.0-py3-none-any.whl

Download URL raxpy-1.0.0-py3-none-any.whl
Size 66.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb4a59368295b8a17b14439de7948881ca36001bb9f2bdc2612da5ba63a0052f
BLAKE2b-256 checksum
How to use checksums
81e598840d3cfc92399f13e09cfd4fd3738c26bdca64571f6d5605a088d2c862
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Security for raxpy 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for raxpy-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

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.

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