Skip to content

Commit

Permalink
Port requirements to PEP735
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Dec 11, 2024
1 parent cc82d4f commit 559f825
Show file tree
Hide file tree
Showing 17 changed files with 132 additions and 141 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: C:\cygwin\home\runneradmin\.cache\pip
key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ matrix.os }}-py3.${{ matrix.python-minor-version }}-pip-

- name: Cache ccache
Expand Down Expand Up @@ -174,10 +174,9 @@ jobs:
- name: Install Python dependencies
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --group build
python -m pip install kiwisolver 'numpy>=1.22,<1.26' pillow importlib_resources
grep -v -F -e psutil requirements/testing/all.txt >requirements_test.txt
python -m pip install meson-python pybind11
export PATH="/usr/local/bin:$PATH"
python -m pip install --no-build-isolation 'contourpy>=1.0.1'
python -m pip install --upgrade cycler fonttools \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
python-version: '3.10'

- name: Install flake8
run: pip3 install -r requirements/testing/flake8.txt
run: pip3 install --group lint

- name: Set up reviewdog
uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
python-version: '3.10'

- name: Install mypy
run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt
run: pip3 install --group typing

- name: Set up reviewdog
uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name-suffix: "(Minimum Versions)"
os: ubuntu-20.04
python-version: '3.10'
extra-requirements: '-c requirements/testing/minver.txt'
extra-requirements: '--group test-minver'
delete-font-cache: true
# Oldest versions with Py3.10 wheels.
pyqt5-ver: '==5.15.5 sip==6.3.0'
Expand All @@ -61,7 +61,7 @@ jobs:
python-version: '3.10'
# One CI run tests ipython/matplotlib-inline before backend mapping moved to mpl
extra-requirements:
-r requirements/testing/extra.txt
--group test-extra
"ipython==7.29.0"
"ipykernel==5.5.6"
"matplotlib-inline<0.1.7"
Expand All @@ -77,7 +77,7 @@ jobs:
pyqt6-ver: '!=6.6.0'
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'
extra-requirements: '-r requirements/testing/extra.txt'
extra-requirements: '--group test-extra'
- os: ubuntu-22.04
python-version: '3.12'
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
Expand Down Expand Up @@ -209,15 +209,15 @@ jobs:
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ matrix.os }}-py${{ matrix.python-version }}-pip-
- name: Cache pip
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ matrix.os }}-py${{ matrix.python-version }}-pip-
- name: Cache ccache
Expand Down Expand Up @@ -254,11 +254,7 @@ jobs:
# Install dependencies from PyPI.
# Preinstall build requirements to enable no-build-isolation builds.
python -m pip install --upgrade $PRE \
'contourpy>=1.0.1' cycler fonttools kiwisolver importlib_resources \
packaging pillow 'pyparsing!=3.1.0' python-dateutil setuptools-scm \
'meson-python>=0.13.1' 'pybind11>=2.13.2' \
-r requirements/testing/all.txt \
python -m pip install --upgrade $PRE --group build --group test \
${{ matrix.extra-requirements }}
# Install optional dependencies from PyPI.
Expand Down
3 changes: 1 addition & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ stages:
- bash: |
python -m pip install --upgrade pip
python -m pip install --upgrade -r requirements/dev/build-requirements.txt
python -m pip install -r requirements/testing/all.txt -r requirements/testing/extra.txt
python -m pip install --group build --group test --group test-extra
displayName: 'Install dependencies with pip'
- bash: |
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/development_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ setup.

Install the Python dependencies with ::

pip install -r requirements/dev/dev-requirements.txt
pip install --group dev

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

Expand Down
2 changes: 1 addition & 1 deletion doc/devel/release_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ To build the documentation you must have the tagged version installed, but
build the docs from the ``ver-doc`` branch. An easy way to arrange this is::

pip install matplotlib
pip install -r requirements/doc/doc-requirements.txt
pip install --group doc
git checkout v3.7.0-doc
git clean -xfd
make -Cdoc O="-t release -j$(nproc)" html latexpdf LATEXMKOPTS="-silent -f"
Expand Down
14 changes: 4 additions & 10 deletions doc/install/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,11 @@ Documentation dependencies
Python
------

The additional Python packages required to build the
:ref:`documentation <documenting-matplotlib>` are listed in
:file:`doc-requirements.txt` and can be installed using ::

pip install -r requirements/doc/doc-requirements.txt

The content of :file:`doc-requirements.txt` is also shown below:

.. include:: ../../requirements/doc/doc-requirements.txt
:literal:
The additional Python packages required to build the :ref:`documentation
<documenting-matplotlib>` are listed in :file:`pyproject.toml` and can be
installed using ::

pip install --group doc

.. _doc-dependencies-external:

Expand Down
112 changes: 112 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,118 @@ requires = [
"setuptools_scm>=7",
]

[dependency-groups]
build = [
"pybind11>=2.13.2,!=2.13.3",
"meson-python",
"setuptools-scm",
]
dev = [
{include-group= "build"},
{include-group = "doc"},
{include-group = "test"},
{include-group = "test-extra"},
{include-group = "lint"},
]
# Requirements for building docs
#
# You will first need a matching Matplotlib installation
# e.g (from the Matplotlib root directory)
# pip install --no-build-isolation --editable .[dev]
#
# Install the documentation requirements with:
# pip install -r requirements/doc/doc-requirements.txt
#
doc = [
"sphinx>=5.1.0,!=6.1.2",
"colorspacious",
"ipython",
"ipywidgets",
"ipykernel",
"numpydoc>=1.0",
"packaging>=20",
"pydata-sphinx-theme~=0.15.0",
"mpl-sphinx-theme~=3.9.0",
"pyyaml",
"PyStemmer",
"sphinxcontrib-svg2pdfconverter>=1.1.0",
"sphinxcontrib-video>=0.2.1",
"sphinx-copybutton",
"sphinx-design",
"sphinx-gallery[parallel]>=0.12.0",
"sphinx-tags>=0.4.0",
]

# pip requirements for all the CI builds
test = [
"black<24",
"certifi",
"coverage!=6.3",
"psutil",
"pytest!=4.6.0,!=5.4.0,!=8.1.0",
"pytest-cov",
"pytest-rerunfailures",
"pytest-timeout",
"pytest-xdist",
"pytest-xvfb",
"tornado",
]

# Extra pip requirements for the Python 3.10+ builds
test-extra = [
"--prefer-binary",
"ipykernel",
# jupyter/nbconvert#1970 for the 7.3 series exclusions
"nbconvert[execute]!=6.0.0,!=6.0.1,!=7.3.0,!=7.3.1",
"nbformat!=5.0.0,!=5.0.1",
"pandas!=0.25.0",
"pikepdf",
"pytz",
"pywin32; sys.platform == 'win32'",
"xarray",
]

# Extra pip requirements for the minimum-version CI run
test-minver = [
"contourpy==1.0.1",
"cycler==0.10",
"fonttools==4.22.0",
"importlib-resources==3.2.0",
"kiwisolver==1.3.2",
"meson-python==0.13.1",
"meson==1.1.0",
"numpy==1.23.0",
"packaging==20.0",
"pillow==8.3.2",
"pyparsing==2.3.1",
"pytest==7.0.0",
"python-dateutil==2.7",
]

# Extra pip requirements for the GitHub Actions flake8 build
lint = [
"flake8>=3.8",
# versions less than 5.1.0 raise on some interp'd docstrings
"pydocstyle>=5.1.0",
# 1.4.0 adds docstring-convention=all
"flake8-docstrings>=1.4.0",
# fix bug where flake8 aborts checking on syntax error
"flake8-force",
]

# Extra pip requirements for the GitHub Actions mypy build
typing = [
"mypy>=1.9",
"typing-extensions>=4.6",
# Extra stubs distributed separately from the main pypi package
"pandas-stubs",
"types-pillow",
"types-python-dateutil",
"types-psutil",
"sphinx",
{include-group = build},
]

[tool.meson-python.args]
install = ['--tags=data,python-runtime,runtime']

Expand Down
3 changes: 0 additions & 3 deletions requirements/dev/build-requirements.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements/dev/dev-requirements.txt

This file was deleted.

26 changes: 0 additions & 26 deletions requirements/doc/doc-requirements.txt

This file was deleted.

13 changes: 0 additions & 13 deletions requirements/testing/all.txt

This file was deleted.

12 changes: 0 additions & 12 deletions requirements/testing/extra.txt

This file was deleted.

9 changes: 0 additions & 9 deletions requirements/testing/flake8.txt

This file was deleted.

15 changes: 0 additions & 15 deletions requirements/testing/minver.txt

This file was deleted.

26 changes: 0 additions & 26 deletions requirements/testing/mypy.txt

This file was deleted.

6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ changedir = {tox_root}
commands =
python tools/stubtest.py
usedevelop = False
deps =
-r requirements/testing/mypy.txt
-r requirements/testing/all.txt
dependency_groups =
test
typing

0 comments on commit 559f825

Please sign in to comment.