Programmatic parameter sweeps for pydantic.
Project description
pydantic-sweep
pydantic_sweep is a library to programmatically, safely and flexibly define
complex parameter sweeps over pydantic models in Python.
Highlights:
- Specify parameter sweeps in Python
- Flexibility: specify complex parameter combinations by chaining simple operations
- Safety checks for parameter combinations (get meaningful errors early)
pydanticfield validation
For example, the following code will instantiate models with (x=5, y=1) and
(x=6, y=2) and try each of those with seed values of seed=43 and seed=44,
leading to four different configurations:
import pydantic_sweep as ps
class Model(ps.BaseModel):
seed: int = 42
x: int = 5
y: int
models = ps.initialize(
Model,
ps.config_product(
ps.field("seed", [43, 44]),
ps.config_zip(
ps.field("x", [ps.DefaultValue, 6]),
ps.field("y", [1, 2]),
)
)
)
# The code above is equivalent to
models = [
Model(seed=43, x=5, y=1),
Model(seed=43, x=6, y=2),
Model(seed=44, x=5, y=1),
Model(seed=44, x=6, y=2),
]
To learn mode about the full capabilities of the library visit the documentation page.
Installation
You can install the library by checking out the repo and running
pip install 'pydantic_sweep'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_sweep-0.1.0.tar.gz.
File metadata
- Download URL: pydantic_sweep-0.1.0.tar.gz
- Upload date:
- Size: 108.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a391542823f4c495af636bda690fa33eefc270c1cf624fb6450242861853a21
|
|
| MD5 |
46d4f0f57cf9f730a11785a44362555b
|
|
| BLAKE2b-256 |
2f9bb3b1f7553e2a2e5728493f6475df871c60a67afa2bacdb599fc8fab9a291
|
Provenance
The following attestation bundles were made for pydantic_sweep-0.1.0.tar.gz:
Publisher:
release.yml on befelix/pydantic_sweep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_sweep-0.1.0.tar.gz -
Subject digest:
5a391542823f4c495af636bda690fa33eefc270c1cf624fb6450242861853a21 - Sigstore transparency entry: 158123256
- Sigstore integration time:
-
Permalink:
befelix/pydantic_sweep@4a593246787f7960acdebca4eef0c98810964aa1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/befelix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a593246787f7960acdebca4eef0c98810964aa1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pydantic_sweep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydantic_sweep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
defaf7d5dd19b62aa46f2fc285c64c178ce4c10f5b538a723f0bfbe4f85d4ed6
|
|
| MD5 |
7a79610d1c441cb7c9b3af0aacea9d25
|
|
| BLAKE2b-256 |
48d7ba38f70af88eb3f878d811e439ded728eea6acaaa87ba9431d0fd4a1b0aa
|
Provenance
The following attestation bundles were made for pydantic_sweep-0.1.0-py3-none-any.whl:
Publisher:
release.yml on befelix/pydantic_sweep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_sweep-0.1.0-py3-none-any.whl -
Subject digest:
defaf7d5dd19b62aa46f2fc285c64c178ce4c10f5b538a723f0bfbe4f85d4ed6 - Sigstore transparency entry: 158123257
- Sigstore integration time:
-
Permalink:
befelix/pydantic_sweep@4a593246787f7960acdebca4eef0c98810964aa1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/befelix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a593246787f7960acdebca4eef0c98810964aa1 -
Trigger Event:
release
-
Statement type: