distparser 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {distparser-0.3.0/src/distparser.egg-info → distparser-0.3.1}/PKG-INFO +32 -33
- distparser-0.3.1/README.md +62 -0
- {distparser-0.3.0 → distparser-0.3.1}/pyproject.toml +1 -1
- distparser-0.3.1/src/distparser/version.py +1 -0
- {distparser-0.3.0 → distparser-0.3.1/src/distparser.egg-info}/PKG-INFO +32 -33
- distparser-0.3.0/README.md +0 -63
- distparser-0.3.0/src/distparser/version.py +0 -1
- {distparser-0.3.0 → distparser-0.3.1}/LICENSE +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/setup.cfg +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser/__init__.py +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser/core.py +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser/graph.py +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser/mapping.py +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser.egg-info/SOURCES.txt +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser.egg-info/dependency_links.txt +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser.egg-info/requires.txt +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/src/distparser.egg-info/top_level.txt +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/tests/test_core.py +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/tests/test_graph.py +0 -0
- {distparser-0.3.0 → distparser-0.3.1}/tests/test_mapping.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: distparser
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Parse function-call strings into frozen scipy.stats distributions
|
|
5
5
|
Author-email: Juyoung Choi <njuyoung35@gmail.com>
|
|
6
6
|
Maintainer-email: Juyoung Choi <njuyoung35@gmail.com>
|
|
@@ -33,19 +33,13 @@ Dynamic: license-file
|
|
|
33
33
|
|
|
34
34
|
# distparser
|
|
35
35
|
|
|
36
|
-
**Parse function‑call
|
|
36
|
+
**Parse function‑call strings into frozen `scipy.stats` distributions —**
|
|
37
|
+
**with dependency resolution, arithmetic expressions, and seed management.**
|
|
37
38
|
|
|
38
39
|
[](https://badge.fury.io/py/distparser)
|
|
39
40
|
[](https://www.python.org/downloads/)
|
|
40
41
|
[](https://opensource.org/licenses/MIT)
|
|
41
42
|
|
|
42
|
-
## Why `distparser`?
|
|
43
|
-
|
|
44
|
-
When you have configuration files or user input that specifies a probability
|
|
45
|
-
distribution (e.g. `"norm(loc=0, scale=1)"`), you want to turn that string
|
|
46
|
-
into a ready‑to‑sample object. `distparser` does exactly that, with a tiny
|
|
47
|
-
API and zero surprises.
|
|
48
|
-
|
|
49
43
|
## Installation
|
|
50
44
|
|
|
51
45
|
```bash
|
|
@@ -54,42 +48,47 @@ pip install distparser
|
|
|
54
48
|
|
|
55
49
|
## Quick Start
|
|
56
50
|
|
|
57
|
-
```
|
|
58
|
-
|
|
51
|
+
```python
|
|
52
|
+
import distparser as lib
|
|
59
53
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
# Parse a single distribution string
|
|
55
|
+
d = lib.parse_dist("norm(loc=0, scale=1)")
|
|
56
|
+
print(d.rvs(size=3)) # array([...])
|
|
57
|
+
```
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
dist = parse_dist("norm(loc=0, scale=1)")
|
|
66
|
-
samples = dist.rvs(size=5) # array([-0.12, 1.03, ...])
|
|
59
|
+
## DistGraph — dependency-aware evaluation
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```
|
|
61
|
+
```python
|
|
62
|
+
from distparser import DistGraph
|
|
71
63
|
|
|
72
|
-
|
|
64
|
+
config = {
|
|
65
|
+
"mean": 5.0,
|
|
66
|
+
"noise": "norm(0, 0.1)",
|
|
67
|
+
"measurement": "mean + noise",
|
|
68
|
+
}
|
|
73
69
|
|
|
74
|
-
|
|
70
|
+
graph = DistGraph(config, seed=42)
|
|
71
|
+
result = graph.resolve_all()
|
|
72
|
+
print(result["measurement"]) # 5.0 + sample from N(0, 0.1)
|
|
73
|
+
```
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
- `norm(loc, scale)`
|
|
78
|
-
- `expon(loc, scale)`
|
|
79
|
-
- … and many more (see [docs](https://distparser.readthedocs.io)).
|
|
75
|
+
## Features
|
|
80
76
|
|
|
81
|
-
|
|
77
|
+
- **15 built-in distributions** — `uniform`, `norm`, `expon`, `gamma`, `beta`, `lognorm`, `weibull_min`, `t`, `chi2`, `f`, `pareto`, `cauchy`, `laplace`, `logistic`, `rayleigh`
|
|
78
|
+
- **Distribution aliases** — `normal` → `norm`, `gaussian` → `norm`, `unif` → `uniform`
|
|
79
|
+
- **DistGraph** — automatic dependency resolution via topological sort
|
|
80
|
+
- **Arithmetic expressions** — `"60 + 30 * uniform(0, 1)"` with `sin`, `cos`, `exp`, `sqrt`, `pi` and more
|
|
81
|
+
- **Seed management** — global `seed()`, context manager `seed_context()`, per-instance `DistGraph(seed=...)`
|
|
82
|
+
- **Bounds constraints** — annotate parameters with physical limits for downstream validation
|
|
83
|
+
- **Extensible registry** — register custom distributions at runtime
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
from distparser import register_distribution
|
|
85
|
-
from scipy.stats import gumbel_r
|
|
85
|
+
## Docs
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
```
|
|
87
|
+
Full documentation at [distparser.readthedocs.io](https://distparser.readthedocs.io).
|
|
89
88
|
|
|
90
89
|
## Development
|
|
91
90
|
|
|
92
|
-
See [AGENTS.md](AGENTS.md) for
|
|
91
|
+
See [AGENTS.md](https://github.com/njuyoung35/distparser/blob/main/AGENTS.md) for setup and guidelines.
|
|
93
92
|
|
|
94
93
|
## License
|
|
95
94
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# distparser
|
|
2
|
+
|
|
3
|
+
**Parse function‑call strings into frozen `scipy.stats` distributions —**
|
|
4
|
+
**with dependency resolution, arithmetic expressions, and seed management.**
|
|
5
|
+
|
|
6
|
+
[](https://badge.fury.io/py/distparser)
|
|
7
|
+
[](https://www.python.org/downloads/)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install distparser
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import distparser as lib
|
|
20
|
+
|
|
21
|
+
# Parse a single distribution string
|
|
22
|
+
d = lib.parse_dist("norm(loc=0, scale=1)")
|
|
23
|
+
print(d.rvs(size=3)) # array([...])
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## DistGraph — dependency-aware evaluation
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from distparser import DistGraph
|
|
30
|
+
|
|
31
|
+
config = {
|
|
32
|
+
"mean": 5.0,
|
|
33
|
+
"noise": "norm(0, 0.1)",
|
|
34
|
+
"measurement": "mean + noise",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
graph = DistGraph(config, seed=42)
|
|
38
|
+
result = graph.resolve_all()
|
|
39
|
+
print(result["measurement"]) # 5.0 + sample from N(0, 0.1)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
- **15 built-in distributions** — `uniform`, `norm`, `expon`, `gamma`, `beta`, `lognorm`, `weibull_min`, `t`, `chi2`, `f`, `pareto`, `cauchy`, `laplace`, `logistic`, `rayleigh`
|
|
45
|
+
- **Distribution aliases** — `normal` → `norm`, `gaussian` → `norm`, `unif` → `uniform`
|
|
46
|
+
- **DistGraph** — automatic dependency resolution via topological sort
|
|
47
|
+
- **Arithmetic expressions** — `"60 + 30 * uniform(0, 1)"` with `sin`, `cos`, `exp`, `sqrt`, `pi` and more
|
|
48
|
+
- **Seed management** — global `seed()`, context manager `seed_context()`, per-instance `DistGraph(seed=...)`
|
|
49
|
+
- **Bounds constraints** — annotate parameters with physical limits for downstream validation
|
|
50
|
+
- **Extensible registry** — register custom distributions at runtime
|
|
51
|
+
|
|
52
|
+
## Docs
|
|
53
|
+
|
|
54
|
+
Full documentation at [distparser.readthedocs.io](https://distparser.readthedocs.io).
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
See [AGENTS.md](https://github.com/njuyoung35/distparser/blob/main/AGENTS.md) for setup and guidelines.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: distparser
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Parse function-call strings into frozen scipy.stats distributions
|
|
5
5
|
Author-email: Juyoung Choi <njuyoung35@gmail.com>
|
|
6
6
|
Maintainer-email: Juyoung Choi <njuyoung35@gmail.com>
|
|
@@ -33,19 +33,13 @@ Dynamic: license-file
|
|
|
33
33
|
|
|
34
34
|
# distparser
|
|
35
35
|
|
|
36
|
-
**Parse function‑call
|
|
36
|
+
**Parse function‑call strings into frozen `scipy.stats` distributions —**
|
|
37
|
+
**with dependency resolution, arithmetic expressions, and seed management.**
|
|
37
38
|
|
|
38
39
|
[](https://badge.fury.io/py/distparser)
|
|
39
40
|
[](https://www.python.org/downloads/)
|
|
40
41
|
[](https://opensource.org/licenses/MIT)
|
|
41
42
|
|
|
42
|
-
## Why `distparser`?
|
|
43
|
-
|
|
44
|
-
When you have configuration files or user input that specifies a probability
|
|
45
|
-
distribution (e.g. `"norm(loc=0, scale=1)"`), you want to turn that string
|
|
46
|
-
into a ready‑to‑sample object. `distparser` does exactly that, with a tiny
|
|
47
|
-
API and zero surprises.
|
|
48
|
-
|
|
49
43
|
## Installation
|
|
50
44
|
|
|
51
45
|
```bash
|
|
@@ -54,42 +48,47 @@ pip install distparser
|
|
|
54
48
|
|
|
55
49
|
## Quick Start
|
|
56
50
|
|
|
57
|
-
```
|
|
58
|
-
|
|
51
|
+
```python
|
|
52
|
+
import distparser as lib
|
|
59
53
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
# Parse a single distribution string
|
|
55
|
+
d = lib.parse_dist("norm(loc=0, scale=1)")
|
|
56
|
+
print(d.rvs(size=3)) # array([...])
|
|
57
|
+
```
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
dist = parse_dist("norm(loc=0, scale=1)")
|
|
66
|
-
samples = dist.rvs(size=5) # array([-0.12, 1.03, ...])
|
|
59
|
+
## DistGraph — dependency-aware evaluation
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```
|
|
61
|
+
```python
|
|
62
|
+
from distparser import DistGraph
|
|
71
63
|
|
|
72
|
-
|
|
64
|
+
config = {
|
|
65
|
+
"mean": 5.0,
|
|
66
|
+
"noise": "norm(0, 0.1)",
|
|
67
|
+
"measurement": "mean + noise",
|
|
68
|
+
}
|
|
73
69
|
|
|
74
|
-
|
|
70
|
+
graph = DistGraph(config, seed=42)
|
|
71
|
+
result = graph.resolve_all()
|
|
72
|
+
print(result["measurement"]) # 5.0 + sample from N(0, 0.1)
|
|
73
|
+
```
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
- `norm(loc, scale)`
|
|
78
|
-
- `expon(loc, scale)`
|
|
79
|
-
- … and many more (see [docs](https://distparser.readthedocs.io)).
|
|
75
|
+
## Features
|
|
80
76
|
|
|
81
|
-
|
|
77
|
+
- **15 built-in distributions** — `uniform`, `norm`, `expon`, `gamma`, `beta`, `lognorm`, `weibull_min`, `t`, `chi2`, `f`, `pareto`, `cauchy`, `laplace`, `logistic`, `rayleigh`
|
|
78
|
+
- **Distribution aliases** — `normal` → `norm`, `gaussian` → `norm`, `unif` → `uniform`
|
|
79
|
+
- **DistGraph** — automatic dependency resolution via topological sort
|
|
80
|
+
- **Arithmetic expressions** — `"60 + 30 * uniform(0, 1)"` with `sin`, `cos`, `exp`, `sqrt`, `pi` and more
|
|
81
|
+
- **Seed management** — global `seed()`, context manager `seed_context()`, per-instance `DistGraph(seed=...)`
|
|
82
|
+
- **Bounds constraints** — annotate parameters with physical limits for downstream validation
|
|
83
|
+
- **Extensible registry** — register custom distributions at runtime
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
from distparser import register_distribution
|
|
85
|
-
from scipy.stats import gumbel_r
|
|
85
|
+
## Docs
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
```
|
|
87
|
+
Full documentation at [distparser.readthedocs.io](https://distparser.readthedocs.io).
|
|
89
88
|
|
|
90
89
|
## Development
|
|
91
90
|
|
|
92
|
-
See [AGENTS.md](AGENTS.md) for
|
|
91
|
+
See [AGENTS.md](https://github.com/njuyoung35/distparser/blob/main/AGENTS.md) for setup and guidelines.
|
|
93
92
|
|
|
94
93
|
## License
|
|
95
94
|
|
distparser-0.3.0/README.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# distparser
|
|
2
|
-
|
|
3
|
-
**Parse function‑call syntax strings into frozen `scipy.stats` distributions**
|
|
4
|
-
|
|
5
|
-
[](https://badge.fury.io/py/distparser)
|
|
6
|
-
[](https://www.python.org/downloads/)
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
|
|
9
|
-
## Why `distparser`?
|
|
10
|
-
|
|
11
|
-
When you have configuration files or user input that specifies a probability
|
|
12
|
-
distribution (e.g. `"norm(loc=0, scale=1)"`), you want to turn that string
|
|
13
|
-
into a ready‑to‑sample object. `distparser` does exactly that, with a tiny
|
|
14
|
-
API and zero surprises.
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
pip install distparser
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Quick Start
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
from distparser import parse_dist
|
|
26
|
-
|
|
27
|
-
# Positional arguments (order matters)
|
|
28
|
-
dist = parse_dist("uniform(0, 1)")
|
|
29
|
-
sample = dist.rvs() # e.g. 0.374
|
|
30
|
-
|
|
31
|
-
# Keyword arguments (order ignored)
|
|
32
|
-
dist = parse_dist("norm(loc=0, scale=1)")
|
|
33
|
-
samples = dist.rvs(size=5) # array([-0.12, 1.03, ...])
|
|
34
|
-
|
|
35
|
-
# Mixed (positional + keyword) – works, but not recommended
|
|
36
|
-
dist = parse_dist("expon(scale=2, loc=1)")
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Supported Distributions
|
|
40
|
-
|
|
41
|
-
Built‑in registry covers the most common continuous distributions:
|
|
42
|
-
|
|
43
|
-
- `uniform(loc, scale)`
|
|
44
|
-
- `norm(loc, scale)`
|
|
45
|
-
- `expon(loc, scale)`
|
|
46
|
-
- … and many more (see [docs](https://distparser.readthedocs.io)).
|
|
47
|
-
|
|
48
|
-
You can **add your own** at runtime:
|
|
49
|
-
|
|
50
|
-
```python
|
|
51
|
-
from distparser import register_distribution
|
|
52
|
-
from scipy.stats import gumbel_r
|
|
53
|
-
|
|
54
|
-
register_distribution("gumbel", gumbel_r, ["loc", "scale"])
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Development
|
|
58
|
-
|
|
59
|
-
See [AGENTS.md](AGENTS.md) for development setup and guidelines.
|
|
60
|
-
|
|
61
|
-
## License
|
|
62
|
-
|
|
63
|
-
MIT
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|