Skip to content

Commit b35f31d

Browse files
authored
Merge pull request #83 from bernalde/fix/dependabot-setuptools-4
Remove vulnerable Setuptools pin from generation dependencies
2 parents 6b6dcbc + 3b91e4a commit b35f31d

10 files changed

Lines changed: 19 additions & 28 deletions

File tree

.github/copilot-setup-steps.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ setup_steps:
2828
- nbconvert
2929
- ipykernel
3030
generation:
31-
- hyperopt
32-
- "setuptools<81"
31+
- "hyperopt>=0.3.0"
3332
development:
3433
- flake8
3534
- black # code formatter

CI-TESTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ The CI environment includes:
177177
- ipykernel >= 6
178178

179179
**Optional Data-Generation Dependencies:**
180-
- hyperopt >= 0.2.7
181-
- setuptools < 81 (temporary Hyperopt 0.2.7 compatibility workaround)
180+
- hyperopt >= 0.3.0
182181

183182
**Testing Tools:**
184183
- pytest

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ pip install -e ".[examples,notebooks]"
173173
pip install -e ".[generation]"
174174
```
175175

176-
The generation requirements include a temporary `setuptools<81` compatibility pin because Hyperopt 0.2.7 imports `pkg_resources`. This workaround is generation-specific and is not needed for analysis-only notebooks.
176+
The generation requirements use Hyperopt 0.3.0 or newer, which supports current
177+
Python packaging tools without the removed `pkg_resources` API.
177178

178179
<!-- the following `pip` command can install this package -->
179180

examples/wishart_n_50_alpha_0.5/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Install the generation dependencies from this directory with:
2929
pip install -r ../../requirements-generation.txt
3030
```
3131

32-
`requirements-generation.txt` includes a temporary `setuptools<81` compatibility pin for Hyperopt 0.2.7, which imports `pkg_resources`. This pin is only for generation workflows and is not required to run analysis notebooks.
32+
`requirements-generation.txt` uses Hyperopt 0.3.0 or newer, which supports
33+
current Python packaging tools without the removed `pkg_resources` API.
3334

3435
These generation-only dependencies are imported lazily by `wishart_runs.py`, so importing the analysis helpers in `wishart_ws.py` does not require them.
3536

examples/wishart_n_50_alpha_0.5/wishart_n_50_alpha_0.50.ipynb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@
6969
"# Configure warning filters\n",
7070
"import warnings\n",
7171
"\n",
72-
"# Suppress known harmless warnings\n",
73-
"warnings.filterwarnings('ignore', message='pkg_resources is deprecated')\n",
74-
"\n",
7572
"# Show sequential search data warning only once\n",
7673
"# This is expected when sequential search encounters sparse data regions\n",
7774
"warnings.filterwarnings('once', message='Sequential search experiment terminated due to insufficient data')"

examples/wishart_n_50_alpha_0.5/wishart_ws.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88
import pandas as pd
99
import sys
1010
from tqdm import tqdm
11-
import warnings
1211
from wishart_paths import logname
1312

14-
# Filter known third-party warnings
15-
warnings.filterwarnings('ignore', message='pkg_resources is deprecated')
16-
1713
sys.path.append('../../src') #TODO set path to point to src of stochastic-benchmark
1814
import bootstrap
1915
import interpolate

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
requires = [
3-
"setuptools>=42",
3+
"setuptools>=83",
44
"wheel"
55
]
66
build-backend = "setuptools.build_meta"

requirements-generation.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
# Optional dependencies for data-generation workflows
22
# These are NOT required for core stochastic-benchmark analysis or examples
3-
hyperopt>=0.2.7
4-
5-
# Temporary Hyperopt compatibility workaround:
6-
# Hyperopt 0.2.7 imports pkg_resources, which is not available in setuptools 81+.
7-
# Keep this generation-specific until Hyperopt no longer needs pkg_resources.
8-
setuptools<81
3+
hyperopt>=0.3.0

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"ipykernel>=6",
3030
],
3131
"generation": [
32-
"hyperopt>=0.2.7",
33-
"setuptools<81",
32+
"hyperopt>=0.3.0",
3433
],
3534
}
3635

tests/test_optional_dependencies.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,26 @@ def test_example_requirements_cover_self_contained_notebook_dependencies():
5757
def test_generation_requirements_are_separate_from_core():
5858
generation_requirements = _requirements(REPO_ROOT / "requirements-generation.txt")
5959

60-
assert "hyperopt" in _requirement_names(generation_requirements)
61-
assert any(requirement == "setuptools<81" for requirement in generation_requirements)
60+
assert "hyperopt>=0.3.0" in generation_requirements
61+
assert "setuptools" not in _requirement_names(generation_requirements)
6262

6363

6464
def test_setup_extras_match_optional_dependency_groups():
6565
install_requires = _setup_constant("INSTALL_REQUIRES")
6666
extras_require = _setup_constant("EXTRAS_REQUIRE")
6767

68-
assert "hyperopt>=0.2.7" not in install_requires
68+
assert "hyperopt>=0.3.0" not in install_requires
6969
assert {"scikit-learn>=1.3.0", "dimod>=0.12"} <= set(
7070
extras_require["examples"]
7171
)
7272
assert {"nbconvert>=7", "ipykernel>=6"} <= set(extras_require["notebooks"])
73-
assert {"hyperopt>=0.2.7", "setuptools<81"} <= set(
74-
extras_require["generation"]
75-
)
73+
assert extras_require["generation"] == ["hyperopt>=0.3.0"]
74+
75+
76+
def test_build_backend_requires_patched_setuptools():
77+
pyproject = (REPO_ROOT / "pyproject.toml").read_text()
78+
79+
assert '"setuptools>=83"' in pyproject
7680

7781

7882
def test_wishart_generation_reports_clear_error_without_hyperopt(monkeypatch):

0 commit comments

Comments
 (0)