Skip to content

Commit 69cc7f8

Browse files
authored
Port requirements to PEP735 (matplotlib#29281)
1 parent 8c7a193 commit 69cc7f8

19 files changed

Lines changed: 140 additions & 142 deletions

File tree

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ commands:
103103
- run:
104104
name: Install Python dependencies
105105
command: |
106-
python -m pip install --user -r requirements/dev/build-requirements.txt
106+
python -m pip install --user --group build
107107
python -m pip install --user \
108108
numpy<< parameters.numpy_version >> \
109-
-r requirements/doc/doc-requirements.txt
109+
--group doc
110110
python -m pip install --no-deps --user \
111111
git+https://github.com/matplotlib/mpl-sphinx-theme.git
112112

.github/workflows/cygwin.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
145145
with:
146146
path: C:\cygwin\home\runneradmin\.cache\pip
147-
key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
147+
key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('pyproject.toml') }}
148148
restore-keys: ${{ matrix.os }}-py3.${{ matrix.python-minor-version }}-pip-
149149

150150
- name: Cache ccache
@@ -175,15 +175,9 @@ jobs:
175175
- name: Install Python dependencies
176176
shell: bash.exe -eo pipefail -o igncr "{0}"
177177
run: |
178-
python -m pip install --upgrade pip setuptools wheel
179-
python -m pip install kiwisolver 'numpy>=1.22,<1.26' pillow importlib_resources
180-
grep -v -F -e psutil requirements/testing/all.txt >requirements_test.txt
181-
python -m pip install meson-python pybind11
178+
python -m pip install --group build 'numpy>=1.25,<1.26'
182179
export PATH="/usr/local/bin:$PATH"
183-
python -m pip install --no-build-isolation 'contourpy>=1.0.1'
184-
python -m pip install --upgrade cycler fonttools \
185-
packaging pyparsing python-dateutil setuptools-scm \
186-
-r requirements_test.txt sphinx ipython
180+
python -m pip install --upgrade --group test sphinx ipython
187181
python -m pip install --upgrade pycairo 'cairocffi>=0.8' PyGObject &&
188182
python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' &&
189183
echo 'PyGObject is available' ||

.github/workflows/linting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
python-version: '3.11'
7070

7171
- name: Install mypy
72-
run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt
72+
run: pip3 install --group build --group typing
7373

7474
- name: Set up reviewdog
7575
uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0

.github/workflows/tests.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ jobs:
5252
- name-suffix: "(Minimum Versions)"
5353
os: ubuntu-22.04
5454
python-version: '3.11'
55-
extra-requirements: '-c requirements/testing/minver.txt'
55+
extra-requirements: '-c ci/minver-requirements.txt'
5656
delete-font-cache: true
5757
# https://github.com/matplotlib/matplotlib/issues/29844
5858
pygobject-ver: '<3.52.0'
5959
- os: ubuntu-22.04
6060
python-version: '3.11'
6161
CFLAGS: "-fno-lto" # Ensure that disabling LTO works.
62-
extra-requirements: '-r requirements/testing/extra.txt'
62+
extra-requirements: '--group test-extra'
6363
# https://github.com/matplotlib/matplotlib/issues/29844
6464
pygobject-ver: '<3.52.0'
6565
- name-suffix: "(Extra TeX packages)"
@@ -190,15 +190,17 @@ jobs:
190190
if: startsWith(runner.os, 'Linux')
191191
with:
192192
path: ~/.cache/pip
193-
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
193+
key: |
194+
${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{
195+
hashFiles('pyproject.toml', 'ci/minver-requirements.txt') }}
194196
restore-keys: |
195197
${{ matrix.os }}-py${{ matrix.python-version }}-pip-
196198
- name: Cache pip
197199
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
198200
if: startsWith(runner.os, 'macOS')
199201
with:
200202
path: ~/Library/Caches/pip
201-
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
203+
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
202204
restore-keys: |
203205
${{ matrix.os }}-py${{ matrix.python-version }}-pip-
204206
- name: Cache ccache
@@ -235,12 +237,8 @@ jobs:
235237
236238
# Install dependencies from PyPI.
237239
# Preinstall build requirements to enable no-build-isolation builds.
238-
python -m pip install --upgrade $PRE \
239-
'contourpy>=1.0.1' cycler fonttools kiwisolver importlib_resources \
240-
packaging pillow 'pyparsing!=3.1.0' python-dateutil setuptools-scm \
241-
'meson-python>=0.13.1' 'pybind11>=2.13.2' \
242-
-r requirements/testing/all.txt \
243-
${{ matrix.extra-requirements }}
240+
python -m pip install --upgrade $PRE --prefer-binary \
241+
--group build --group test ${{ matrix.extra-requirements }}
244242
245243
# Install optional dependencies from PyPI.
246244
# Sphinx is needed to run sphinxext tests

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ stages:
7474
7575
- bash: |
7676
python -m pip install --upgrade pip
77-
python -m pip install --upgrade -r requirements/dev/build-requirements.txt
78-
python -m pip install -r requirements/testing/all.txt -r requirements/testing/extra.txt
77+
python -m pip install --upgrade --group build
78+
python -m pip install --prefer-binary --group test --group test-extra
7979
displayName: 'Install dependencies with pip'
8080
8181
- bash: |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pip 25.1 suggested for development
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Dependencies for development (build and testing) are now specified as `Dependency Groups
5+
<https://packaging.python.org/en/latest/specifications/dependency-groups/#dependency-groups>`_
6+
instead of `individual requirements files
7+
<https://pip.pypa.io/en/stable/reference/requirements-file-format/>`_.
8+
9+
Consequently, a version of pip that supports Dependency Groups is suggested, namely
10+
version 25.1 or higher. Note that if you install build/testing dependencies manually (by
11+
copying the list from ``pyproject.toml``), then an older version of pip is sufficient.

doc/devel/development_setup.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ setup.
177177

178178
Install the Python dependencies with ::
179179

180-
pip install -r requirements/dev/dev-requirements.txt
180+
pip install -U pip # You may skip this step if pip 25.1 is already available.
181+
pip install --group dev
181182

182183
Remember to activate the environment whenever you start working on Matplotlib!
183184

@@ -270,7 +271,7 @@ Install Matplotlib in editable mode
270271
Install Matplotlib in editable mode from the :file:`matplotlib` directory using the
271272
command ::
272273

273-
python -m pip install --verbose --no-build-isolation --editable ".[dev]"
274+
python -m pip install --verbose --no-build-isolation --group dev --editable .
274275

275276
The 'editable/develop mode' builds everything and places links in your Python environment
276277
so that Python will be able to import Matplotlib from your development source directory.

doc/devel/release_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ To build the documentation you must have the tagged version installed, but
450450
build the docs from the ``ver-doc`` branch. An easy way to arrange this is::
451451

452452
pip install matplotlib
453-
pip install -r requirements/doc/doc-requirements.txt
453+
pip install --group doc
454454
git checkout v3.7.0-doc
455455
git clean -xfd
456456
make -Cdoc O="-t release -j$(nproc)" html latexpdf LATEXMKOPTS="-silent -f"

doc/install/dependencies.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,11 @@ Documentation dependencies
406406
Python
407407
------
408408

409-
The additional Python packages required to build the
410-
:ref:`documentation <documenting-matplotlib>` are listed in
411-
:file:`doc-requirements.txt` and can be installed using ::
412-
413-
pip install -r requirements/doc/doc-requirements.txt
414-
415-
The content of :file:`doc-requirements.txt` is also shown below:
416-
417-
.. include:: ../../requirements/doc/doc-requirements.txt
418-
:literal:
409+
The additional Python packages required to build the :ref:`documentation
410+
<documenting-matplotlib>` are listed in :file:`pyproject.toml` and can be
411+
installed using ::
419412

413+
pip install --group doc
420414

421415
.. _doc-dependencies-external:
422416

0 commit comments

Comments
 (0)