Skip to content

Commit 362fe85

Browse files
authored
Split heavy dependencies into optional extras (#11)
The core devol package only uses numpy, pydantic, and pydantic-yaml, but the shipped dependency list forced every user to install torch, torchvision, gymnasium, and matplotlib — a ~2 GB footprint for a library whose runtime doesn't touch any of them. - Required deps reduced to numpy, pydantic, pydantic-yaml - Drop unused pydantic-settings (leftover from an abandoned branch) - Move torch, torchvision, gymnasium[classic-control], matplotlib into the examples extra (where cartpole/mnist/live-two-peaks actually use them) - Add twine to the dev extra so the build CI job works from a sync - Add an `all` meta-extra that pulls dev + examples + benchmark - Narrow the wheel target to src/devol so examples/ and benchmark/ ship only in the repo, not in the pip install - Add pytest pythonpath config — narrowing the wheel removed the accidental side-effect that let `tests.ci.n_peaks` resolve via editable install, so configure it explicitly - Update README with an Installation section covering the extras - Update CHANGELOG with the dependency changes, the wheel narrowing, and the earlier CI/typing work from PR #10
1 parent 3a7a512 commit 362fe85

4 files changed

Lines changed: 522 additions & 38 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,21 @@ the set of symbols exported from `devol.__all__`; anything else is internal.
1717
- `py.typed` marker so downstream type checkers pick up `devol`'s inline hints.
1818
- `CONTRIBUTING.md` with minimum expectations for patches.
1919
- This changelog.
20+
- CI matrix covering Python 3.11, 3.12, and 3.13 with separate lint, typecheck, test, and build jobs.
21+
- `examples`, `benchmark`, `dev`, and `all` optional dependency groups.
22+
- `src/devol` is now strictly typed end-to-end (`mypy --strict` clean).
23+
- Installation section in the README explaining the new extras.
2024

2125
### Changed
2226

2327
- Moved `pytest` from required dependencies to the `dev` extra.
28+
- Moved `torch`, `torchvision`, `gymnasium`, and `matplotlib` out of required dependencies. Installing `devol` now pulls only `numpy`, `pydantic`, and `pydantic-yaml`; the heavy deps live under the `examples` extra.
29+
- Dropped unused `pydantic-settings` from dependencies.
30+
- Wheel contents narrowed to `src/devol` only — `examples/` and `benchmark/` stay in the repo but are no longer shipped.
31+
32+
### Fixed
33+
34+
- `DiffusionEvolution.run()` no longer requires `initial_population`; calling `algo.run()` now initializes a population automatically, matching the documented Quick Start usage and unblocking the `devol` CLI entry point.
2435

2536
## [0.1.0]
2637

‎README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ This reframing gives us an algorithm that naturally transitions from broad explo
1212

1313
**The intuition**: Imagine you're in a foggy room full of people, each standing at a different elevation. You can only see your immediate neighbors through the fog. To find the highest point, you don't just copy the person next to you - you look at everyone nearby, weight them by height, and move toward the weighted average. As the fog clears (denoising), your steps become smaller and more precise.
1414

15+
## Installation
16+
17+
```bash
18+
pip install devol
19+
```
20+
21+
Devol's core has a tiny footprint (numpy + pydantic + pydantic-yaml). Optional extras install the dependencies needed for demos and benchmarks:
22+
23+
```bash
24+
pip install "devol[examples]" # cartpole, MNIST, two-peaks (adds torch, gymnasium, matplotlib)
25+
pip install "devol[benchmark]" # grid-search benchmarks (adds matplotlib, rich, tqdm)
26+
pip install "devol[dev]" # contributor tooling (pytest, ruff, mypy, twine)
27+
pip install "devol[all]" # everything above
28+
```
29+
1530
## Quick Start
1631

1732
```python

‎pyproject.toml‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,9 @@ classifiers = [
3030
"Typing :: Typed",
3131
]
3232
dependencies = [
33-
"gymnasium[classic-control]>=1.2.1",
34-
"matplotlib>=3.10.7",
3533
"numpy>=1.26.0",
3634
"pydantic>=2.0.0",
37-
"pydantic-settings>=2.0.0",
3835
"pydantic-yaml>=1.6.0",
39-
"torch>=2.9.0",
40-
"torchvision>=0.24.0",
4136
]
4237

4338
[project.urls]
@@ -51,16 +46,22 @@ dev = [
5146
"ruff>=0.1.0",
5247
"mypy>=1.7.0",
5348
"pytest>=8.0.0",
49+
"twine>=5.0.0",
5450
]
5551
examples = [
5652
"matplotlib>=3.8.0",
57-
"gymnasium>=0.29.0",
53+
"gymnasium[classic-control]>=1.2.1",
54+
"torch>=2.9.0",
55+
"torchvision>=0.24.0",
5856
]
5957
benchmark = [
6058
"matplotlib>=3.8.0",
6159
"rich>=13.0.0",
6260
"tqdm>=4.65.0",
6361
]
62+
all = [
63+
"devol[dev,examples,benchmark]",
64+
]
6465

6566
[project.scripts]
6667
devol = "devol.cli:main"
@@ -70,7 +71,7 @@ requires = ["hatchling"]
7071
build-backend = "hatchling.build"
7172

7273
[tool.hatch.build.targets.wheel]
73-
packages = ["src/devol", "examples"]
74+
packages = ["src/devol"]
7475

7576
[tool.ruff]
7677
line-length = 120
@@ -88,3 +89,7 @@ warn_return_any = true
8889
warn_unused_configs = true
8990
disallow_untyped_defs = true
9091
files = ["src/devol"]
92+
93+
[tool.pytest.ini_options]
94+
pythonpath = ["."]
95+
testpaths = ["tests"]

0 commit comments

Comments
 (0)