Skip to content

Commit d867710

Browse files
martin-martinrealpython-botclaude
authored
Pin the python-statistics requirements (#828)
Materials folders should pin their dependencies in requirements.txt, which is what the great majority of folders here already do. This one shipped with an unpinned requirements.txt and the pins kept separately in a constraints.txt, so a plain `pip install -r requirements.txt` could pull a stack the tutorial was never checked against. Move the pins into requirements.txt, drop constraints.txt, and update the README's setup step to match. Re-verified after the change: a virtualenv built from requirements.txt alone resolves to NumPy 2.5.3, SciPy 1.18.1, pandas 3.0.5 and Matplotlib 3.11.2, all 13 scripts run on it, and ruff format/check pass. Co-authored-by: Real Python Bot <42617967+realpython-bot@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ee3b947 commit d867710

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

python-statistics/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Create and activate a virtual environment, then install the requirements:
1111
```bash
1212
$ python -m venv venv
1313
$ source venv/bin/activate
14-
(venv) $ python -m pip install -r requirements.txt -c constraints.txt
14+
(venv) $ python -m pip install -r requirements.txt
1515
```
1616

17-
The tutorial's examples were verified against the versions pinned in `constraints.txt`. Newer releases will usually work too, but NumPy 2 changed how scalars are displayed, so output from older versions won't match the tutorial exactly.
17+
`requirements.txt` pins the versions the tutorial's examples were verified against. Newer releases will usually work too, but NumPy 2 changed how scalars are displayed, so output from older versions won't match the tutorial exactly.
1818

1919
## Usage
2020

python-statistics/constraints.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

python-statistics/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
numpy
2-
scipy
3-
pandas
4-
matplotlib
1+
numpy==2.5.3
2+
scipy==1.18.1
3+
pandas==3.0.5
4+
matplotlib==3.11.2

0 commit comments

Comments
 (0)