8000 Port requirements to PEP735 · matplotlib/matplotlib@5803913 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5803913

Browse files
committed
Port requirements to PEP735
1 parent 7fd4c67 commit 5803913

File tree

17 files changed

+149
-160
lines changed
  • 17 files changed

    +149
    -160
    lines changed

    .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 & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -143,7 +143,7 @@ jobs:
    143143
    uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
    144144
    with:
    145145
    path: C:\cygwin\home\runneradmin\.cache\pip
    146-
    key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
    146+
    key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('pyproject.toml') }}
    147147
    restore-keys: ${{ matrix.os }}-py3.${{ matrix.python-minor-version }}-pip-
    148148

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

    .github/workflows/reviewdog.yml

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -51,7 +51,7 @@ jobs:
    5151
    python-version: '3.11'
    5252

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

    5656
    - name: Set up reviewdog
    5757
    uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893 # v1.3.9

    .github/workflows/tests.yml

    Lines changed: 6 additions & 10 deletions
    Original file line numberDiff line numberDiff line change
    @@ -50,12 +50,12 @@ jobs:
    5050
    - name-suffix: "(Minimum Versions)"
    5151
    os: ubuntu-22.04
    5252
    python-version: '3.11'
    53-
    extra-requirements: '-c requirements/testing/minver.txt'
    53+
    extra-requirements: 'python -m pip install --upgrade $PRE --group test-minver'
    5454
    delete-font-cache: true
    5555
    - os: ubuntu-22.04
    5656
    python-version: '3.11'
    5757
    CFLAGS: "-fno-lto" # Ensure that disabling LTO works.
    58-
    extra-requirements: '-r requirements/testing/extra.txt'
    58+
    extra-requirements: 'python -m pip install --upgrade $PRE --prefer-binary --group test-extra'
    5959
    - os: ubuntu-22.04-arm
    6060
    python-version: '3.12'
    6161
    - os: ubuntu-22.04
    @@ -170,15 +170,15 @@ jobs:
    170170
    if: startsWith(runner.os, 'Linux')
    171171
    with:
    172172
    path: ~/.cache/pip
    173-
    key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
    173+
    key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
    174174
    restore-keys: |
    175175
    ${{ matrix.os }}-py${{ matrix.python-version }}-pip-
    176176
    - name: Cache pip
    177177
    uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
    178178
    if: startsWith(runner.os, 'macOS')
    179179
    with:
    180180
    path: ~/Library/Caches/pip
    181-
    key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }}
    181+
    key: ${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
    182182
    restore-keys: |
    183183
    ${{ matrix.os }}-py${{ matrix.python-version }}-pip-
    184184
    - name: Cache ccache
    @@ -215,12 +215,8 @@ jobs:
    215215
    216216
    # Install dependencies from PyPI.
    217217
    # Preinstall build requirements to enable no-build-isolation builds.
    218-
    python -m pip install --upgrade $PRE \
    219-
    'contourpy>=1.0.1' cycler fonttools kiwisolver importlib_resources \
    220-
    packaging pillow 'pyparsing!=3.1.0' python-dateutil setuptools-scm \
    221-
    'meson-python>=0.13.1' 'pybind11>=2.13.2' \
    222-
    -r requirements/testing/all.txt \
    223-
    ${{ matrix.extra-requirements }}
    218+
    python -m pip install --upgrade $PRE --group build --group test
    219+
    ${{ matrix.extra-requirements }}
    224220
    225221
    # Install optional dependencies from PyPI.
    226222
    # 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 --group build --group test
    78+
    python -m pip install --prefer-binary --group test-extra
    7979
    displayName: 'Install dependencies with pip'
    8080
    8181
    - bash: |

    doc/devel/development_setup.rst

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -177,7 +177,7 @@ setup.
    177177

    178178
    Install the Python dependencies with ::
    179179

    180-
    pip install -r requirements/dev/dev-requirements.txt
    180+
    pip install --group dev
    181181

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

    doc/devel/release_guide.rst

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

    422422
    pip install matplotlib
    423-
    pip install -r requirements/doc/doc-requirements.txt
    423+
    pip install --group doc
    424424
    git checkout v3.7.0-doc
    425425
    git clean -xfd
    426426
    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
    @@ -396,17 +396,11 @@ Documentation dependencies
    396396
    Python
    397397
    ------
    398398

    399-
    The additional Python packages required to build the
    400-
    :ref:`documentation <documenting-matplotlib>` are listed in
    401-
    :file:`doc-requirements.txt` and can be installed using ::
    402-
    403-
    pip install -r requirements/doc/doc-requirements.txt
    404-
    405-
    The content of :file:`doc-requirements.txt` is also shown below:
    406-
    407-
    .. include:: ../../requirements/doc/doc-requirements.txt
    408-
    :literal:
    399+
    The additional Python packages required to build the :ref:`documentation
    400+
    <documenting-matplotlib>` are listed in :file:`pyproject.toml` and can be
    401+
    installed using ::
    409402

    403+
    pip install --group doc
    410404

    411405
    .. _doc-dependencies-external:
    412406

    pyproject.toml

    Lines changed: 126 additions & 17 deletions
    Original file line numberDiff line numberDiff line change
    @@ -24,10 +24,9 @@ classifiers=[
    2424

    2525
    # When updating the list of dependencies, add an api_changes/development
    2626
    # entry and also update the following places:
    27+
    # - the `build` and `test-minver` dependency groups below
    2728
    # - lib/matplotlib/__init__.py (matplotlib._check_versions())
    28-
    # - requirements/testing/minver.txt
    2929
    # - doc/devel/dependencies.rst
    30-
    # - .github/workflows/tests.yml
    3130
    # - environment.yml
    3231
    dependencies = [
    3332
    "contourpy >= 1.0.1",
    @@ -42,20 +41,6 @@ dependencies = [
    4241
    ]
    4342
    requires-python = ">=3.11"
    4443

    45-
    [project.optional-dependencies]
    46-
    # Should be a copy of the build dependencies below.
    47-
    dev = [
    48-
    "meson-python>=0.13.1,<0.17.0",
    49-
    "pybind11>=2.13.2,!=2.13.3",
    50-
    "setuptools_scm>=7",
    51-
    # Not required by us but setuptools_scm without a version, cso _if_
    52-
    # installed, then setuptools_scm 8 requires at least this version.
    53-
    # Unfortunately, we can't do a sort of minimum-if-installed dependency, so
    54-
    # we need to keep this for now until setuptools_scm _fully_ drops
    55-
    # setuptools.
    56-
    "setuptools>=64",
    57-
    ]
    58-
    5944
    [project.urls]
    6045
    "Homepage" = "https://matplotlib.org"
    6146
    "Download" = "https://matplotlib.org/stable/install/index.html"
    @@ -67,13 +52,137 @@ dev = [
    6752

    6853
    [build-system]
    6954
    build-backend = "mesonpy"
    70-
    # Also keep in sync with optional dependencies above.
    55+
    # Also keep in sync with dependency groups below.
    7156
    requires = [
    7257
    "meson-python>=0.13.1,<0.17.0",
    7358
    "pybind11>=2.13.2,!=2.13.3",
    7459
    "setuptools_scm>=7",
    7560
    ]
    7661

    62+
    [dependency-groups]
    63+
    build = [
    64+
    # Should be the same as `[project] dependencies` above.
    65+
    "contourpy >= 1.0.1",
    66+
    "cycler >= 0.10",
    67+
    "fonttools >= 4.22.0",
    68+
    "kiwisolver >= 1.3.1",
    69+
    "numpy >= 1.25",
    70+
    "packaging >= 20.0",
    71+
    "pillow >= 9",
    72+
    "pyparsing >= 3",
    73+
    "python-dateutil >= 2.7",
    74+
    75+
    # Should be the same as `[build-system] requires` above.
    76+
    "meson-python>=0.13.1,<0.17.0",
    77+
    "pybind11>=2.13.2,!=2.13.3",
    78+
    "setuptools_scm>=7",
    79+
    # Not required by us but setuptools_scm without a version, so _if_
    80+
    # installed, then setuptools_scm 8 requires at least this version.
    81+
    # Unfortunately, we can't do a sort of minimum-if-installed dependency, so
    82+
    # we need to keep this for now until setuptools_scm _fully_ drops
    83+
    # setuptools.
    84+
    "setuptools>=64",
    85+
    ]
    86+
    dev = [
    87+
    {include-group = "build"},
    88+
    {include-group = "doc"},
    89+
    {include-group = "test"},
    90+
    {include-group = "test-extra"},
    91+
    "ruff",
    92+
    ]
    93+
    # Requirements for building docs
    94+
    #
    95+
    # You will first need a matching Matplotlib installation
    96+
    # e.g (from the Matplotlib root directory)
    97+
    # pip install --graup build --no-build-isolation --editable .
    98+
    #
    99+
    # Install the documentation requirements with:
    100+
    # pip install --group doc
    101+
    #
    102+
    doc = [
    103+
    "sphinx>=5.1.0,!=6.1.2",
    104+
    "colorspacious",
    105+
    "ipython",
    106+
    "ipywidgets",
    107+
    "ipykernel",
    108+
    "numpydoc>=1.0",
    109+
    "pydata-sphinx-theme~=0.15.0",
    110+
    "mpl-sphinx-theme~=3.9.0",
    111+
    "pyyaml",
    112+
    "PyStemmer",
    113+
    "sphinxcontrib-svg2pdfconverter>=1.1.0",
    114+
    "sphinxcontrib-video>=0.2.1",
    115+
    "sphinx-copybutton",
    116+
    "sphinx-design",
    117+
    "sphinx-gallery[parallel]>=0.12.0",
    118+
    "sphinx-tags>=0.4.0",
    119+
    ]
    120+
    121+
    # pip requirements for all the CI builds
    122+
    test = [
    123+
    "black<24",
    124+
    "certifi",
    125+
    "coverage!=6.3",
    126+
    "psutil; sys_platform != 'cygwin'",
    127+
    "pytest!=4.6.0,!=5.4.0,!=8.1.0",
    128+
    "pytest-cov",
    129+
    "pytest-rerunfailures",
    130+
    "pytest-timeout",
    131+
    "pytest-xdist",
    132+
    "pytest-xvfb",
    133+
    "tornado",
    134+
    ]
    135+
    136+
    # Extra pip requirements
    137+
    test-extra = [
    138+
    "ipykernel",
    139+
    # jupyter/nbconvert#1970 for the 7.3 series exclusions
    140+
    "nbconvert[execute]!=6.0.0,!=6.0.1,!=7.3.0,!=7.3.1",
    141+
    "nbformat!=5.0.0,!=5.0.1",
    142+
    "pandas!=0.25.0",
    143+
    "pikepdf",
    144+
    "pytz",
    145+
    "pywin32; sys_platform == 'win32'",
    146+
    "xarray",
    147+
    ]
    148+
    149+
    # Extra pip requirements for the minimum-version CI run
    150+
    test-minver = [
    151+
    "contourpy==1.0.1",
    152+
    "cycler==0.10",
    153+
    "fonttools==4.22.0",
    154+
    "importlib-resources==3.2.0",
    155+
    "kiwisolver==1.3.2",
    156+
    "meson-python==0.13.1",
    157+
    "meson==1.1.0",
    158+
    "numpy==1.25.0",
    159+
    "packaging==20.0",
    160+
    "pillow==9.0.1",
    161+
    "pyparsing==3.0.0",
    162+
    "pytest==7.0.0",
    163+
    "python-dateutil==2.7",
    164+
    # Test ipython/matplotlib-inline before backend mapping moved to mpl.
    165+
    # This should be tested for a reasonably long transition period,
    166+
    # but we will eventually remove the test when we no longer support
    167+
    # ipython/matplotlib-inline versions from before the transition.
    168+
    "ipython==7.29.0",
    169+
    "ipykernel==5.5.6",
    170+
    10000 "matplotlib-inline<0.1.7",
    171+
    ]
    172+
    173+
    # Extra pip requirements for the GitHub Actions mypy build
    174+
    typing = [
    175+
    "mypy>=1.9",
    176+
    "typing-extensions>=4.6",
    177+
    # Extra stubs distributed separately from the main pypi package
    178+
    "pandas-stubs",
    179+
    "types-pillow",
    180+
    "types-python-dateutil",
    181+
    "types-psutil",
    182+
    "sphinx",
    183+
    {include-group = "build"},
    184+
    ]
    185+
    77186
    [tool.meson-python.args]
    78187
    install = ['--tags=data,python-runtime,runtime']
    79188

    requirements/dev/build-requirements.txt

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

    requirements/dev/dev-requirements.txt

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

    requirements/doc/doc-requirements.txt

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

    requirements/testing/all.txt

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

    requirements/testing/extra.txt

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

    0 commit comments

    Comments
     (0)
    0