diff --git a/.appveyor.yml b/.appveyor.yml index 2a641490520e..10109c9f80f7 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,7 +17,7 @@ skip_commits: clone_depth: 50 -image: Visual Studio 2019 +image: Visual Studio 2022 environment: @@ -28,17 +28,13 @@ environment: --cov-report= --cov=lib --log-level=DEBUG matrix: - - PYTHON_VERSION: "3.11" - TEST_ALL: "yes" + - PYTHON_VERSION: "3.12" # We always use a 64-bit machine, but can build x86 distributions # with the PYTHON_ARCH variable platform: - x64 -# all our python builds have to happen in tests_script... -build: false - cache: - '%LOCALAPPDATA%\pip\Cache' - '%USERPROFILE%\.cache\matplotlib' @@ -57,24 +53,26 @@ init: - micromamba info install: - - micromamba env create -f environment.yml python=%PYTHON_VERSION% pywin32 + - set EXTRA_PACKAGES=pywin32 codecov + # These are optional dependencies so that we don't skip so many tests... + - set EXTRA_PACKAGES=%EXTRA_PACKAGES% ffmpeg inkscape + # miktex is available on conda, but seems to fail with permission errors. + # missing packages on conda-forge for imagemagick + # This install sometimes failed randomly :-( + # - choco install imagemagick + + - micromamba env create -f environment.yml python=%PYTHON_VERSION% %EXTRA_PACKAGES% - micromamba activate mpl-dev -test_script: +build_script: # Now build the thing.. - set LINK=/LIBPATH:%cd%\lib - - pip install -v --no-build-isolation --config-settings=setup-args="--vsenv" --editable .[dev] + - pip install -v --no-build-isolation --editable .[dev] # this should show no freetype dll... - set "DUMPBIN=%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe" - '"%DUMPBIN%" /DEPENDENTS lib\matplotlib\ft2font*.pyd | findstr freetype.*.dll && exit /b 1 || exit /b 0' - # this are optional dependencies so that we don't skip so many tests... - - if x%TEST_ALL% == xyes micromamba install -q ffmpeg inkscape - # miktex is available on conda, but seems to fail with permission errors. - # missing packages on conda-forge for imagemagick - # This install sometimes failed randomly :-( - # - choco install imagemagick - +test_script: # Test import of tkagg backend - python -c "import matplotlib as m; m.use('tkagg'); @@ -90,11 +88,10 @@ artifacts: type: Zip on_finish: - - micromamba install codecov - - codecov -e PYTHON_VERSION PLATFORM -n "$PYTHON_VERSION Windows" + - codecov -e PYTHON_VERSION PLATFORM -n "%PYTHON_VERSION% Windows" on_failure: - # Generate a html for visual tests + # Generate an html for visual tests - python tools/visualize_tests.py --no-browser - echo zipping images after a failure... - 7z a result_images.zip result_images\ | grep -v "Compressing" diff --git a/.circleci/config.yml b/.circleci/config.yml index 40ba933cf0d9..85622ffa7013 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,7 @@ commands: fonts-install: steps: - restore_cache: - key: fonts-4 + key: fonts-5 - run: name: Install custom fonts command: | @@ -80,7 +80,7 @@ commands: -O ~/.local/share/fonts/xkcd-Script.ttf || true fc-cache -f -v - save_cache: - key: fonts-4 + key: fonts-5 paths: - ~/.local/share/fonts/ @@ -103,10 +103,10 @@ commands: - run: name: Install Python dependencies command: | - python -m pip install --user -r requirements/dev/build-requirements.txt + python -m pip install --user --group build python -m pip install --user \ numpy<< parameters.numpy_version >> \ - -r requirements/doc/doc-requirements.txt + --group doc python -m pip install --no-deps --user \ git+https://github.com/matplotlib/mpl-sphinx-theme.git @@ -125,7 +125,7 @@ commands: --no-build-isolation --editable .[dev] fi - save_cache: - key: build-deps-2 + key: build-deps-3 paths: - subprojects/packagecache diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000000..64263ec96b7b --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,36 @@ +--- +# clang-tidy configuration for matplotlib's src/ directory. +# +# Philosophy: enable checks that find real bugs (memory safety, undefined +# behaviour, security) and suppress checks that are high-noise style rules +# inappropriate for a C/C++ codebase that interfaces heavily with C APIs +# (CPython, FreeType, libagg) via pybind11. +# +# Run with: +# clang-tidy -p --config-file=src/.clang-tidy + +Checks: > + bugprone-*, + clang-analyzer-*, + objc-*, + performance-move-const-arg, + performance-move-constructor-init, + performance-no-automatic-move, + portability-*, + -bugprone-assignment-in-if-condition, + -bugprone-easily-swappable-parameters, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-macro-parentheses, + -bugprone-narrowing-conversions, + -bugprone-reserved-identifier, + -bugprone-throwing-static-initialization, + -clang-analyzer-optin.cplusplus.UninitializedObject, + -clang-analyzer-optin.performance.Padding, + +# Only report findings in matplotlib's own src/ headers, not in pybind11, +# Python.h, agg, or other vendored includes. +HeaderFilterRegex: '.*/matplotlib/src/.*' + +WarningsAsErrors: '' + +CheckOptions: [] diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 7297d72b5841..000000000000 --- a/.flake8 +++ /dev/null @@ -1,91 +0,0 @@ -[flake8] -max-line-length = 88 -select = - # flake8 default - D, E, F, W, -ignore = - # flake8 default - E121,E123,E126,E226,E24,E704,W503,W504, - # Additional ignores: - E127, E131, - E266, - E305, E306, - E741, - F841, - # pydocstyle - D100, D101, D102, D103, D104, D105, D106, - D200, D202, D204, D205, - D301, - D400, D401, D403, D404 - # ignored by pydocstyle numpy docstring convention - D107, D203, D212, D402, D413, D415, D416, D417, - # while D213 is ignored by the numpy docstring convention, it's left out above, - # because we want to enforce it. - -exclude = - .git - build - doc/gallery - doc/tutorials - # External files. - tools/gh_api.py - .tox - .eggs - -per-file-ignores = - lib/matplotlib/_cm.py: E202, E203, E302 - lib/matplotlib/_mathtext.py: E221 - lib/matplotlib/_mathtext_data.py: E203 - lib/matplotlib/backends/backend_template.py: F401 - lib/matplotlib/mathtext.py: E221 - lib/matplotlib/pylab.py: F401, F403 - lib/matplotlib/pyplot.py: F811 - lib/matplotlib/tests/test_mathtext.py: E501 - lib/matplotlib/transforms.py: E201, E202 - lib/matplotlib/tri/_triinterpolate.py: E201, E221 - lib/mpl_toolkits/axes_grid1/axes_size.py: E272 - lib/mpl_toolkits/axisartist/angle_helper.py: E221 - lib/mpl_toolkits/mplot3d/proj3d.py: E201 - - doc/conf.py: E402 - galleries/users_explain/quick_start.py: E402 - galleries/users_explain/artists/paths.py: E402 - galleries/users_explain/artists/patheffects_guide.py: E402 - galleries/users_explain/artists/transforms_tutorial.py: E402, E501 - galleries/users_explain/colors/colormaps.py: E501 - galleries/users_explain/colors/colors.py: E402 - galleries/tutorials/artists.py: E402 - galleries/users_explain/axes/constrainedlayout_guide.py: E402 - galleries/users_explain/axes/legend_guide.py: E402 - galleries/users_explain/axes/tight_layout_guide.py: E402 - galleries/users_explain/animations/animations.py: E501 - galleries/tutorials/images.py: E501 - galleries/tutorials/pyplot.py: E402, E501 - galleries/users_explain/text/annotations.py: E402, E501 - galleries/users_explain/text/mathtext.py: E501 - galleries/users_explain/text/text_intro.py: E402 - galleries/users_explain/text/text_props.py: E501 - - galleries/examples/animation/frame_grabbing_sgskip.py: E402 - galleries/examples/images_contours_and_fields/tricontour_demo.py: E201 - galleries/examples/images_contours_and_fields/tripcolor_demo.py: E201 - galleries/examples/images_contours_and_fields/triplot_demo.py: E201 - galleries/examples/lines_bars_and_markers/marker_reference.py: E402 - galleries/examples/misc/print_stdout_sgskip.py: E402 - galleries/examples/misc/table_demo.py: E201 - galleries/examples/style_sheets/bmh.py: E501 - galleries/examples/subplots_axes_and_figures/demo_constrained_layout.py: E402 - galleries/examples/text_labels_and_annotations/custom_legends.py: E402 - galleries/examples/ticks/date_concise_formatter.py: E402 - galleries/examples/ticks/date_formatters_locators.py: F401 - galleries/examples/user_interfaces/embedding_in_gtk3_panzoom_sgskip.py: E402 - galleries/examples/user_interfaces/embedding_in_gtk3_sgskip.py: E402 - galleries/examples/user_interfaces/embedding_in_gtk4_panzoom_sgskip.py: E402 - galleries/examples/user_interfaces/embedding_in_gtk4_sgskip.py: E402 - galleries/examples/user_interfaces/gtk3_spreadsheet_sgskip.py: E402 - galleries/examples/user_interfaces/gtk4_spreadsheet_sgskip.py: E402 - galleries/examples/user_interfaces/mpl_with_glade3_sgskip.py: E402 - galleries/examples/user_interfaces/pylab_with_gtk3_sgskip.py: E402 - galleries/examples/user_interfaces/pylab_with_gtk4_sgskip.py: E402 - galleries/examples/userdemo/pgf_preamble_sgskip.py: E402 -force-check = True diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 0a57a3989265..f3595d2b7865 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -17,7 +17,7 @@ body: description: >- If possible, please provide a minimum self-contained example. If you have used generative AI as an aid see - https://dev.matplotlib.org/devel/contributing.html#generative_ai. + https://matplotlib.org/devdocs/devel/contribute.html#restrictions-on-generative-ai-usage placeholder: Paste your code here. This field is automatically formatted as Python code. render: Python validations: @@ -82,6 +82,8 @@ body: options: - pip - conda + - pixi + - uv - Linux package manager - from source (.tar.gz) - git checkout diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index dc80f6d7c91d..635f11028226 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -7,5 +7,5 @@ contact_links: url: https://discourse.matplotlib.org about: If you have a usage question - name: Chat with devs - url: https://gitter.im/matplotlib/matplotlib + url: https://discourse.matplotlib.org/chat/c/matplotlib/2 about: Ask short questions about contributing to Matplotlib diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index dbf9e5f4ae22..e66cac52f9c9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,12 +14,14 @@ Additionally, please summarize the changes in the title, for example "Raise Valu non-numeric input to set_xlim" and avoid non-descriptive titles such as "Addresses issue #8576". -If possible, please provide a minimum self-contained example. If you have used -generative AI as an aid in preparing this PR, see -https://dev.matplotlib.org/devel/contributing.html#generative_ai. - +If possible, please provide a minimum self-contained example. --> +## AI Disclosure + ## PR checklist diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 34902e5236df..99449954866f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,27 @@ updates: directory: "/" schedule: interval: "weekly" + cooldown: + default-days: 7 groups: actions: patterns: - "*" + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + cooldown: + default-days: 7 + exclude-paths: + - "ci/minver-requirements.txt" + - package-ecosystem: "pre-commit" + directory: "/" + schedule: + interval: "monthly" + cooldown: + default-days: 7 + groups: + pre-commit: + patterns: + - "*" diff --git a/.github/labeler.yml b/.github/labeler.yml index 75adfed57f43..77b79146b47f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,7 +1,9 @@ --- "CI: Run cibuildwheel": - changed-files: - - any-glob-to-any-file: ['.github/workflows/cibuildwheel.yml'] + - any-glob-to-any-file: + - '.github/workflows/cibuildwheel.yml' + - '.github/workflows/wasm.yml' "CI: Run cygwin": - changed-files: - any-glob-to-any-file: ['.github/workflows/cygwin.yml'] diff --git a/.github/workflows/autoclose_comment.yml b/.github/workflows/autoclose_comment.yml new file mode 100644 index 000000000000..4d18d82a801f --- /dev/null +++ b/.github/workflows/autoclose_comment.yml @@ -0,0 +1,80 @@ +--- +name: autoclose comment +# Post comment on PRs when labeled with "status: autoclose candidate". +# Based on scikit-learn's autoclose bot at +# https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/autoclose-comment.yml + +permissions: + contents: read + pull-requests: write + +on: + pull_request_target: + types: + - labeled + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + +jobs: + post_comment: + name: post_comment + if: "${{ contains(github.event.label.name, 'status: autoclose candidate') }}" + runs-on: ubuntu-latest + + steps: + + - name: comment on potential autoclose + run: | + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/$GH_REPO/issues/$PULL_REQUEST_NUMBER/comments \ + -f "body=$BODY" + env: + BODY: > + ⏰ This pull request might be automatically closed in two weeks from now. + + + Thank you for your contribution to Matplotlib and for the effort you + have put into this PR. This pull request does not yet meet the + quality and clarity standards needed for an effective review. + Project maintainers have limited time for code reviews, and our goal + is to prioritize well-prepared contributions to keep Matplotlib + maintainable. + + + Matplotlib maintainers cannot provide one-to-one guidance on this PR. + However, if you ask focused, well-researched questions, a community + member may be willing to help. 💬 + + + To increase the chance of a productive review: + + - Use [the template provided in the PR + description](https://github.com/matplotlib/matplotlib/blob/main/.github/PULL_REQUEST_TEMPLATE.md) + and fill it out as completely as possible, especially the summary and AI Disclosure sections. + + - Make sure your PR conforms to our [PR + checklist](https://matplotlib.org/devdocs/devel/pr_guide.html#summary-for-pull-request-authors). + + + As the author, you are responsible for driving this PR, which entails doing + necessary background research as well as presenting its context and your + thought process. If you are a new contributor, or do not know how to + fulfill these requirements, we recommend that you familiarize + yourself with Matplotlib's + [development conventions](https://matplotlib.org/devdocs/devel/index.html) + or engage with the community via our [Discourse](https://discourse.matplotlib.org/) + or one of our [meetings](https://scientific-python.org/calendars/) + before submitting code. + + + If you substantially improve this PR within two weeks, leave a comment + and a team member may remove the `status: autoclose candidate` label and the + PR stays open. Cosmetic changes or incomplete fixes will not be + sufficient. Maintainers will assess improvements on their own + schedule. Please do not ping (`@`) maintainers. diff --git a/.github/workflows/autoclose_schedule.yml b/.github/workflows/autoclose_schedule.yml new file mode 100644 index 000000000000..a4eba770699c --- /dev/null +++ b/.github/workflows/autoclose_schedule.yml @@ -0,0 +1,36 @@ +--- +name: autoclose schedule +# Autoclose PRs labeled with "status: autoclose candidate" after 2 weeks. +# Based on scikit-learn's implementation at +# https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/autoclose-schedule.yml + +permissions: + contents: read + pull-requests: write + +on: + schedule: + - cron: '0 2 * * *' # runs daily at 02:00 UTC + workflow_dispatch: + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + + autoclose: + name: autoclose labeled PRs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.13' + - name: Install PyGithub + run: pip install -Uq PyGithub + + - name: Close PRs labeled more than 14 days ago + run: | + python tools/autoclose_prs.py diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c72ab67fd43c..36ec0e404f1f 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -18,8 +18,7 @@ on: - reopened - labeled -permissions: - contents: read +permissions: {} jobs: build_sdist: @@ -37,19 +36,21 @@ jobs: ) name: Build sdist runs-on: ubuntu-latest + permissions: + contents: read outputs: SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: false - - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 name: Install Python with: - python-version: '3.10' + python-version: '3.12' # Something changed somewhere that prevents the downloaded-at-build-time # licenses from being included in built wheels, so pre-download them so @@ -72,7 +73,7 @@ jobs: run: twine check dist/* - name: Upload sdist result - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: cibw-sdist path: dist/*.tar.gz @@ -93,6 +94,8 @@ jobs: ) needs: build_sdist name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }} + permissions: + contents: read runs-on: ${{ matrix.os }} env: CIBW_BEFORE_BUILD: >- @@ -130,20 +133,24 @@ jobs: cibw_archs: "AMD64" - os: windows-11-arm cibw_archs: "ARM64" - - os: macos-13 + - os: macos-15-intel cibw_archs: "x86_64" - os: macos-14 cibw_archs: "arm64" steps: - name: Download sdist - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: cibw-sdist path: dist/ + - name: Purge Strawberry Perl + if: startsWith(matrix.os, 'windows-') + run: Remove-Item -Recurse C:\Strawberry + - name: Build wheels for CPython 3.14 - uses: pypa/cibuildwheel@95d2f3a92fbf80abe066b09418bbf128a8923df2 # v3.0.1 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -153,7 +160,7 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 - name: Build wheels for CPython 3.13 - uses: pypa/cibuildwheel@95d2f3a92fbf80abe066b09418bbf128a8923df2 # v3.0.1 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -162,82 +169,15 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.12 - uses: pypa/cibuildwheel@95d2f3a92fbf80abe066b09418bbf128a8923df2 # v3.0.1 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: CIBW_BUILD: "cp312-*" CIBW_ARCHS: ${{ matrix.cibw_archs }} - - name: Build wheels for CPython 3.11 - uses: pypa/cibuildwheel@95d2f3a92fbf80abe066b09418bbf128a8923df2 # v3.0.1 - with: - package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} - env: - CIBW_BUILD: "cp311-*" - CIBW_ARCHS: ${{ matrix.cibw_archs }} - - - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@95d2f3a92fbf80abe066b09418bbf128a8923df2 # v3.0.1 - with: - package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} - env: - CIBW_BUILD: "cp310-*" - CIBW_ARCHS: ${{ matrix.cibw_archs }} - # Ignore because dependencies do not provide win-arm wheels on 3.10; should be removed on merge up - if: matrix.os != 'windows-11-arm' - - - name: Build wheels for PyPy 3.10 - uses: pypa/cibuildwheel@95d2f3a92fbf80abe066b09418bbf128a8923df2 # v3.0.1 - with: - package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} - env: - CIBW_BUILD: "pp310-*" - CIBW_ARCHS: ${{ matrix.cibw_archs }} - CIBW_ENABLE: pypy - if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest' && matrix.os != 'windows-11-arm' - - - name: Build wheels for PyPy 3.11 - uses: pypa/cibuildwheel@95d2f3a92fbf80abe066b09418bbf128a8923df2 # v3.0.1 - with: - package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} - env: - CIBW_BUILD: "pp311-*" - CIBW_ARCHS: ${{ matrix.cibw_archs }} - CIBW_ENABLE: pypy - if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest' && matrix.os != 'windows-11-arm' - - - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: cibw-wheels-${{ runner.os }}-${{ matrix.cibw_archs }} path: ./wheelhouse/*.whl if-no-files-found: error - - publish: - if: github.repository == 'matplotlib/matplotlib' && github.event_name == 'push' && github.ref_type == 'tag' - name: Upload release to PyPI - needs: [build_sdist, build_wheels] - runs-on: ubuntu-latest - environment: release - permissions: - id-token: write - attestations: write - contents: read - steps: - - name: Download packages - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - pattern: cibw-* - path: dist - merge-multiple: true - - - name: Print out packages - run: ls dist - - - name: Generate artifact attestation for sdist and wheel - uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 - with: - subject-path: dist/matplotlib-* - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3 diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index e0ed6adf4e65..49dc4ea3b3ec 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -1,6 +1,9 @@ --- name: "CircleCI artifact handling" on: [status] + +permissions: {} + jobs: circleci_artifacts_redirector_job: if: "${{ github.event.context == 'ci/circleci: docs-python3' }}" @@ -11,7 +14,7 @@ jobs: steps: - name: GitHub Action step uses: - scientific-python/circleci-artifacts-redirector-action@4e13a10d89177f4bfc8007a7064bdbeda848d8d1 # v1.0.0 + scientific-python/circleci-artifacts-redirector-action@5d358ff96e96429a5c64a969bb4a574555439f4f # v1.3.1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} api-token: ${{ secrets.CIRCLECI_TOKEN }} @@ -28,7 +31,7 @@ jobs: runs-on: ubuntu-latest name: Post warnings/errors as review steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false @@ -41,7 +44,7 @@ jobs: - name: Set up reviewdog if: "${{ steps.fetch-artifacts.outputs.count != 0 }}" - uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.0 + uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0 with: reviewdog_version: latest diff --git a/.github/workflows/clean_pr.yml b/.github/workflows/clean_pr.yml index fc9021c920c0..75f6a451c7ee 100644 --- a/.github/workflows/clean_pr.yml +++ b/.github/workflows/clean_pr.yml @@ -2,15 +2,16 @@ name: PR cleanliness on: [pull_request] -permissions: - contents: read +permissions: {} jobs: pr_clean: runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: '0' persist-credentials: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7a15de609834..3dc935180f6e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -10,6 +10,8 @@ on: schedule: - cron: '45 19 * * 1' +permissions: {} + jobs: analyze: if: github.repository == 'matplotlib/matplotlib' @@ -27,12 +29,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0 with: languages: ${{ matrix.language }} @@ -43,4 +45,4 @@ jobs: pip install --user -v . - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0 diff --git a/.github/workflows/conflictcheck.yml b/.github/workflows/conflictcheck.yml index c9aa036004e7..e353e47bfb79 100644 --- a/.github/workflows/conflictcheck.yml +++ b/.github/workflows/conflictcheck.yml @@ -9,6 +9,8 @@ on: pull_request_target: types: [synchronize] +permissions: {} + jobs: main: if: github.repository == 'matplotlib/matplotlib' @@ -17,7 +19,7 @@ jobs: pull-requests: write steps: - name: Check if PRs have merge conflicts - uses: eps1lon/actions-label-merge-conflict@1b1b1fcde06a9b3d089f3464c96417961dde1168 # v3.0.2 + uses: eps1lon/actions-label-merge-conflict@0273be72a0bbd58fcd71d0d6c02c209b50d1e5e1 # v3.1.0 with: dirtyLabel: "status: needs rebase" repoToken: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index bde902013412..8e970ea1120c 100644 --- a/.github/workflows/cygwin.yml +++ b/.github/workflows/cygwin.yml @@ -30,8 +30,7 @@ on: - cron: "47 5 * * 6" workflow_dispatch: -permissions: - contents: read +permissions: {} env: NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test. @@ -47,6 +46,8 @@ jobs: test-cygwin: runs-on: windows-latest + permissions: + contents: read name: Python 3.${{ matrix.python-minor-version }} on Cygwin # Enable these when Cygwin has Python 3.12. if: >- @@ -79,12 +80,12 @@ jobs: - name: Fix line endings run: git config --global core.autocrlf input - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: false - - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4 + - uses: cygwin/cygwin-install-action@711d29f3da23c9f4a1798e369a6f01198c13b11a # v6 with: packages: >- ccache gcc-g++ gdb git graphviz libcairo-devel libffi-devel @@ -140,21 +141,21 @@ jobs: # FreeType build fails with bash, succeeds with dash - name: Cache pip - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 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 - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: C:\cygwin\home\runneradmin\.ccache key: Cygwin-py3.${{ matrix.python-minor-version }}-ccache-${{ hashFiles('src/*') }} restore-keys: Cygwin-py3.${{ matrix.python-minor-version }}-ccache- - name: Cache Matplotlib - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | C:\cygwin\home\runneradmin\.cache\matplotlib @@ -174,15 +175,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 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 + python -m pip install --group build 'numpy>=1.25,<1.26' export PATH="/usr/local/bin:$PATH" - python -m pip install --no-build-isolation 'contourpy>=1.0.1' - python -m pip install --upgrade cycler fonttools \ - packaging pyparsing python-dateutil setuptools-scm \ - -r requirements_test.txt sphinx ipython + python -m pip install --upgrade --group test sphinx ipython python -m pip install --upgrade pycairo 'cairocffi>=0.8' PyGObject && python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' && echo 'PyGObject is available' || @@ -191,10 +186,6 @@ jobs: python -c 'import PyQt5.QtCore' && echo 'PyQt5 is available' || echo 'PyQt5 is not available' - python -mpip install --upgrade pyside2 && - python -c 'import PySide2.QtCore' && - echo 'PySide2 is available' || - echo 'PySide2 is not available' python -m pip uninstall --yes wxpython || echo 'wxPython already uninstalled' - name: Install Matplotlib diff --git a/.github/workflows/do_not_merge.yml b/.github/workflows/do_not_merge.yml index d8664df9ba9a..0c263623942b 100644 --- a/.github/workflows/do_not_merge.yml +++ b/.github/workflows/do_not_merge.yml @@ -15,7 +15,8 @@ jobs: env: has_tag: >- ${{contains(github.event.pull_request.labels.*.name, 'status: needs comment/discussion') || - contains(github.event.pull_request.labels.*.name, 'status: waiting for other PR')}} + contains(github.event.pull_request.labels.*.name, 'status: waiting for other PR') || + contains(github.event.pull_request.labels.*.name, 'DO NOT MERGE') }} steps: - name: Check for label if: ${{'true' == env.has_tag}} @@ -23,6 +24,7 @@ jobs: echo "This PR cannot be merged because it has one of the following labels: " echo "* status: needs comment/discussion" echo "* status: waiting for other PR" + echo "* DO NOT MERGE" exit 1 - name: Allow merging if: ${{'false' == env.has_tag}} diff --git a/.github/workflows/good-first-issue.yml b/.github/workflows/good-first-issue.yml index cc15717e3351..6543f05a0837 100644 --- a/.github/workflows/good-first-issue.yml +++ b/.github/workflows/good-first-issue.yml @@ -4,6 +4,9 @@ on: issues: types: - labeled + +permissions: {} + jobs: add-comment: if: github.event.label.name == 'Good first issue' @@ -12,19 +15,22 @@ jobs: issues: write steps: - name: Add comment - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 with: issue-number: ${{ github.event.issue.number }} body: | ### Good first issue - notes for new contributors - This issue is suited to new contributors because it does not require understanding of the - Matplotlib internals. To get started, please see our [contributing - guide](https://matplotlib.org/stable/devel/index). + This issue is suited to new contributors because it does not require + understanding of the Matplotlib internals. This is a non-urgent task + intended for human contributors to learn how to contribute; therefore please + do not try to automate a solution using AI. To get started, please see our + [contributing guide](https://matplotlib.org/stable/devel/index). - **We do not assign issues**. Check the *Development* section in the sidebar for linked pull - requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please - collaborate on the work by reviewing it rather than duplicating it in a competing PR. + **We do not assign issues**. Check the *Development* section in the sidebar + for linked pull requests (PRs). If there are none, feel free to start + working on it. If there is an open PR, please collaborate on the work by + reviewing it rather than duplicating it in a competing PR. If something is unclear, please reach out on any of our [communication channels](https://matplotlib.org/stable/devel/contributing.html#get-connected). diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 8e2002353164..600e7fc34a95 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -3,6 +3,8 @@ name: "Pull Request Labeler" on: - pull_request_target +permissions: {} + jobs: labeler: permissions: @@ -10,6 +12,6 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 + - uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6.1.0 with: sync-labels: true diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 000000000000..407ac44258c0 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,135 @@ +--- +name: Linting +on: [pull_request] + +permissions: {} + +jobs: + pre-commit: + name: precommit + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: "3.x" + - uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # v2.0.4 + with: + extra-args: --hook-stage manual --all-files + + ruff: + name: ruff + runs-on: ubuntu-latest + permissions: + contents: read + checks: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set up Python 3 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.12' + + - name: Install ruff + run: pip3 install ruff + + - name: Set up reviewdog + uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0 + + - name: Run ruff + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -o pipefail + ruff check --output-format rdjson | \ + reviewdog -f=rdjson \ + -tee -reporter=github-check -filter-mode nofilter + mypy: + name: mypy + runs-on: ubuntu-latest + permissions: + contents: read + checks: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set up Python 3 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.12' + + - name: Install mypy + run: pip3 install --group build --group typing + + - name: Set up reviewdog + uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0 + + - name: Run mypy + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -o pipefail + mypy --config pyproject.toml | \ + reviewdog -f=mypy -name=mypy \ + -tee -reporter=github-check -filter-mode nofilter + + + clang-tidy: + name: clang-tidy (macOS / Objective-C) + runs-on: macos-latest # run on macOS so we can lint the objectiveC file + permissions: + contents: read + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set up Python 3 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.14' + + - name: Install OS dependencies + run: brew install llvm + + - name: Install build dependencies + run: pip3 install meson ninja pybind11 setuptools-scm + + - name: Run clang-tidy + run: | + set -o pipefail + LLVM_PREFIX=$(brew --prefix llvm) + export CC=$LLVM_PREFIX/bin/clang + export CXX=$LLVM_PREFIX/bin/clang++ + export OBJC=$LLVM_PREFIX/bin/clang + export PATH=$LLVM_PREFIX/bin:$PATH + python tools/run_clang_tidy.py + + eslint: + name: eslint + runs-on: ubuntu-latest + permissions: + contents: read + checks: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: eslint + uses: reviewdog/action-eslint@556a3fdaf8b4201d4d74d406013386aa4f7dab96 # v1.34.0 + with: + filter_mode: nofilter + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-check + workdir: 'lib/matplotlib/backends/web_backend/' diff --git a/.github/workflows/mypy-stubtest.yml b/.github/workflows/mypy-stubtest.yml index 57acc3616ae6..da3ff7610901 100644 --- a/.github/workflows/mypy-stubtest.yml +++ b/.github/workflows/mypy-stubtest.yml @@ -2,27 +2,27 @@ name: Mypy Stubtest on: [pull_request] -permissions: - contents: read +permissions: {} jobs: mypy-stubtest: name: mypy-stubtest runs-on: ubuntu-latest permissions: + contents: read checks: write steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Python 3 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: - python-version: '3.10' + python-version: '3.12' - name: Set up reviewdog - uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9 + uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0 - name: Install tox run: python -m pip install tox @@ -33,7 +33,7 @@ jobs: run: | set -o pipefail tox -e stubtest | \ - sed -e "s!.tox/stubtest/lib/python3.10/site-packages!lib!g" | \ + sed -e "s!.tox/stubtest/lib/python3.12/site-packages!lib!g" | \ reviewdog \ -efm '%Eerror: %m' \ -efm '%CStub: in file %f:%l' \ diff --git a/.github/workflows/nightlies.yml b/.github/workflows/nightlies.yml index 25e2bb344eda..47d1de50781c 100644 --- a/.github/workflows/nightlies.yml +++ b/.github/workflows/nightlies.yml @@ -8,8 +8,7 @@ on: # Run on demand with workflow dispatch workflow_dispatch: -permissions: - actions: read +permissions: {} jobs: upload_nightly_wheels: @@ -21,6 +20,8 @@ jobs: # to work in subsequent jobs. # https://github.com/mamba-org/setup-micromamba#about-login-shells shell: bash -e -l {0} + permissions: + actions: read if: github.repository_owner == 'matplotlib' steps: @@ -31,35 +32,35 @@ jobs: run: | PROJECT_REPO="matplotlib/matplotlib" BRANCH="main" - WORKFLOW_NAME="cibuildwheel.yml" ARTIFACT_PATTERN="cibw-wheels-*" - gh run --repo "${PROJECT_REPO}" \ - list --branch "${BRANCH}" \ - --workflow "${WORKFLOW_NAME}" \ - --json event,status,conclusion,databaseId > runs.json - RUN_ID=$( - jq --compact-output \ - '[ - .[] | - # Filter on "push" events to main (merged PRs) ... - select(.event == "push") | - # that have completed successfully ... - select(.status == "completed" and .conclusion == "success") - ] | - # and get ID of latest build of wheels. - sort_by(.databaseId) | reverse | .[0].databaseId' runs.json - ) - gh run --repo "${PROJECT_REPO}" view "${RUN_ID}" - gh run --repo "${PROJECT_REPO}" \ - download "${RUN_ID}" --pattern "${ARTIFACT_PATTERN}" + for WORKFLOW_NAME in cibuildwheel.yml wasm.yml; do + gh run --repo "${PROJECT_REPO}" \ + list --branch "${BRANCH}" \ + --workflow "${WORKFLOW_NAME}" \ + --json event,status,conclusion,databaseId > runs.json + RUN_ID=$( + jq --compact-output \ + '[ + .[] | + # Filter on "push" events to main (merged PRs) ... + select(.event == "push") | + # that have completed successfully ... + select(.status == "completed" and .conclusion == "success") + ] | + # and get ID of latest build of wheels. + sort_by(.databaseId) | reverse | .[0].databaseId' runs.json + ) + gh run --repo "${PROJECT_REPO}" view "${RUN_ID}" + gh run --repo "${PROJECT_REPO}" download "${RUN_ID}" --pattern "${ARTIFACT_PATTERN}" + done mkdir dist mv ${ARTIFACT_PATTERN}/*.whl dist/ ls -l dist/ - name: Upload wheels to Anaconda Cloud as nightlies - uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1 + uses: scientific-python/upload-nightly-action@e76cfec8a4611fd02808a801b0ff5a7d7c1b2d99 # 0.6.4 with: artifacts_path: dist anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} diff --git a/.github/workflows/pr_welcome.yml b/.github/workflows/pr_welcome.yml index 3bb172ca70e7..6ef640c77014 100644 --- a/.github/workflows/pr_welcome.yml +++ b/.github/workflows/pr_welcome.yml @@ -1,37 +1,52 @@ --- name: PR Greetings -on: [pull_request_target] +on: + pull_request_target: + types: opened + issues: + types: opened + +permissions: {} jobs: greeting: runs-on: ubuntu-latest permissions: + issues: write pull-requests: write steps: - - uses: actions/first-interaction@34f15e814fe48ac9312ccf29db4e74fa767cbab7 # v1.3.0 + - uses: plbstl/first-contribution@fa732d1b5586da1a72ba34290a32e87467a59b78 # v4.3.2 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - pr-message: >+ + labels: first-contribution + skip-internal-contributors: false + pr-opened-msg: >+ Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall - through the cracks. + through the cracks. We also ask that you please finish addressing + any review comments on this PR and wait for it to be merged (or + closed) before opening a new one, as it can be a valuable learning + experience to go through the review process. - You can also join us [on - gitter](https://gitter.im/matplotlib/matplotlib) for real-time - discussion. + You can also join us [on discourse + chat](https://discourse.matplotlib.org/chat/c/matplotlib/2) for + real-time discussion. For details on testing, writing docs, and our review process, please see [the developer - guide](https://matplotlib.org/devdocs/devel/index.html) + guide](https://matplotlib.org/devdocs/devel/index.html). + + **Please let us know if (and how) you use AI, it will help us give you + better feedback on your PR.** We strive to be a welcoming and open project. Please follow our [Code of Conduct](https://github.com/matplotlib/matplotlib/blob/main/CODE_OF_CONDUCT.md). + issue-opened-msg: "" diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml deleted file mode 100644 index 24980f7a075b..000000000000 --- a/.github/workflows/reviewdog.yml +++ /dev/null @@ -1,85 +0,0 @@ ---- -name: Linting -on: [pull_request] - -permissions: - contents: read - -jobs: - flake8: - name: flake8 - runs-on: ubuntu-latest - permissions: - checks: write - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - - name: Set up Python 3 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 - with: - python-version: '3.10' - - - name: Install flake8 - run: pip3 install -r requirements/testing/flake8.txt - - - name: Set up reviewdog - uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9 - - - name: Run flake8 - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -o pipefail - flake8 --docstring-convention=all | \ - reviewdog -f=pep8 -name=flake8 \ - -tee -reporter=github-check -filter-mode nofilter - mypy: - name: mypy - runs-on: ubuntu-latest - permissions: - checks: write - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - - name: Set up Python 3 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 - with: - python-version: '3.10' - - - name: Install mypy - run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt - - - name: Set up reviewdog - uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9 - - - name: Run mypy - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -o pipefail - mypy --config pyproject.toml | \ - reviewdog -f=mypy -name=mypy \ - -tee -reporter=github-check -filter-mode nofilter - - - eslint: - name: eslint - runs-on: ubuntu-latest - permissions: - checks: write - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - - - name: eslint - uses: reviewdog/action-eslint@9b5b0150e399e1f007ee3c27bc156549810a64e3 # v1.33.0 - with: - filter_mode: nofilter - github_token: ${{ secrets.GITHUB_TOKEN }} - reporter: github-check - workdir: 'lib/matplotlib/backends/web_backend/' diff --git a/.github/workflows/stale-tidy.yml b/.github/workflows/stale-tidy.yml index ab16c9f1fa1c..e7d8272bdf24 100644 --- a/.github/workflows/stale-tidy.yml +++ b/.github/workflows/stale-tidy.yml @@ -4,12 +4,16 @@ on: schedule: - cron: '30 1 * * 2,4,6' +permissions: {} + jobs: stale: if: github.repository == 'matplotlib/matplotlib' runs-on: ubuntu-latest + permissions: + issues: write steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + - uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 300 @@ -20,5 +24,5 @@ jobs: close-issue-label: "status: closed as inactive" days-before-issue-close: 30 ascending: true - exempt-issue-labels: "keep" + exempt-issue-labels: "keep,status: confirmed bug" exempt-pr-labels: "keep,status: orphaned PR" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 4dc964a0ea73..4ebcdcee1f31 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -2,14 +2,19 @@ name: 'Label inactive PRs' on: schedule: - - cron: '30 1 * * 1,3,5' + - cron: '30 1 * * 1' + +permissions: {} jobs: stale: if: github.repository == 'matplotlib/matplotlib' runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + - uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 20 @@ -36,3 +41,4 @@ jobs: ascending: true exempt-issue-labels: "keep" exempt-pr-labels: "keep,status: orphaned PR" + sort-by: updated diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ea402d954137..6656f62b7091 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,8 @@ on: - cron: "47 5 * * 6" workflow_dispatch: +permissions: {} + env: NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test. OPENBLAS_NUM_THREADS: 1 @@ -49,76 +51,53 @@ jobs: include: - name-suffix: "(Minimum Versions)" os: ubuntu-22.04 - python-version: '3.10' - extra-requirements: '-c requirements/testing/minver.txt' + python-version: '3.12' + extra-requirements: '-c ci/minver-requirements.txt' delete-font-cache: true - # Oldest versions with Py3.10 wheels. - pyqt5-ver: '==5.15.5 sip==6.3.0' - pyqt6-ver: '==6.2.0 PyQt6-Qt6==6.2.0' - pyside2-ver: '==5.15.2.1' - pyside6-ver: '==6.2.0' - - os: ubuntu-22.04 - python-version: '3.11' - CFLAGS: "-fno-lto" # Ensure that disabling LTO works. - # https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html - 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' + # https://github.com/matplotlib/matplotlib/issues/29844 + pygobject-ver: '<3.52.0' - os: ubuntu-22.04 python-version: '3.12' - # https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html - pyqt6-ver: '!=6.6.0' - # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 - pyside6-ver: '!=6.5.1' - - os: ubuntu-22.04 + CFLAGS: "-fno-lto" # Ensure that disabling LTO works. + extra-requirements: '--group test-extra' + # https://github.com/matplotlib/matplotlib/issues/29844 + pygobject-ver: '<3.52.0' + - name-suffix: "(Extra TeX packages)" + os: ubuntu-22.04 python-version: '3.13' - # https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html - pyqt6-ver: '!=6.6.0' - # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 - pyside6-ver: '!=6.5.1' + extra-packages: 'texlive-fonts-extra texlive-lang-cyrillic' + # https://github.com/matplotlib/matplotlib/issues/29844 + pygobject-ver: '<3.52.0' - name-suffix: "Free-threaded" os: ubuntu-22.04 python-version: '3.13t' - # https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html - pyqt6-ver: '!=6.6.0' - # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 - pyside6-ver: '!=6.5.1' - - os: macos-14 # This runner is on M1 (arm64) chips. - python-version: '3.10' - # https://github.com/matplotlib/matplotlib/issues/29732 + # https://github.com/matplotlib/matplotlib/issues/29844 pygobject-ver: '<3.52.0' - # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 - pyside6-ver: '!=6.5.1' + - os: ubuntu-24.04 + python-version: '3.14' + - os: ubuntu-24.04-arm + python-version: '3.12' - os: macos-14 # This runner is on M1 (arm64) chips. python-version: '3.12' # https://github.com/matplotlib/matplotlib/issues/29732 pygobject-ver: '<3.52.0' - # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 - pyside6-ver: '!=6.5.1' - os: macos-15 # This runner is on M1 (arm64) chips. python-version: '3.13' # https://github.com/matplotlib/matplotlib/issues/29732 pygobject-ver: '<3.52.0' - # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 - pyside6-ver: '!=6.5.1' + - os: macos-15 # This runner is on M1 (arm64) chips. + python-version: '3.14' + # https://github.com/matplotlib/matplotlib/issues/29732 + pygobject-ver: '<3.52.0' steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: false - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 - if: matrix.python-version != '3.13t' - with: - python-version: ${{ matrix.python-version }} - allow-prereleases: true - - - name: Set up Python ${{ matrix.python-version }} - uses: Quansight-Labs/setup-python@b9ab292c751a42bcd2bb465b7fa202ea2c3f5796 # v5.3.1 - if: matrix.python-version == '3.13t' + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -133,12 +112,12 @@ jobs: ccache \ cm-super \ dvipng \ - ffmpeg \ fonts-freefont-otf \ fonts-noto-cjk \ fonts-wqy-zenhei \ gdb \ gir1.2-gtk-3.0 \ + gir1.2-gtk-4.0 \ graphviz \ inkscape \ language-pack-de \ @@ -147,7 +126,6 @@ jobs: libcairo2-dev \ libffi-dev \ libgeos-dev \ - libgirepository1.0-dev \ libnotify4 \ libsdl2-2.0-0 \ libxkbcommon-x11-0 \ @@ -168,8 +146,18 @@ jobs: texlive-latex-recommended \ texlive-luatex \ texlive-pictures \ - texlive-xetex - sudo apt-get install -yy --no-install-recommends gir1.2-gtk-4.0 + texlive-xetex \ + ${{ matrix.extra-packages }} + if [[ "${{ matrix.name-suffix }}" != '(Minimum Versions)' ]]; then + sudo apt-get install -yy --no-install-recommends ffmpeg poppler-utils + fi + if [[ "${{ matrix.os }}" = ubuntu-22.04 ]]; then + sudo apt-get install -yy --no-install-recommends \ + libgirepository1.0-dev + else # ubuntu-24.04 + sudo apt-get install -yy --no-install-recommends \ + libgirepository-2.0-dev + fi ;; macOS) brew update @@ -186,29 +174,31 @@ jobs: done # Workaround for https://github.com/actions/runner-images/issues/10984 brew uninstall --ignore-dependencies --force pkg-config@0.29.2 - brew install ccache ghostscript gobject-introspection gtk4 ninja - brew install --cask font-noto-sans-cjk inkscape + brew install ccache ffmpeg ghostscript gobject-introspection gtk4 imagemagick ninja + brew install --cask font-noto-sans-cjk font-noto-sans-cjk-sc inkscape ;; esac - name: Cache pip - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 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', 'ci/minver-requirements.txt') }} restore-keys: | ${{ matrix.os }}-py${{ matrix.python-version }}-pip- - name: Cache pip - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 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 - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | ~/.ccache @@ -216,16 +206,16 @@ jobs: restore-keys: | ${{ matrix.os }}-py${{ matrix.python-version }}-ccache- - name: Cache Matplotlib - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | ~/.cache/matplotlib !~/.cache/matplotlib/tex.cache !~/.cache/matplotlib/test_cache - key: 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}-${{ github.sha }} + key: 6-${{ matrix.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}-${{ github.sha }} restore-keys: | - 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}- - 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl- + 6-${{ matrix.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}- + 6-${{ matrix.os }}-py${{ matrix.python-version }}-mpl- - name: Install Python dependencies run: | @@ -241,12 +231,8 @@ 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 \ - ${{ matrix.extra-requirements }} + python -m pip install --upgrade $PRE --prefer-binary \ + --group build --group test ${{ matrix.extra-requirements }} # Install optional dependencies from PyPI. # Sphinx is needed to run sphinxext tests @@ -268,30 +254,23 @@ jobs: echo 'PyGObject 3 is available' || echo 'PyGObject 3 is not available' ) - python -mpip install --upgrade pyqt5${{ matrix.pyqt5-ver }} && - python -c 'import PyQt5.QtCore' && - echo 'PyQt5 is available' || - echo 'PyQt5 is not available' - # Even though PySide2 wheels can be installed on Python 3.12+, they are broken and since PySide2 is - # deprecated, they are unlikely to be fixed. For the same deprecation reason, there are no wheels - # on M1 macOS, so don't bother there either. - if [[ "${{ matrix.os }}" != 'macos-14' - && "${{ matrix.python-version }}" != '3.12' && "${{ matrix.python-version }}" != '3.13' ]]; then - python -mpip install --upgrade pyside2${{ matrix.pyside2-ver }} && - python -c 'import PySide2.QtCore' && - echo 'PySide2 is available' || - echo 'PySide2 is not available' + # PyQt5 does not have any wheels for ARM on Linux. + if [[ "${{ matrix.os }}" != 'ubuntu-24.04-arm' ]]; then + python -mpip install --upgrade --only-binary :all: pyqt5 && + python -c 'import PyQt5.QtCore' && + echo 'PyQt5 is available' || + echo 'PyQt5 is not available' fi - python -mpip install --upgrade pyqt6${{ matrix.pyqt6-ver }} && + python -mpip install --upgrade --only-binary :all: pyqt6 && python -c 'import PyQt6.QtCore' && echo 'PyQt6 is available' || echo 'PyQt6 is not available' - python -mpip install --upgrade pyside6${{ matrix.pyside6-ver }} && + python -mpip install --upgrade --only-binary :all: pyside6 && python -c 'import PySide6.QtCore' && echo 'PySide6 is available' || echo 'PySide6 is not available' - python -mpip install --upgrade \ + python -mpip install --upgrade --only-binary :all: \ -f "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/${{ matrix.os }}" \ wxPython && python -c 'import wx' && @@ -348,32 +327,29 @@ jobs: - name: Cleanup non-failed image files if: failure() run: | - function remove_files() { - local extension=$1 - find ./result_images -type f -name "*-expected*.$extension" | while read file; do - if [[ $file == *"-expected_pdf"* ]]; then - base=${file%-expected_pdf.$extension}_pdf - elif [[ $file == *"-expected_eps"* ]]; then - base=${file%-expected_eps.$extension}_eps - elif [[ $file == *"-expected_svg"* ]]; then - base=${file%-expected_svg.$extension}_svg - else - base=${file%-expected.$extension} - fi - if [[ ! -e "${base}-failed-diff.$extension" ]]; then - if [[ -e "$file" ]]; then - rm "$file" - echo "Removed $file" - fi - if [[ -e "${base}.$extension" ]]; then - rm "${base}.$extension" - echo " Removed ${base}.$extension" - fi - fi + find ./result_images -name "*-expected*.png" | while read file; do + if [[ $file == *-expected_???.png ]]; then + extension=${file: -7:3} + base=${file%*-expected_$extension.png}_$extension + else + extension="png" + base=${file%-expected.png} + fi + if [[ ! -e ${base}-failed-diff.png ]]; then + indent="" + list=($file $base.png) + if [[ $extension != "png" ]]; then + list+=(${base%_$extension}-expected.$extension ${base%_$extension}.$extension) + fi + for to_remove in "${list[@]}"; do + if [[ -e $to_remove ]]; then + rm $to_remove + echo "${indent}Removed $to_remove" + fi + indent+=" " done - } - - remove_files "png"; remove_files "svg"; remove_files "pdf"; remove_files "eps"; + fi + done if [ "$(find ./result_images -mindepth 1 -type d)" ]; then find ./result_images/* -type d -empty -delete @@ -383,11 +359,18 @@ jobs: if: ${{ !cancelled() && github.event_name != 'schedule' }} run: | if [[ "${{ runner.os }}" != 'macOS' ]]; then - lcov --rc lcov_branch_coverage=1 --capture --directory . \ + LCOV_IGNORE_ERRORS=',' # do not ignore any lcov errors by default + if [[ "${{ matrix.os }}" = ubuntu-24.04 || "${{ matrix.os }}" = ubuntu-24.04-arm ]]; then + # filter mismatch errors detected by lcov 2.x + LCOV_IGNORE_ERRORS='mismatch' + fi + lcov --rc lcov_branch_coverage=1 --ignore-errors $LCOV_IGNORE_ERRORS \ + --capture --directory . --exclude $PWD/subprojects --exclude $PWD/build \ --output-file coverage.info - lcov --rc lcov_branch_coverage=1 --output-file coverage.info \ - --extract coverage.info $PWD/src/'*' $PWD/lib/'*' - lcov --rc lcov_branch_coverage=1 --list coverage.info + lcov --rc lcov_branch_coverage=1 --ignore-errors $LCOV_IGNORE_ERRORS \ + --output-file coverage.info --extract coverage.info $PWD/src/'*' + lcov --rc lcov_branch_coverage=1 --ignore-errors $LCOV_IGNORE_ERRORS \ + --list coverage.info find . -name '*.gc*' -delete else xcrun llvm-profdata merge -sparse default.*.profraw \ @@ -397,12 +380,12 @@ jobs: fi - name: Upload code coverage if: ${{ !cancelled() && github.event_name != 'schedule' }} - uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1 + uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }}" token: ${{ secrets.CODECOV_TOKEN }} - - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 if: failure() with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }} result images" @@ -419,7 +402,7 @@ jobs: steps: - name: Create issue on failure - uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd # v3.4.4 + uses: imjohnbo/issue-bot@3188c6ce06249206709d3b1f274d0d4c5a521601 # v3.4.5 with: title: "[TST] Upcoming dependency test failures" body: | diff --git a/.github/workflows/triage_board.yml b/.github/workflows/triage_board.yml new file mode 100644 index 000000000000..3ef26369afeb --- /dev/null +++ b/.github/workflows/triage_board.yml @@ -0,0 +1,24 @@ +--- +name: 'Update PR Triage Board' + +on: + schedule: + - cron: '0 * * * *' # Run every hour + workflow_dispatch: + +permissions: {} + +jobs: + pr-triage: + if: github.repository == 'matplotlib/matplotlib' + runs-on: ubuntu-latest + steps: + - name: Update PR Triage Board + uses: jupyter/pr-triage-board-bot@dae1209c73e70224b2f2955590d0698832a5a076 # main @ Oct 26, 2025 + with: + organization: 'matplotlib' + project-number: '11' + gh-app-id: '3339145' + gh-app-installation-id: '122963236' + gh-app-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} + repositories: 'matplotlib' diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml new file mode 100644 index 000000000000..e1668d99af60 --- /dev/null +++ b/.github/workflows/wasm.yml @@ -0,0 +1,63 @@ +--- +name: Build wasm wheels + +on: + # Save CI by only running this on release branches or tags. + push: + branches: + - main + - v[0-9]+.[0-9]+.x + tags: + - v* + # Also allow running this action on PRs if requested by applying the + # "Run cibuildwheel" label. + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + +permissions: + contents: read + +jobs: + build_wasm: + if: >- + ( + github.event_name == 'push' || + github.event_name == 'pull_request' && ( + ( + github.event.action == 'labeled' && + github.event.label.name == 'CI: Run cibuildwheel' + ) || + contains(github.event.pull_request.labels.*.name, + 'CI: Run cibuildwheel') + ) + ) + name: Build wasm + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + name: Install Python + with: + python-version: '3.13' + + - name: Build wheels for wasm + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 + env: + CIBW_BUILD: "cp312-*" + CIBW_PLATFORM: "pyodide" + CIBW_TEST_COMMAND: "true" + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: cibw-wheels-wasm + path: ./wheelhouse/*.whl + if-no-files-found: error diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 000000000000..f6e77b3d6000 --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,30 @@ +--- +name: zizmor + +on: + push: + branches: [main, v*.x] + pull_request: + branches: [main] + schedule: + - cron: '45 19 * * 1' + +permissions: {} + +jobs: + zizmor: + name: zizmor + if: github.repository == 'matplotlib/matplotlib' + runs-on: ubuntu-latest + permissions: + security-events: write + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Run zizmor + uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6 diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 000000000000..ce9c30c01dbd --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,19 @@ +--- +rules: + dangerous-triggers: + ignore: + # These workflows use pull_request_target solely to obtain write access + # for API operations (labeling, commenting) on fork PRs. None of them + # check out or execute any PR-supplied code. + - autoclose_comment.yml:11 + - conflictcheck.yml:3 + - labeler.yml:3 + - pr_welcome.yml:4 + cache-poisoning: + ignore: + # cygwin.yml is a test-only workflow; no artifacts are published. + # This is triggering a low-confidence flag that the workflow_dispatch: + # trigger may imply artifact publishing + - cygwin.yml:144:9 + - cygwin.yml:151:9 + - cygwin.yml:158:9 diff --git a/.gitignore b/.gitignore index b6f9e1ee74f4..0460152a792f 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ pip-wheel-metadata/* .tox # build subproject files subprojects/*/ +subprojects/.* !subprojects/packagefiles/ # OS generated files # @@ -103,6 +104,20 @@ __conda_version__.txt lib/png.lib lib/z.lib +# uv files # +############ +uv.lock + +# Environments # +################ +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + # Jupyter files # ################# diff --git a/.mailmap b/.mailmap index 44005da6e2d8..ad81a9f91430 100644 --- a/.mailmap +++ b/.mailmap @@ -1,8 +1,22 @@ +34j <34j.github@proton.me> <55338215+34j@users.noreply.github.com> + +Aasma Gupta AASMA GUPTA + +Adam Ormondroyd +Adam Ormondroyd <52655393+AdamOrmondroyd@users.noreply.github.com> + Adam Ortiz +Aditi Gautam <72432016+agautam478@users.noreply.github.com> + +Aditya Singh +Aditya Singh + Adrien F. Vincent Adrien F. Vincent +ALBIN BABU VARGHESE + Aleksey Bilogur Alexander Rudy @@ -11,12 +25,35 @@ Alon Hershenhorn Alvaro Sanchez +Aman Kushwaha + +Amisha Mehta +Amisha Mehta <115501608+amishamehta99@users.noreply.github.com> + +Ananya Devarakonda +Ananya Devarakonda <57040724+ananya314@users.noreply.github.com> + +Andreas C Mueller Andreas Mueller + +Andrés Gutierrez <12andresgutierrez04@gmail.com> + Andrew Dawson +Andrew Fennell + +Andrew Kim <110536383+aseriesof-tubes@users.noreply.github.com> dohyun + +Anna Mastori <72812754+AnnaMastori@users.noreply.github.com> + +Anton <138380708+r3kste@users.noreply.github.com> + anykraus Ariel Hernán Curiale +Atharva Kulkarni Atharva2012 +Atharva Kulkarni <103631956+Atharva2012@users.noreply.github.com> + Ben Cohen Ben Root Benjamin Root @@ -26,18 +63,36 @@ Benedikt Daurer Benjamin Congdon Benjamin Congdon bcongdon +Brandon Dusch + +Brian Lau +Brian Lau <103338659+beelauuu@users.noreply.github.com> + Bruno Zohreh Carsten Schelp Casper van der Wel -Chris Holdgraf +Chahak Mehta Chahak Mehta <201501422@daiict.ac.in> + +Chaoyi Hu <90495101+chaoyihu@users.noreply.github.com> + +Charisma Kausar <68203159+ckcherry23@users.noreply.github.com> + +CharlesHe16 + +Chirag Sharma +Chirag Sharma <160767827+Chirag3841@users.noreply.github.com> Cho Yin Yong Chris +Chris Holdgraf + +Christine P. Chai + Christoph Gohlke cgohlke Christoph Gohlke C. Gohlke Christoph Gohlke @@ -46,17 +101,33 @@ Cimarron Mittelsteadt Cimarron cldssty +Constantinos Menelaou +Constantinos Menelaou <91343054+konmenel@users.noreply.github.com> + Conner R. Phillips +Dale Dai +Dale Dai <145884899+CouldNot@users.noreply.github.com> + Dan Hickstein Daniel Hyams Daniel Hyams Daniel Hyams +Daniel Weiss +Daniel Weiss <32396142+dkweiss31@users.noreply.github.com> + David Kua +David Matos +David Matos + +DerWeh + Devashish Deshpande +Diego Leal Petrola + Dietmar Schwertberger Dora Fraeman Caswell @@ -72,6 +143,9 @@ Eric Ma esvhd +Eva Sibinga +Eva Sibinga <46283995+esibinga@users.noreply.github.com> + Filipe Fernandes Florian Le Bourdais @@ -80,20 +154,44 @@ Francesco Montesano montefra +G Karthik Koundinya +G Karthik Koundinya <144328549+G26karthik@users.noreply.github.com> + +Greg Lucas + Hajoon Choi hannah +Hannes Breytenbach + Hans Moritz Günther +Haoying Zhang +Haoying Zhang <38875181+stevezhang1999@users.noreply.github.com> +Haoying Zhang stevezhang + Harshal Prakash Patankar Harshit Patni +Harutaka Kawamura + +Hasan Rashid + +Hood Chatham Hood + +Husain Gadiwala +Husain Gadiwala <69296939+alphanoobie@users.noreply.github.com> + +Ian Hunt-Isaak + ImportanceOfBeingErnest J. Goutin JGoutin +Jakub Klus <48711526+deep-jkl@users.noreply.github.com> + Jack Kelly Jack Kelly @@ -103,8 +201,14 @@ Jake Vanderplas Jake Vanderplas Jake Vanderplas +Jacob Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> + James R. Evans +Jan-Hendrik Müller <44469195+kolibril13@users.noreply.github.com> + +jaya prajapati + Jeff Lutgen Jeffrey Bingham @@ -112,24 +216,39 @@ Jeffrey Bingham Jens Hedegaard Nielsen Jens Hedegaard Nielsen +Jerome F. Villegas + +JOD + Joel Frederico <458871+joelfrederico@users.noreply.github.com> +Johan von Forstner + John Hunter Jorrit Wronski +Jose Manuel Martí + Joseph Fox-Rabinovitz Mad Physicist Joseph Fox-Rabinovitz Joseph Fox-Rabinovitz Jouni K. Seppänen +Juanita Gomez + Julien Lhermitte Julien Schueller Julien Schueller +Kaustubh Desale +Kaustubh Desale <97254178+Kaustbh@users.noreply.github.com> + Kevin Davies +Khushikela29 <121342846+Khushikela29@users.noreply.github.com> + kikocorreoso Klara Gerlei @@ -139,6 +258,8 @@ Kristen M. Thyng Kyle Sunden +Kyra Cho + Leeonadoh Lennart Fricke @@ -149,23 +270,43 @@ Leon Yin Lion Krischer +Logan Pageler +Logan Pageler <48865621+Logan-Pageler@users.noreply.github.com> + +Lukas Hergt + +Lumberbot (aka Jack) <39504233+meeseeksmachine@users.noreply.github.com> + +luz paz + Manan Kevadiya Manan Kevadiya <43081866+manan2501@users.noreply.github.com> Manuel Nuno Melo +Marat Kopytjuk + Marco Gorelli Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Marek Rudnicki +Marten Henric van Kerkwijk + Martin Fitzpatrick +Marvin +Marvin <101656586+Marvvxi@users.noreply.github.com> + +Mathias Hauser + Matt Newville Matthew Emmett Matthew Emmett +Matthew Morrison <120498834+mattymo30@users.noreply.github.com> + Matthias Bussonnier Matthias Bussonnier @@ -174,6 +315,9 @@ Matthias Lüthi Matti Picus +Melissa Weber Mendonça +Melissa Weber Mendonça + Michael Droettboom Michael Droettboom Michael Droettboom @@ -183,9 +327,14 @@ Michiel de Hoon Michiel de Hoon Michiel de Hoon Michiel de Hoon Michiel de Hoon +Milan Gittler +Milan Gittler <55838375+Cemonix@users.noreply.github.com> + MinRK MinRK Min RK +Miriam Simone + Nelle Varoquaux Nic Eggert Nic Eggert @@ -193,8 +342,12 @@ Nic Eggert Nic Eggert Nicolas P. Rougier +N R Navaneet <156576749+nrnavaneet@users.noreply.github.com> + OceanWolf +odile OdileVidrine <65249488+OdileVidrine@users.noreply.github.com> + Olivier Castany <1868182+ocastany@users.noreply.github.com> Olivier Castany <1868182+ocastany@users.noreply.github.com> Olivier Castany <1868182+ocastany@users.noreply.github.com> @@ -213,8 +366,14 @@ Paul Ivanov Paul Ivanov Paul Ivanov +Pedro Marques + +Pedro Peçanha <60028123+pedrompecanha@users.noreply.github.com> + Per Parker +Péter Leéh + Peter Würtz Peter Würtz @@ -222,20 +381,59 @@ Phil Elson Phil Elson Phil Elson +Philipp Nagel + +Pirzada Ahmad Faraz +Pirzada Ahmad Faraz <136244856+pirzada-ahmadfaraz@users.noreply.github.com> + +photoniker <17592823+photoniker@users.noreply.github.com> + +Pranav Raghu +Pranav Raghu <73378019+Impaler343@users.noreply.github.com> + productivememberofsociety666 none +Quentin Peter + +Rahul Monani + +Raphael Quast + +Ratnabali Dutta + +Richard Penney + Rishikesh +Roman <121314722+GameRoMan@users.noreply.github.com> + +Ruth Comer <10599679+rcomer@users.noreply.github.com> + +Ruth Nainggolan Ruth G. N <32371319+ruthgn@users.noreply.github.com> + RyanPan +Richard Sheridan + Samesh Lakhotia Samesh Lakhotia <43701530+sameshl@users.noreply.github.com> ' +Saumya Agrawal <145997182+saumyacoder1709@users.noreply.github.com> Saumya + Scott Lasley +Scott Shambaugh <14363975+scottshambaugh@users.noreply.github.com> + Sebastian Raschka Sebastian Raschka +ShawnChen1996 + +Shriya Kalakata +Shriya Kalakata <87483933+shriyakalakata@users.noreply.github.com> +Shriya Kalakata Shriya Kalakata +Shriya Kalakata Shriya Kalakata + Sidharth Bansal Sidharth Bansal <20972099+SidharthBansal@users.noreply.github.com> @@ -251,12 +449,15 @@ switham switham Taehoon Lee +Takumasa Nakamura + Ted Drain Taras Kuzyo Terence Honles +Thomas A Caswell Thomas A Caswell Thomas A Caswell Thomas A Caswell Thomas A Caswell Thomas A Caswell Thomas A Caswell <“tcaswell@gmail.com”> @@ -264,17 +465,33 @@ Thomas A Caswell Thomas A Caswell +Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> + +Tine Zivic <43860297+tinezivic@users.noreply.github.com> + +Tobias Thrien tobias + +Tom Sarantis + Trish Gillett-Kawamoto Tuan Dung Tran +tybeller <73607363+tybeller@users.noreply.github.com> + +Valentin Bruch +Valentin Bruch <46252273+stiglers-eponym@users.noreply.github.com> + Víctor Zabalza Vidur Satija -WANG Aiyong +Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com> +Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com> -Zhili (Jerry) Pan +vittoboa <38300176+vittoboa@users.noreply.github.com> + +WANG Aiyong Werner F Bruhin @@ -282,3 +499,7 @@ Yunfei Yang Yunfei Yang Yunfei Yang Zac Hatfield-Dodds + +Zhili (Jerry) Pan + +ZPyrolink <38cz74@gmail.com> <73246085+ZPyrolink@users.noreply.github.com> diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6068b8b0df83..6f2b94141984 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,30 +5,31 @@ ci: exclude: | (?x)^( extern| + subprojects/packagefiles| LICENSE| lib/matplotlib/mpl-data| doc/devel/gitwash| - doc/users/prev| + doc/release/prev| doc/api/prev| - lib/matplotlib/tests/tinypages + lib/matplotlib/tests/data/tinypages ) repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 hooks: - id: check-added-large-files - id: check-docstring-first exclude: lib/matplotlib/typing.py # docstring used for attribute flagged by check - id: end-of-file-fixer - exclude_types: [svg] + exclude_types: [diff, svg] - id: mixed-line-ending - id: name-tests-test args: ["--pytest-test-first"] - id: no-commit-to-branch # Default is master and main. - id: trailing-whitespace - exclude_types: [svg] + exclude_types: [diff, svg] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: d2823d321df3af8f878f7ee3414dc94d037145b9 # frozen: v2.1.0 hooks: - id: mypy additional_dependencies: @@ -41,17 +42,15 @@ repos: args: ["--config-file=pyproject.toml", "lib/matplotlib"] files: lib/matplotlib # Only run when files in lib/matplotlib are changed. pass_filenames: false - - repo: https://github.com/pycqa/flake8 - rev: 7.1.1 + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: 0671d8ab202c4ac093b78433ae5baf74f3fc7246 # frozen: v0.15.15 hooks: - - id: flake8 - additional_dependencies: - - pydocstyle>5.1.0 - - flake8-docstrings>1.4.0 - - flake8-force - args: ["--docstring-convention=all"] + # Run the linter. + - id: ruff-check + args: [--fix, --show-fixes] - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2 hooks: - id: codespell files: ^.*\.(py|c|cpp|h|m|md|rst|yml)$ @@ -61,25 +60,41 @@ repos: - "--skip" - "doc/project/credits.rst" - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: a333737ed43df02b18e6c95477ea1b285b3de15a # frozen: 8.0.1 hooks: - id: isort name: isort (python) files: ^galleries/tutorials/|^galleries/examples/|^galleries/plot_types/ - repo: https://github.com/rstcheck/rstcheck - rev: v6.2.4 + rev: 77490ffa33bfc0928975ae3cf904219903db755d # frozen: v6.2.5 hooks: - id: rstcheck additional_dependencies: + - rstcheck-core!=1.3 # https://github.com/rstcheck/rstcheck-core/pull/114#pullrequestreview-4239740896 - sphinx>=1.8.1 - - tomli - repo: https://github.com/adrienverge/yamllint - rev: v1.35.1 + rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0 hooks: - id: yamllint args: ["--strict", "--config-file=.yamllint.yml"] + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1 + hooks: + - id: shellcheck + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: a4727cbbcd26d7098e96b9cb738169b59711ae51 # frozen: v1.24.1 + hooks: + - id: zizmor + - repo: https://github.com/simple-icons/svglint + rev: 8402586b94f073686e46707a163082e270ee5768 # frozen: v4.2.1 + hooks: + - id: svglint + # Override the top-level exclude so that mpl-data/images/ toolbar + # icons are also linted. Exemptions for the intentional interactive + # SVG examples are handled in .svglintrc.mjs. + exclude: '^$' - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.29.3 + rev: f805888065fdb6162e1f800e50bb9460cbd223d6 # frozen: 0.37.2 hooks: # TODO: Re-enable this when https://github.com/microsoft/azure-pipelines-vscode/issues/567 is fixed. # - id: check-azure-pipelines diff --git a/.svglintrc.mjs b/.svglintrc.mjs new file mode 100644 index 000000000000..7c6c3e194a64 --- /dev/null +++ b/.svglintrc.mjs @@ -0,0 +1,56 @@ +/** @type {import('svglint').Config} */ +const config = { + rules: { + // Ensure all SVGs are valid XML. + valid: true, + + // Block elements that can execute code or embed arbitrary content. + // + + + + 2026-03-25T12:33:41.331892 + image/svg+xml + + + Matplotlib v3.10.0, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + −3 + + + + + + + + + + −2 + + + + + + + + + + −1 + + + + + + + + + + 0 + + + + + + + + + + 1 + + + + + + + + + + 2 + + + + + + + + + + 3 + + + + + + + + + + + + + + + 0 + + + + + + + + + + 5 + + + + + + + + + + 10 + + + + + + + + + + 15 + + + + + + + + + + 20 + + + + + + + + + + 25 + + + + + + + + + + + + + + + + + From a web browser, click on the legend + marker to toggle the corresponding histogram. + + + + + + + Rabbits + + + + + + Frogs + + + + + + + + + + \ No newline at end of file diff --git a/doc/_static/svg_tooltip.svg b/doc/_static/svg_tooltip.svg new file mode 100644 index 000000000000..dd11c2d7782e --- /dev/null +++ b/doc/_static/svg_tooltip.svg @@ -0,0 +1,385 @@ + + + + + + 2026-03-25T12:36:20.674869 + image/svg+xml + + + Matplotlib v3.10.0, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/_static/switcher.json b/doc/_static/switcher.json index 36e743db21b8..cc275467efc4 100644 --- a/doc/_static/switcher.json +++ b/doc/_static/switcher.json @@ -1,7 +1,7 @@ [ { "name": "3.10 (stable)", - "version": "3.10.8", + "version": "3.10.9", "url": "https://matplotlib.org/stable/", "preferred": true }, diff --git a/doc/_static/toolmanager.png b/doc/_static/toolmanager.png new file mode 100644 index 000000000000..14aeba48995d Binary files /dev/null and b/doc/_static/toolmanager.png differ diff --git a/doc/_static/zenodo_cache/17595503.svg b/doc/_static/zenodo_cache/17595503.svg new file mode 100644 index 000000000000..891bd118d125 --- /dev/null +++ b/doc/_static/zenodo_cache/17595503.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + DOI + + + DOI + + + 10.5281/zenodo.17595503 + + + 10.5281/zenodo.17595503 + + + \ No newline at end of file diff --git a/doc/_static/zenodo_cache/19716234.svg b/doc/_static/zenodo_cache/19716234.svg new file mode 100644 index 000000000000..910ecbef7fae --- /dev/null +++ b/doc/_static/zenodo_cache/19716234.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + DOI + + + DOI + + + 10.5281/zenodo.19716234 + + + 10.5281/zenodo.19716234 + + + \ No newline at end of file diff --git a/doc/api/.gitignore b/doc/api/.gitignore deleted file mode 100644 index dbed88d89836..000000000000 --- a/doc/api/.gitignore +++ /dev/null @@ -1 +0,0 @@ -scalarmappable.gen_rst diff --git a/doc/api/artist_api.rst b/doc/api/artist_api.rst index 0ca3fb364c41..f256d2b7164e 100644 --- a/doc/api/artist_api.rst +++ b/doc/api/artist_api.rst @@ -122,6 +122,7 @@ Figure and Axes Artist.set_figure Artist.get_figure + Artist.figure Children -------- diff --git a/doc/api/axes_api.rst b/doc/api/axes_api.rst index 7e4b707f7dc5..951af03a851b 100644 --- a/doc/api/axes_api.rst +++ b/doc/api/axes_api.rst @@ -55,7 +55,6 @@ Basic Axes.errorbar Axes.scatter - Axes.plot_date Axes.step Axes.loglog @@ -68,11 +67,13 @@ Basic Axes.bar Axes.barh Axes.bar_label + Axes.grouped_bar Axes.stem Axes.eventplot Axes.pie + Axes.pie_label Axes.stackplot @@ -292,8 +293,12 @@ Axis limits and direction :template: autosummary.rst :nosignatures: + Axes.set_xinverted + Axes.get_xinverted Axes.invert_xaxis Axes.xaxis_inverted + Axes.set_yinverted + Axes.get_yinverted Axes.invert_yaxis Axes.yaxis_inverted @@ -390,6 +395,8 @@ Aspect ratio Axes.set_adjustable Axes.get_adjustable +.. _axes-api-ticks: + Ticks and tick labels --------------------- @@ -445,6 +452,7 @@ Units Axes.convert_yunits Axes.have_units +.. _axes-api-adding-artists: Adding artists ============== @@ -623,6 +631,8 @@ Other Axes.get_transformed_clip_path_and_affine Axes.has_data Axes.set + Axes.get_figure + Axes.figure Axes.remove .. autoclass:: matplotlib.axes.Axes.ArtistList diff --git a/doc/api/axis_api.rst b/doc/api/axis_api.rst index 85ba990ffece..388779c0ebc5 100644 --- a/doc/api/axis_api.rst +++ b/doc/api/axis_api.rst @@ -80,6 +80,8 @@ Axis Label Axis.get_label_position Axis.get_label_text +.. _axis-api-ticks: + Ticks, tick labels and Offset text ---------------------------------- diff --git a/doc/api/backend_qt_api.rst b/doc/api/backend_qt_api.rst index ebfeedceb6e1..2f950adb672a 100644 --- a/doc/api/backend_qt_api.rst +++ b/doc/api/backend_qt_api.rst @@ -22,10 +22,9 @@ a dependency to building the docs. Qt Bindings ----------- -There are currently 2 actively supported Qt versions, Qt5 and Qt6, and two -supported Python bindings per version -- `PyQt5 -`_ and `PySide2 -`_ for Qt5 and `PyQt6 +There are currently 2 actively supported Qt versions, Qt5 and Qt6. `PyQt5 +`_ is the supported +Python binding for Qt5 and there are both `PyQt6 `_ and `PySide6 `_ for Qt6 [#]_. Matplotlib's qtagg and qtcairo backends (``matplotlib.backends.backend_qtagg`` and @@ -35,13 +34,12 @@ parts factored out in the ``matplotlib.backends.backend_qt`` module. At runtime, these backends select the actual binding used as follows: 1. If a binding's ``QtCore`` subpackage is already imported, that binding is - selected (the order for the check is ``PyQt6``, ``PySide6``, ``PyQt5``, - ``PySide2``). + selected (the order for the check is ``PyQt6``, ``PySide6``, ``PyQt5``). 2. If the :envvar:`QT_API` environment variable is set to one of "PyQt6", - "PySide6", "PyQt5", "PySide2" (case-insensitive), that binding is selected. + "PySide6", "PyQt5" (case-insensitive), that binding is selected. (See also the documentation on :ref:`environment-variables`.) 3. Otherwise, the first available backend in the order ``PyQt6``, ``PySide6``, - ``PyQt5``, ``PySide2`` is selected. + ``PyQt5`` is selected. In the past, Matplotlib used to have separate backends for each version of Qt (e.g. qt4agg/``matplotlib.backends.backend_qt4agg`` and @@ -62,8 +60,9 @@ change without warning [#]_. .. [#] There is also `PyQt4 `_ and `PySide - `_ for Qt4 but these are no - longer supported by Matplotlib and upstream support for Qt4 ended + `_ for Qt4 and `PySide2 + `_ for Qt5 but these are + no longer supported by Matplotlib. Upstream support for Qt4 ended in 2015. .. [#] Despite the slight API differences, the more important distinction between the PyQt and Qt for Python series of bindings is licensing. diff --git a/doc/api/bezier_api.rst b/doc/api/bezier_api.rst index b3764ad04b5a..45019153fa63 100644 --- a/doc/api/bezier_api.rst +++ b/doc/api/bezier_api.rst @@ -5,4 +5,5 @@ .. automodule:: matplotlib.bezier :members: :undoc-members: + :special-members: __call__ :show-inheritance: diff --git a/doc/api/cm_api.rst b/doc/api/cm_api.rst index c9509389a2bb..8476ab14cb86 100644 --- a/doc/api/cm_api.rst +++ b/doc/api/cm_api.rst @@ -7,4 +7,20 @@ :undoc-members: :show-inheritance: -.. include:: scalarmappable.gen_rst +.. class:: ScalarMappable(colorizer, **kwargs) + :canonical: matplotlib.colorizer._ScalarMappable + + .. automethod:: autoscale + .. automethod:: autoscale_None + .. automethod:: changed + .. autoproperty:: colorbar + .. automethod:: get_alpha + .. automethod:: get_array + .. automethod:: get_clim + .. automethod:: get_cmap + .. autoproperty:: norm + .. automethod:: set_array + .. automethod:: set_clim + .. automethod:: set_cmap + .. automethod:: set_norm + .. automethod:: to_rgba diff --git a/doc/api/collections_api.rst b/doc/api/collections_api.rst index 2a06c00a2ad1..f2d9cb5226b2 100644 --- a/doc/api/collections_api.rst +++ b/doc/api/collections_api.rst @@ -11,3 +11,13 @@ :undoc-members: :show-inheritance: :inherited-members: + +.. autoclass:: _CollectionWithSizes + :no-members: + :members: get_sizes, set_sizes + :class-doc-from: class + +.. autoclass:: _MeshData + :no-members: + :members: set_array + :class-doc-from: class diff --git a/doc/api/colors_api.rst b/doc/api/colors_api.rst index 6b02f723d74d..18e7c43932a9 100644 --- a/doc/api/colors_api.rst +++ b/doc/api/colors_api.rst @@ -21,6 +21,7 @@ Color norms :toctree: _as_gen/ :template: autosummary.rst + Norm Normalize NoNorm AsinhNorm @@ -31,6 +32,7 @@ Color norms PowerNorm SymLogNorm TwoSlopeNorm + MultiNorm Univariate Colormaps -------------------- diff --git a/doc/api/matplotlib_configuration_api.rst b/doc/api/matplotlib_configuration_api.rst index d5dc60c80613..b2fafc08e5fc 100644 --- a/doc/api/matplotlib_configuration_api.rst +++ b/doc/api/matplotlib_configuration_api.rst @@ -24,8 +24,24 @@ Default values and styling ========================== .. py:data:: rcParams + :type: RcParams + + The global configuration settings for Matplotlib. + + This is a dictionary-like variable that stores the current configuration + settings. Many of the values control styling, but others control + various aspects of Matplotlib's behavior. + + See :doc:`/users/explain/configuration` for a full list of config + parameters. + + See :ref:`customizing` for usage information. + + Notes + ----- + This object is also available as ``plt.rcParams`` via the + `matplotlib.pyplot` module (which by convention is imported as ``plt``). - An instance of `RcParams` for handling default Matplotlib values. .. autoclass:: RcParams :no-members: diff --git a/doc/api/next_api_changes/README.rst b/doc/api/next_api_changes/README.rst index 030a2644cdd4..1f40122aa318 100644 --- a/doc/api/next_api_changes/README.rst +++ b/doc/api/next_api_changes/README.rst @@ -39,6 +39,7 @@ A typical entry could look like this:: Please avoid using references in section titles, as it causes links to be confusing in the table of contents. Instead, ensure that a reference is -included in the descriptive text. +included in the descriptive text. Use inline literals (double backticks) +to denote code objects in the title. .. api-change-guide-end diff --git a/doc/api/next_api_changes/behavior/28437-CH.rst b/doc/api/next_api_changes/behavior/28437-CH.rst new file mode 100644 index 000000000000..9d0161b6aac9 --- /dev/null +++ b/doc/api/next_api_changes/behavior/28437-CH.rst @@ -0,0 +1,11 @@ +*alpha* parameter handling on images +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Prior to Matplotlib 3.10.1, when passing an array to ``imshow(..., alpha=...)``, the +parameter was silently ignored if the image data was an RGB or RGBA image or if +:rc:`image.interpolation_stage` resolved to "rbga". + +Matplotlib 3.10.1 changed this to apply the alpha array as the alpha channel, +overwriting any existing transparency information in the image data. Matplotlib v3.11.0 +further fixes the handling for RGBA images: the existing alpha channel is now multiplied +by the alpha array, consistent with how scalar alpha values are handled. diff --git a/doc/api/next_api_changes/behavior/29054-AL.rst b/doc/api/next_api_changes/behavior/29054-AL.rst new file mode 100644 index 000000000000..3c65e9ae9b78 --- /dev/null +++ b/doc/api/next_api_changes/behavior/29054-AL.rst @@ -0,0 +1,11 @@ +Minor log tick labels are set depending on number of major log ticks, not on number of decades spanned +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, by default, on a log-scaled axis, the minor ticks would be +unlabeled if the axis limits spanned more than one decade. The meaning of the +``minor_thresholds`` parameter to `.LogFormatter` has been altered so that the +decision of whether to label the minor ticks is now based on the number of +major ticks drawn within the axis limits. + +For example, for an axis spanning from 4 to 60 (with thus a single major log +tick, at 10), minor ticks are now labeled, even though the axis spans more than +one decade. diff --git a/doc/api/next_api_changes/behavior/29256_IMT.rst b/doc/api/next_api_changes/behavior/29256_IMT.rst new file mode 100644 index 000000000000..57ec8f68d85c --- /dev/null +++ b/doc/api/next_api_changes/behavior/29256_IMT.rst @@ -0,0 +1,6 @@ +Setting titles of figures using webagg backend +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Previously when using the ``webagg`` backend the title of a figure was set using +``figure.set_label``. Now it is set using ``figure.canvas.manager.set_window_title`` +which is more consistent with other backends. diff --git a/doc/api/next_api_changes/behavior/29827-ES.rst b/doc/api/next_api_changes/behavior/29827-ES.rst new file mode 100644 index 000000000000..d25dfa0c6574 --- /dev/null +++ b/doc/api/next_api_changes/behavior/29827-ES.rst @@ -0,0 +1,6 @@ +``matplotlib.testing.check_figures_equal`` defaults to PNG only +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In most cases, checking that figures are equal with `.check_figures_equal` does not +depend on the file format. Consequently, the *extensions* parameter now defaults to +``['png']`` instead of ``['png', 'pdf', 'svg']``, reducing default test requirements. diff --git a/doc/api/next_api_changes/behavior/29832-REC.rst b/doc/api/next_api_changes/behavior/29832-REC.rst new file mode 100644 index 000000000000..a23b043a823b --- /dev/null +++ b/doc/api/next_api_changes/behavior/29832-REC.rst @@ -0,0 +1,11 @@ +Mixing positional and keyword arguments for ``legend`` handles and labels... +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is no longer valid. If passing *handles* and *labels* to ``legend``, they must +now be passed either both positionally or both as keywords. + +Legend labels for ``plot`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously if a sequence was passed to the *label* parameter of `~.Axes.plot` when +plotting a single dataset, the sequence was automatically cast to string for the legend +label. Now, if the sequence length is not one an error is raised. To keep the old +behavior, cast the sequence to string before passing. diff --git a/doc/api/next_api_changes/behavior/29958-TH.rst b/doc/api/next_api_changes/behavior/29958-TH.rst new file mode 100644 index 000000000000..cacaf2bac612 --- /dev/null +++ b/doc/api/next_api_changes/behavior/29958-TH.rst @@ -0,0 +1,8 @@ +``Axes.add_collection(..., autolim=True)`` updates view limits +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``Axes.add_collection(..., autolim=True)`` has so far only updated the data limits. +Users needed to additionally call `.Axes.autoscale_view` to update the view limits. +View limits are now updated as well if ``autolim=True``, using a lazy internal +update mechanism, so that the costs only apply once also if you add multiple +collections. diff --git a/doc/api/next_api_changes/behavior/30108-REC.rst b/doc/api/next_api_changes/behavior/30108-REC.rst new file mode 100644 index 000000000000..ce4fb0833207 --- /dev/null +++ b/doc/api/next_api_changes/behavior/30108-REC.rst @@ -0,0 +1,6 @@ +Complex layouts and constrained layout +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Constrained layout now produces smaller spacing between subplots in some +circumstances. This should only affect complex layouts where rows or columns +contain different numbers of subplots, for example a layout created with +``plt.subplot_mosaic('AC;BC', layout='constrained')``. diff --git a/doc/api/next_api_changes/behavior/30272-ES.rst b/doc/api/next_api_changes/behavior/30272-ES.rst new file mode 100644 index 000000000000..5a03f9bc7972 --- /dev/null +++ b/doc/api/next_api_changes/behavior/30272-ES.rst @@ -0,0 +1,2 @@ +``font_manager.findfont`` logs if selected font weight does not match requested +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/api/next_api_changes/behavior/30318-ES.rst b/doc/api/next_api_changes/behavior/30318-ES.rst new file mode 100644 index 000000000000..805901dcb21d --- /dev/null +++ b/doc/api/next_api_changes/behavior/30318-ES.rst @@ -0,0 +1,9 @@ +FT2Font no longer sets a default size +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In the interest of handling non-scalable fonts and reducing font initialization, the +`.FT2Font` constructor no longer sets a default size. Non-scalable fonts are sometimes +used for bitmap-backed emoji fonts. + +If metrics are important (i.e., if you are loading character glyphs, or setting a text +string), then explicitly call `.FT2Font.set_size` beforehand. diff --git a/doc/api/next_api_changes/behavior/30335-ES.rst b/doc/api/next_api_changes/behavior/30335-ES.rst new file mode 100644 index 000000000000..26b059401e19 --- /dev/null +++ b/doc/api/next_api_changes/behavior/30335-ES.rst @@ -0,0 +1,15 @@ +``mathtext.VectorParse`` now includes glyph indices +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For a *path*-outputting `.MathTextParser`, in the return value of +`~.MathTextParser.parse`, (a `.VectorParse`), the *glyphs* field is now a list +containing tuples of: + +- font: `.FT2Font` +- fontsize: `float` +- character code: `int` +- glyph index: `int` +- x: `float` +- y: `float` + +Specifically, the glyph index was added after the character code. diff --git a/doc/api/next_api_changes/behavior/30532-TH.rst b/doc/api/next_api_changes/behavior/30532-TH.rst new file mode 100644 index 000000000000..3d368c566039 --- /dev/null +++ b/doc/api/next_api_changes/behavior/30532-TH.rst @@ -0,0 +1,4 @@ +Default name of ``ListedColormap`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The default name of `.ListedColormap` has changed from "from_list" to "unnamed". diff --git a/doc/api/next_api_changes/behavior/30634-AL.rst b/doc/api/next_api_changes/behavior/30634-AL.rst new file mode 100644 index 000000000000..585de1ea14eb --- /dev/null +++ b/doc/api/next_api_changes/behavior/30634-AL.rst @@ -0,0 +1,6 @@ +hist2d no longer forces axes limits +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, `.Axes.hist2d` would force the axes x and y limits to the extents +of the histogrammed data, ignoring any other artists. `.Axes.hist2d` now +behaves similarly to `.Axes.imshow`: axes limits are updated to fit the data, +but autoscaling is not otherwise disabled. diff --git a/doc/api/next_api_changes/behavior/30824-AYS.rst b/doc/api/next_api_changes/behavior/30824-AYS.rst new file mode 100644 index 000000000000..a190bd537126 --- /dev/null +++ b/doc/api/next_api_changes/behavior/30824-AYS.rst @@ -0,0 +1,6 @@ +Bivariate colormaps now fully span the intended range of colors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Bivariate colormaps generated by ``SegmentedBivarColormap`` (e.g., ``BiOrangeBlue``) +from a set of input colors now fully span that range of colors. There had been a bug +with the numerical interpolation such that the colormap did not actually include the +first or last colors. diff --git a/doc/api/next_api_changes/behavior/30975-VM.rst b/doc/api/next_api_changes/behavior/30975-VM.rst new file mode 100644 index 000000000000..185b57ac5de6 --- /dev/null +++ b/doc/api/next_api_changes/behavior/30975-VM.rst @@ -0,0 +1,9 @@ +Windows configuration directory location +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +On Windows, the default configuration and cache directories now use +``%LOCALAPPDATA%\matplotlib`` instead of ``%USERPROFILE%\.matplotlib``. +This follows Windows application data storage conventions. + +The ``MPLCONFIGDIR`` environment variable can still be used to override +this default. diff --git a/doc/api/next_api_changes/behavior/31021-AYS.rst b/doc/api/next_api_changes/behavior/31021-AYS.rst new file mode 100644 index 000000000000..aa5dc598cb26 --- /dev/null +++ b/doc/api/next_api_changes/behavior/31021-AYS.rst @@ -0,0 +1,7 @@ +Rendering of images now more accurate +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +There have been several fixes to improve the accuracy of how images are +resampled and placed during rendering. Some inaccuracies were up to a pixel off +in the output. The most apparent improvement is that the alignment of data +pixels with tick marks and grid lines is now reliable. Nearly all image output +has changed, but often only at a subtle level that is not obvious qualitatively. diff --git a/doc/api/next_api_changes/behavior/31148-ES.rst b/doc/api/next_api_changes/behavior/31148-ES.rst new file mode 100644 index 000000000000..08ad9b7cb0c1 --- /dev/null +++ b/doc/api/next_api_changes/behavior/31148-ES.rst @@ -0,0 +1,6 @@ +Default *style* parameter of ``image_comparison`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The *style* parameter of the `.image_comparison` decorator will become 'mpl20' in +Matplotlib 3.13. Not passing it and relying on the previous default will warn until the +change occurs. diff --git a/doc/api/next_api_changes/behavior/31223-AS.rst b/doc/api/next_api_changes/behavior/31223-AS.rst new file mode 100644 index 000000000000..0880659e55ee --- /dev/null +++ b/doc/api/next_api_changes/behavior/31223-AS.rst @@ -0,0 +1,28 @@ +``pyplot.subplot`` and ``pyplot.subplot_mosaic`` raise *ValueError* on existing figures +---------------------------------------------------------------------------------------- + +Passing a *num* argument to `~.pyplot.subplots` or `~.pyplot.subplot_mosaic` +that refers to an existing figure or is a ``Figure`` instance now raises a +`ValueError`. + +These utility functions are intended strictly for the creation of new figures and +subplots. Previously, they accidentally allowed the reuse of existing figures because +they internally called `~.pyplot.figure`. This change ensures that these functions +strictly follow their documented purpose of creating new figures. + +To reuse an existing figure, clear it first using ``clear=True``: + +.. code-block:: python + + fig, axs = plt.subplots(num=1, clear=True) + # or + fig, axd = plt.subplot_mosaic([['A', 'B']], num=1, clear=True) + +If you have a ``Figure`` instance and want to add subplots to it, use the +object-oriented API: + +.. code-block:: python + + fig.subplots(nrows=2, ncols=2) + # or + fig.subplot_mosaic([['A', 'B']]) diff --git a/doc/api/next_api_changes/behavior/31486-ES.rst b/doc/api/next_api_changes/behavior/31486-ES.rst new file mode 100644 index 000000000000..a04c1d025d90 --- /dev/null +++ b/doc/api/next_api_changes/behavior/31486-ES.rst @@ -0,0 +1,6 @@ +New environment variable to ignore system fonts +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +System fonts may be ignored by setting the :envvar:`MPL_IGNORE_SYSTEM_FONTS`; this +suppresses searching for system fonts (in known directories or via some +platform-specific subprocess) as well as limiting the results from `.FontManager.findfont`. diff --git a/doc/api/next_api_changes/behavior/31530-TZ.rst b/doc/api/next_api_changes/behavior/31530-TZ.rst new file mode 100644 index 000000000000..470104817a59 --- /dev/null +++ b/doc/api/next_api_changes/behavior/31530-TZ.rst @@ -0,0 +1,6 @@ +``relim()`` now accounts for Collection artists +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, `~.axes.Axes.relim` did not recalculate data limits for +`.Collection` artists (e.g. those created by `~.axes.Axes.scatter`). +Calling ``ax.relim()`` followed by ``ax.autoscale_view()`` now correctly +includes scatter plots and other collections in the axes limits. diff --git a/doc/api/next_api_changes/behavior/31578-TH.rst b/doc/api/next_api_changes/behavior/31578-TH.rst new file mode 100644 index 000000000000..0607652c7c8f --- /dev/null +++ b/doc/api/next_api_changes/behavior/31578-TH.rst @@ -0,0 +1,10 @@ +SVG links open in new tab or window +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +`.Artist.set_url` allows to turn the Artist into a link. In SVG output, +this has been implemented without specifying a `target`_ attribute. The default +target value "_self" resulted in replacing the SVG document with the linked page +when the link was clicked. + +The target is now set to "_blank" so that the link opens in a new tab or window. + +.. _target: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/target diff --git a/doc/api/next_api_changes/behavior/violinplot_empty.rst b/doc/api/next_api_changes/behavior/violinplot_empty.rst new file mode 100644 index 000000000000..dfc5ca7669c7 --- /dev/null +++ b/doc/api/next_api_changes/behavior/violinplot_empty.rst @@ -0,0 +1,4 @@ +Axes.violinplot and cbook.violin_stats ignore non-finite values +--------------------------------------------------------------- + +`~matplotlib.axes.Axes.violinplot` and `matplotlib.cbook.violin_stats` now ignore masked and non-finite (NaN and inf) values. diff --git a/doc/api/next_api_changes/deprecations/27551-AL.rst b/doc/api/next_api_changes/deprecations/27551-AL.rst new file mode 100644 index 000000000000..4811f542bd5f --- /dev/null +++ b/doc/api/next_api_changes/deprecations/27551-AL.rst @@ -0,0 +1,4 @@ +``GridFinder.transform_xy`` and ``GridFinder.inv_transform_xy`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... are deprecated. Directly use the standard transform returned by +`.GridFinder.get_transform` instead. diff --git a/doc/api/next_api_changes/deprecations/27972-AL.rst b/doc/api/next_api_changes/deprecations/27972-AL.rst new file mode 100644 index 000000000000..cf14b24345b5 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/27972-AL.rst @@ -0,0 +1,8 @@ +``axes_grid.Grid.ngrids`` +~~~~~~~~~~~~~~~~~~~~~~~~~ +This attribute has been deprecated and renamed ``n_axes``, consistently with +the new name of the `~.axes_grid.Grid` constructor parameter that allows +setting the actual number of axes in the grid (the old parameter, ``ngrids``, +did not actually work since Matplotlib 3.3). + +The same change has been made in ``axes_grid.ImageGrid``. diff --git a/doc/api/next_api_changes/deprecations/29135-TH.rst b/doc/api/next_api_changes/deprecations/29135-TH.rst new file mode 100644 index 000000000000..e2289a248076 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/29135-TH.rst @@ -0,0 +1,5 @@ +Parameter ``ListedColormap(..., N=...)`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Passing the parameter *N* to `.ListedColormap` is deprecated. +Please preprocess the list colors yourself if needed. diff --git a/doc/api/next_api_changes/deprecations/29152_REC.rst b/doc/api/next_api_changes/deprecations/29152_REC.rst new file mode 100644 index 000000000000..cedc91e81410 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/29152_REC.rst @@ -0,0 +1,13 @@ +``pie`` *labels* and *labeldistance* parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Currently the *labels* parameter of `~.Axes.pie` is used both for annotating the +pie wedges directly, and for automatic legend entries. For consistency +with other plotting methods, in future *labels* will only be used for the legend. + +The *labeldistance* parameter will therefore default to ``None`` from Matplotlib +3.14, when it will also be deprecated and then removed in Matplotlib 3.16. To +preserve the existing behavior for now, set ``labeldistance=1.1``. For the longer +term, to place labels on the wedges use the new *wedge_labels* and +*wedge_label_distance* parameters of `~.Axes.pie` or the `~.Axes.pie_label` method. +Note that `~.Axes.pie_label` allows for more customization of the label positions via +the *rotate* and *alignment* parameters as well as *distance*. diff --git a/doc/api/next_api_changes/deprecations/29358-TH.rst b/doc/api/next_api_changes/deprecations/29358-TH.rst new file mode 100644 index 000000000000..1b7a50456afc --- /dev/null +++ b/doc/api/next_api_changes/deprecations/29358-TH.rst @@ -0,0 +1,17 @@ +3rd party scales do not need to have an *axis* parameter anymore +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Since matplotlib 3.1 `PR 12831 `_ +scale objects should be reusable and therefore independent of any particular Axis. +Therefore, the use of the *axis* parameter in the ``__init__`` had been discouraged. +However, having that parameter in the signature was still necessary for API +backwards-compatibility. This is no longer the case. + +`.register_scale` now accepts scale classes with or without this parameter. + +The *axis* parameter is pending-deprecated. It will be deprecated in matplotlib 3.13, +and removed in matplotlib 3.15. + +3rd-party scales are recommended to remove the *axis* parameter now if they can +afford to restrict compatibility to matplotlib >= 3.11 already. Otherwise, they may +keep the *axis* parameter and remove it in time for matplotlib 3.13. diff --git a/doc/api/next_api_changes/deprecations/29529-TH.rst b/doc/api/next_api_changes/deprecations/29529-TH.rst new file mode 100644 index 000000000000..e396e68c4aa1 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/29529-TH.rst @@ -0,0 +1,7 @@ +Capitalization of None in matplotlibrc +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In :file:`matplotlibrc` config files every capitalization of None was +accepted for denoting the Python constant `None`. This is deprecated. The +only accepted capitalization is now None, i.e. starting with a capital letter +and all other letters in lowercase. diff --git a/doc/api/next_api_changes/deprecations/29817-AL.rst b/doc/api/next_api_changes/deprecations/29817-AL.rst new file mode 100644 index 000000000000..f3b339ed7c10 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/29817-AL.rst @@ -0,0 +1,7 @@ +``DviFont.widths`` +~~~~~~~~~~~~~~~~~~ +... is deprecated with no replacement. + +Direct access to ``Tfm``'s ``widths``, ``heights``, ``depths`` dicts +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated; access a glyph's metrics with `.Tfm.get_metrics` instead. diff --git a/doc/api/next_api_changes/deprecations/29904-tac.rst b/doc/api/next_api_changes/deprecations/29904-tac.rst new file mode 100644 index 000000000000..8e4f986ffa77 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/29904-tac.rst @@ -0,0 +1,16 @@ + +Increase to minimum supported versions of dependencies +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For Matplotlib 3.11, the :ref:`minimum supported versions ` are +being bumped: + ++------------+-----------------+----------------+ +| Dependency | min in mpl3.10 | min in mpl3.11 | ++============+=================+================+ +| Python | 3.10 | 3.11 | +| NumPy | 1.23 | 1.25 | ++------------+-----------------+----------------+ + +This is consistent with our :ref:`min_deps_policy` and `SPEC0 +`__ diff --git a/doc/api/next_api_changes/deprecations/29993-AL.rst b/doc/api/next_api_changes/deprecations/29993-AL.rst new file mode 100644 index 000000000000..9104fd669325 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/29993-AL.rst @@ -0,0 +1,4 @@ +``testing.widgets.mock_event`` and ``testing.widgets.do_event`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... are deprecated. Directly construct Event objects (typically `.MouseEvent` +or `.KeyEvent`) and pass them to ``canvas.callbacks.process()`` instead. diff --git a/doc/api/next_api_changes/deprecations/30027-AL.rst b/doc/api/next_api_changes/deprecations/30027-AL.rst new file mode 100644 index 000000000000..ed65d9391371 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30027-AL.rst @@ -0,0 +1,3 @@ +``PdfFile.fontNames``, ``PdfFile.dviFontInfo``, ``PdfFile.type1Descriptors`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... are deprecated with no replacement. diff --git a/doc/api/next_api_changes/deprecations/30044-AL.rst b/doc/api/next_api_changes/deprecations/30044-AL.rst new file mode 100644 index 000000000000..e004d5f2730f --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30044-AL.rst @@ -0,0 +1,12 @@ +``FT2Image`` +~~~~~~~~~~~~ +... is deprecated. Use 2D uint8 ndarrays instead. In particular: + +- The ``FT2Image`` constructor took ``width, height`` as separate parameters + but the ndarray constructor takes ``(height, width)`` as single tuple + parameter. +- `.FT2Font.draw_glyph_to_bitmap` now (also) takes 2D uint8 arrays as input. +- ``FT2Image.draw_rect_filled`` should be replaced by directly setting pixel + values to black. +- The ``image`` attribute of the object returned by ``MathTextParser("agg").parse`` + is now a 2D uint8 array. diff --git a/doc/api/next_api_changes/deprecations/30070-OG.rst b/doc/api/next_api_changes/deprecations/30070-OG.rst new file mode 100644 index 000000000000..98786bcfa1d2 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30070-OG.rst @@ -0,0 +1,4 @@ +``BezierSegment.point_at_t`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... is deprecated. Instead, it is possible to call the BezierSegment with an argument. diff --git a/doc/api/next_api_changes/deprecations/30088-AL.rst b/doc/api/next_api_changes/deprecations/30088-AL.rst new file mode 100644 index 000000000000..ae1338da7f85 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30088-AL.rst @@ -0,0 +1,4 @@ +*fontfile* parameter of ``PdfFile.createType1Descriptor`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +This parameter is deprecated; all relevant pieces of information are now +directly extracted from the *t1font* argument. diff --git a/doc/api/next_api_changes/deprecations/30163-AL.rst b/doc/api/next_api_changes/deprecations/30163-AL.rst new file mode 100644 index 000000000000..15d0077375f2 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30163-AL.rst @@ -0,0 +1,9 @@ +``matplotlib.style.core`` +~~~~~~~~~~~~~~~~~~~~~~~~~ +The ``matplotlib.style.core`` module is deprecated. All APIs intended for +public use are now available in `matplotlib.style` directly (including +``USER_LIBRARY_PATHS``, which was previously not reexported). + +The following APIs of ``matplotlib.style.core`` have been deprecated with no +replacement: ``BASE_LIBRARY_PATH``, ``STYLE_EXTENSION``, ``STYLE_BLACKLIST``, +``update_user_library``, ``read_style_directory``, ``update_nested_dict``. diff --git a/doc/api/next_api_changes/deprecations/30322-ES.rst b/doc/api/next_api_changes/deprecations/30322-ES.rst new file mode 100644 index 000000000000..b9c4964e58c8 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30322-ES.rst @@ -0,0 +1,7 @@ +Font kerning factor is deprecated +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to internal changes to support complex text rendering, the kerning factor on fonts is +no longer used. Setting the ``text.kerning_factor`` rcParam (which existed only for +backwards-compatibility) to any value other than None is deprecated, and the rcParam will +be removed in the future. diff --git a/doc/api/next_api_changes/deprecations/30329-ES.rst b/doc/api/next_api_changes/deprecations/30329-ES.rst new file mode 100644 index 000000000000..8d5060c4821b --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30329-ES.rst @@ -0,0 +1,4 @@ +``font_manager.is_opentype_cff_font`` is deprecated +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There is no replacement. diff --git a/doc/api/next_api_changes/deprecations/30349-AL.rst b/doc/api/next_api_changes/deprecations/30349-AL.rst new file mode 100644 index 000000000000..78e26f41889f --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30349-AL.rst @@ -0,0 +1,3 @@ +``Axes.set_navigate_mode`` is deprecated +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... with no replacement. diff --git a/doc/api/next_api_changes/deprecations/30364-AS.rst b/doc/api/next_api_changes/deprecations/30364-AS.rst new file mode 100644 index 000000000000..4f5493b8b706 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30364-AS.rst @@ -0,0 +1,4 @@ +Parameters ``Axes3D.set_aspect(..., anchor=..., share=...)`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The parameters *anchor* and *share* of `.Axes3D.set_aspect` are deprecated. +They had no effect on 3D axes and will be removed in a future version. diff --git a/doc/api/next_api_changes/deprecations/30368-AL.rst b/doc/api/next_api_changes/deprecations/30368-AL.rst new file mode 100644 index 000000000000..efd3c8360ef3 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30368-AL.rst @@ -0,0 +1,3 @@ +``GridFinder.get_grid_info`` now takes a single bbox as parameter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Passing ``x1, y1, x2, y2`` as separate parameters is deprecated. diff --git a/doc/api/next_api_changes/deprecations/30369-AL.rst b/doc/api/next_api_changes/deprecations/30369-AL.rst new file mode 100644 index 000000000000..8b82c80054d9 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30369-AL.rst @@ -0,0 +1,14 @@ +:mod:`.axisartist` now uses more standard tick direction controls +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, the position of :mod:`.axisartist` ticks (inside or outside +the axes) were set using ``set_tick_out(bool)``. They are now set +using ``set_tick_direction("in")`` (or "out", or "inout"), and respect +:rc:`xtick.direction` and :rc:`ytick.direction`. In particular, they default +to pointing outwards, consistently with the rest of the library. + +The *tick_out* parameter of `.Ticks` has been deprecated (use *tick_direction* +instead). The ``Ticks.get_tick_out`` method is deprecated (use +`.Ticks.get_tick_direction` instead). + +The unused ``locs_angles_labels`` attribute of `.Ticks` and `.LabelBase` has +also been deprecated. diff --git a/doc/api/next_api_changes/deprecations/30469-AL.rst b/doc/api/next_api_changes/deprecations/30469-AL.rst new file mode 100644 index 000000000000..ef3f042843c2 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30469-AL.rst @@ -0,0 +1,4 @@ +The *axes* parameter of ``RadialLocator`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated. `~.polar.RadialLocator` now fetches the relevant information +from the Axis' parent Axes. diff --git a/doc/api/next_api_changes/deprecations/30512-ES.rst b/doc/api/next_api_changes/deprecations/30512-ES.rst new file mode 100644 index 000000000000..f235964c5502 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30512-ES.rst @@ -0,0 +1,3 @@ +``PdfFile.multi_byte_charprocs`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated with no replacement. diff --git a/doc/api/next_api_changes/deprecations/30531-TH.rst b/doc/api/next_api_changes/deprecations/30531-TH.rst new file mode 100644 index 000000000000..19d51fd2fb6c --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30531-TH.rst @@ -0,0 +1,16 @@ +In-place modifications of colormaps +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Colormaps are planned to become immutable in the long term. + +As a first step, in-place modifications of colormaps are now pending-deprecated. +This affects the following methods of `.Colormap`: + +- `.Colormap.set_bad` - use ``cmap.with_extremes(bad=...)`` instead +- `.Colormap.set_under` - use ``cmap.with_extremes(under=...)`` instead +- `.Colormap.set_over` - use ``cmap.with_extremes(over=...)`` instead +- `.Colormap.set_extremes` - use ``cmap.with_extremes(...)`` instead + +Use the respective `.Colormap.with_extremes` and appropriate keyword arguments +instead which returns a copy of the colormap (available since matplotlib 3.4). +Alternatively, if you create the colormap yourself, you can also pass the +respective arguments to the constructor (available since matplotlib 3.11). diff --git a/doc/api/next_api_changes/deprecations/30737-TH.rst b/doc/api/next_api_changes/deprecations/30737-TH.rst new file mode 100644 index 000000000000..8feef85912b4 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30737-TH.rst @@ -0,0 +1,8 @@ +The *canvas* parameter to ``MultiCursor`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... is deprecated. It has been unused for a while already. + +Please remove the parameter and change the call from +``MultiCursor(canvas, axes)`` to ``MultiCursor(axes)``. Both calls are +valid throughout the deprecation period. diff --git a/doc/api/next_api_changes/deprecations/30844-IHI.rst b/doc/api/next_api_changes/deprecations/30844-IHI.rst new file mode 100644 index 000000000000..55ebe9af6d68 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30844-IHI.rst @@ -0,0 +1,6 @@ +``CallbackRegistry.disconnect`` *cid* parameter renamed to *cid_or_func* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The *cid* parameter of `.CallbackRegistry.disconnect` has been renamed to +*cid_or_func*. The method now also accepts a callable, which will disconnect +that callback from all signals or from a specific signal if the *signal* +keyword argument is provided. diff --git a/doc/api/next_api_changes/deprecations/30889-TH.rst b/doc/api/next_api_changes/deprecations/30889-TH.rst new file mode 100644 index 000000000000..d221ae30d4fb --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30889-TH.rst @@ -0,0 +1,10 @@ +Transforms helper functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following functions in the `.transforms` module are deprecated, +because they are considerer internal functionality and should not be used +by end users: + +- ``matplotlib.transforms.nonsingular`` +- ``matplotlib.transforms.interval_contains`` +- ``matplotlib.transforms.interval_contains_open`` diff --git a/doc/api/next_api_changes/deprecations/30993-SS.rst b/doc/api/next_api_changes/deprecations/30993-SS.rst new file mode 100644 index 000000000000..152d25ba438d --- /dev/null +++ b/doc/api/next_api_changes/deprecations/30993-SS.rst @@ -0,0 +1,5 @@ +``InvertedSymmetricalLogTransform.invlinthresh`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``invlinthresh`` attribute of `.InvertedSymmetricalLogTransform` is +deprecated. Use the ``.inverted().transform(linthresh)`` method instead. diff --git a/doc/api/next_api_changes/deprecations/31023-AL.rst b/doc/api/next_api_changes/deprecations/31023-AL.rst new file mode 100644 index 000000000000..ac2e8be2e708 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31023-AL.rst @@ -0,0 +1,4 @@ +``cbook.normalize_kwargs`` only supports passing artists and artist classes as second argument +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for directly passing an alias mapping or None as second argument to +`.cbook.normalize_kwargs` has been deprecated. diff --git a/doc/api/next_api_changes/deprecations/31143-AL.rst b/doc/api/next_api_changes/deprecations/31143-AL.rst new file mode 100644 index 000000000000..7de02ff83896 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31143-AL.rst @@ -0,0 +1,3 @@ +``backend_svg.XMLWriter`` is deprecated +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +It is an internal helper not intended for external use. diff --git a/doc/api/next_api_changes/deprecations/31170-AL.rst b/doc/api/next_api_changes/deprecations/31170-AL.rst new file mode 100644 index 000000000000..ecf1f31f1cff --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31170-AL.rst @@ -0,0 +1,6 @@ +``kw``, ``fontproperties``, ``labelcolor``, and ``verts`` attributes of ``QuiverKey`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +These attributes are deprecated (note that ``fontproperties``, ``labelcolor``, +or ``verts`` after the first draw had no effect previously). Directly +access the relevant attributes on the sub-artists ``QuiverKey.vector`` and +``QuiverKey.text``, instead. diff --git a/doc/api/next_api_changes/deprecations/31248-SS.rst b/doc/api/next_api_changes/deprecations/31248-SS.rst new file mode 100644 index 000000000000..1d7adbdf0fde --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31248-SS.rst @@ -0,0 +1,9 @@ +Arbitrary code in ``axes.prop_cycle`` rcParam strings +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``axes.prop_cycle`` rcParam accepts Python expressions that are evaluated +in a limited context. The evaluation context has been further limited and some +expressions that previously worked (list comprehensions, for example) no longer +will. This change is made without a deprecation period to improve security. +The previously documented cycler operations at +https://matplotlib.org/cycler/ are still supported. diff --git a/doc/api/next_api_changes/deprecations/31347-TH.rst b/doc/api/next_api_changes/deprecations/31347-TH.rst new file mode 100644 index 000000000000..991406e08b97 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31347-TH.rst @@ -0,0 +1,8 @@ +Contour labelling on filled contours +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Using `~.Axes.clabel` to label filled contours created with `~.Axes.contourf` is deprecated. ``clabel()`` +is designed to label contour lines (`.Axes.contour`), and using it with filled contours can lead to inconsistent +plots. If you want to add labels to filled contours, the recommended approach is to first create the filled contours +with `~.Axes.contourf`, then overlay contour lines using `~.Axes.contour`, and finally apply `~.Axes.clabel` to those +contour lines for labeling. For an example see :doc:`/gallery/images_contours_and_fields/contourf_demo`. diff --git a/doc/api/next_api_changes/deprecations/31416-TH.rst b/doc/api/next_api_changes/deprecations/31416-TH.rst new file mode 100644 index 000000000000..6d6d4b7b7809 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31416-TH.rst @@ -0,0 +1,8 @@ +Formatter attributes +~~~~~~~~~~~~~~~~~~~~ + +These following attributes are considered internal and users should not have a need to access them: + +- `.ScalarFormatter`: ``orderOfMagnitude`` and ``format`` +- `.ConciseDateFormatter`: ``offset_format`` +- `.Formatter`: ``locs`` diff --git a/doc/api/next_api_changes/deprecations/31468-ES.rst b/doc/api/next_api_changes/deprecations/31468-ES.rst new file mode 100644 index 000000000000..a71644a6e4f5 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31468-ES.rst @@ -0,0 +1,6 @@ +``image.thumbnail`` +~~~~~~~~~~~~~~~~~~~ + +... is deprecated without replacement. Use :external:py:`Pillow's thumbnail +method ` instead. See also the `Pillow tutorial +`_. diff --git a/doc/api/next_api_changes/deprecations/31521-ES.rst b/doc/api/next_api_changes/deprecations/31521-ES.rst new file mode 100644 index 000000000000..fc04b69a50fd --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31521-ES.rst @@ -0,0 +1,7 @@ +Font hinting factor is deprecated +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Due to internal changes to support complex text rendering, the hinting factor on fonts is +no longer used. Setting the ``text.hinting_factor`` rcParam to any value other than None +is deprecated, and the rcParam will be removed in the future. Likewise, passing the +``hinting_factor`` argument to the `.FT2Font` constructor is deprecated. diff --git a/doc/api/next_api_changes/deprecations/31630-ES.rst b/doc/api/next_api_changes/deprecations/31630-ES.rst new file mode 100644 index 000000000000..2509b4323022 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31630-ES.rst @@ -0,0 +1,10 @@ +``apply_theta_transforms`` option in ``PolarTransform`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Applying theta transforms in `~matplotlib.projections.polar.PolarTransform` and +`~matplotlib.projections.polar.InvertedPolarTransform` has been removed, and the +*apply_theta_transforms* keyword argument is deprecated for both classes. + +If you need to retain the behaviour where theta values are transformed, chain the +``PolarTransform`` with a `~matplotlib.transforms.Affine2D` transform that performs the +theta shift and/or sign shift. diff --git a/doc/api/next_api_changes/deprecations/31818-TH.rst b/doc/api/next_api_changes/deprecations/31818-TH.rst new file mode 100644 index 000000000000..07acca32ccd5 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/31818-TH.rst @@ -0,0 +1,4 @@ +Line2D.recache_always +~~~~~~~~~~~~~~~~~~~~~ + +``recache_always()`` on `.Line2D` is deprecated. Use ``recache(always=True)`` instead. diff --git a/doc/api/next_api_changes/development/29181-ES.rst b/doc/api/next_api_changes/development/29181-ES.rst new file mode 100644 index 000000000000..a3c7e5eed448 --- /dev/null +++ b/doc/api/next_api_changes/development/29181-ES.rst @@ -0,0 +1,11 @@ +pip 25.1 suggested for development +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Dependencies for development (build and testing) are now specified as `Dependency Groups +`_ +instead of `individual requirements files +`_. + +Consequently, a version of pip that supports Dependency Groups is suggested, namely +version 25.1 or higher. Note that if you install build/testing dependencies manually (by +copying the list from ``pyproject.toml``), then an older version of pip is sufficient. diff --git a/doc/api/next_api_changes/development/29745-DS.rst b/doc/api/next_api_changes/development/29745-DS.rst new file mode 100644 index 000000000000..7d9b1c2b143b --- /dev/null +++ b/doc/api/next_api_changes/development/29745-DS.rst @@ -0,0 +1,4 @@ +New minimum version of pyparsing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The minimum required version of ``pyparsing`` has been updated from 2.3.1 to 3.0.0. diff --git a/doc/api/next_api_changes/development/30143-ES.rst b/doc/api/next_api_changes/development/30143-ES.rst new file mode 100644 index 000000000000..2d79ad6bbe9d --- /dev/null +++ b/doc/api/next_api_changes/development/30143-ES.rst @@ -0,0 +1,7 @@ +Glyph indices now typed distinctly from character codes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Previously, character codes and glyph indices were both typed as `int`, which means you +could mix and match them erroneously. While the character code can't be made a distinct +type (because it's used for `chr`/`ord`), typing glyph indices as a distinct type means +these can't be fully swapped. diff --git a/doc/api/next_api_changes/development/31740_REC.rst b/doc/api/next_api_changes/development/31740_REC.rst new file mode 100644 index 000000000000..8ae9bc518198 --- /dev/null +++ b/doc/api/next_api_changes/development/31740_REC.rst @@ -0,0 +1,25 @@ +Increase to minimum supported versions of dependencies +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For Matplotlib 3.12, the :ref:`minimum supported versions ` are being +bumped: + ++-------------+-----------------+----------------+ +| Dependency | min in mpl3.11 | min in mpl3.12 | ++=============+=================+================+ +| Python | 3.11 | 3.12 | ++-------------+-----------------+----------------+ +| NumPy | 1.25 | 2.0.0 | ++-------------+-----------------+----------------+ +| Contourpy | 1.0.1 | 1.2.1 | ++-------------+-----------------+----------------+ + +This is consistent with our :ref:`min_deps_policy` and `SPEC0 +`__ + + +PySide2 support +~~~~~~~~~~~~~~~ + +Support for the `PySide2 `_ Qt5 Python +binding has been dropped because PySide2 does not support Python 3.12+. diff --git a/doc/api/next_api_changes/removals/29697-REC.rst b/doc/api/next_api_changes/removals/29697-REC.rst new file mode 100644 index 000000000000..0155578f0c21 --- /dev/null +++ b/doc/api/next_api_changes/removals/29697-REC.rst @@ -0,0 +1,10 @@ +``plot_date`` +~~~~~~~~~~~~~ + +Use of ``plot_date`` has been discouraged since Matplotlib 3.5 and deprecated +since 3.9. The ``plot_date`` function has now been removed. + +- ``datetime``-like data should directly be plotted using `~.Axes.plot`. +- If you need to plot plain numeric data as :ref:`date-format` or need to set + a timezone, call ``ax.xaxis.axis_date`` / ``ax.yaxis.axis_date`` before + `~.Axes.plot`. See `.Axis.axis_date`. diff --git a/doc/api/next_api_changes/removals/30005-DS.rst b/doc/api/next_api_changes/removals/30005-DS.rst new file mode 100644 index 000000000000..a5ba482c848f --- /dev/null +++ b/doc/api/next_api_changes/removals/30005-DS.rst @@ -0,0 +1,11 @@ +``matplotlib.cm.get_cmap`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Colormaps are now available through the `.ColormapRegistry` accessible via +`matplotlib.colormaps` or `matplotlib.pyplot.colormaps`. + +If you have the name of a colormap as a string, you can use a direct lookup, +``matplotlib.colormaps[name]`` or ``matplotlib.pyplot.colormaps[name]`` . Alternatively, ``matplotlib.colormaps.get_cmap`` will +maintain the existing behavior of additionally passing through `.Colormap` instances +and converting ``None`` to the default colormap. `matplotlib.pyplot.get_cmap` will stay as a +shortcut to ``matplotlib.colormaps.get_cmap``. diff --git a/doc/api/next_api_changes/removals/30014-DS.rst b/doc/api/next_api_changes/removals/30014-DS.rst new file mode 100644 index 000000000000..d13737f17e40 --- /dev/null +++ b/doc/api/next_api_changes/removals/30014-DS.rst @@ -0,0 +1,4 @@ +``GridHelperCurveLinear.get_tick_iterator`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... is removed with no replacement. diff --git a/doc/api/next_api_changes/removals/30015-DS.rst b/doc/api/next_api_changes/removals/30015-DS.rst new file mode 100644 index 000000000000..e5f17518a9f3 --- /dev/null +++ b/doc/api/next_api_changes/removals/30015-DS.rst @@ -0,0 +1,9 @@ +*nth_coord* parameter to axisartist helpers for fixed axis +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Helper APIs in `.axisartist` for generating a "fixed" axis on rectilinear axes +(`.FixedAxisArtistHelperRectilinear`) no longer take a *nth_coord* parameter. +That parameter is entirely inferred from the (required) *loc* parameter. + +For curvilinear axes, the *nth_coord* parameter remains supported (it affects +the *ticks*, not the axis position itself), but it is now keyword-only. diff --git a/doc/api/next_api_changes/removals/30067-OG.rst b/doc/api/next_api_changes/removals/30067-OG.rst new file mode 100644 index 000000000000..1a8d8bc5c2c5 --- /dev/null +++ b/doc/api/next_api_changes/removals/30067-OG.rst @@ -0,0 +1,23 @@ +``TransformNode.is_bbox`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +... is removed. Instead check the object using ``isinstance(..., BboxBase)``. + +``rcsetup.interactive_bk``, ``rcsetup.non_interactive_bk`` and ``rcsetup.all_backends`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +... are removed and replaced by ``matplotlib.backends.backend_registry.list_builtin`` +with the following arguments + +- ``matplotlib.backends.BackendFilter.INTERACTIVE`` +- ``matplotlib.backends.BackendFilter.NON_INTERACTIVE`` +- ``None`` + +``BboxTransformToMaxOnly`` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +... is removed. It can be replaced by ``BboxTransformTo(LockableBbox(bbox, x0=0, y0=0))``. + +*interval* parameter of ``TimerBase.start`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The timer interval parameter can no longer be set while starting it. The interval can be specified instead in the timer constructor, or by setting the timer.interval attribute. diff --git a/doc/api/next_api_changes/removals/31588-ES.rst b/doc/api/next_api_changes/removals/31588-ES.rst new file mode 100644 index 000000000000..8709c5a77f5f --- /dev/null +++ b/doc/api/next_api_changes/removals/31588-ES.rst @@ -0,0 +1,18 @@ +``boxplot`` tick labels +^^^^^^^^^^^^^^^^^^^^^^^ + +The parameter *labels* has been removed in favour of *tick_labels* for clarity and +consistency with `~.Axes.bar`. + +Image path semantics of toolmanager-based tools +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Previously, MEP22 ("toolmanager-based") Tools would try to load their icon +(``tool.image``) relative to the current working directory, or, as a fallback, from +Matplotlib's own image directory. Because both approaches are problematic for +third-party tools (the end-user may change the current working directory at any time, +and third-parties cannot add new icons in Matplotlib's image directory), this behavior +has been removed; instead, ``tool.image`` is now interpreted relative to the directory +containing the source file where the ``Tool.image`` class attribute is defined. +(Defining ``tool.image`` as an absolute path also works and is compatible with both the +old and the new semantics.) diff --git a/doc/api/prev_api_changes/api_changes_0.90.1.rst b/doc/api/prev_api_changes/api_changes_0.90.1.rst index 89311d4ed102..8caef5e35ced 100644 --- a/doc/api/prev_api_changes/api_changes_0.90.1.rst +++ b/doc/api/prev_api_changes/api_changes_0.90.1.rst @@ -32,7 +32,7 @@ Changes for 0.90.1 named units.ConversionInterface.convert. Axes.errorbar uses Axes.vlines and Axes.hlines to draw its error - limits int he vertical and horizontal direction. As you'll see + limits in the vertical and horizontal direction. As you'll see in the changes below, these functions now return a LineCollection rather than a list of lines. The new return signature for errorbar is ylins, caplines, errorcollections where diff --git a/doc/api/prev_api_changes/api_changes_1.4.x.rst b/doc/api/prev_api_changes/api_changes_1.4.x.rst index 30f077995e44..915aa28a9f26 100644 --- a/doc/api/prev_api_changes/api_changes_1.4.x.rst +++ b/doc/api/prev_api_changes/api_changes_1.4.x.rst @@ -139,7 +139,7 @@ Code changes ``matplotlib.testing.image_util.autocontrast``. These will be removed completely in v1.5.0. -* The ``fmt`` argument of :meth:`~matplotlib.axes.Axes.plot_date` has been +* The ``fmt`` argument of ``Axes.plot_date`` has been changed from ``bo`` to just ``o``, so color cycling can happen by default. * Removed the class ``FigureManagerQTAgg`` and deprecated diff --git a/doc/api/prev_api_changes/api_changes_1.5.0.rst b/doc/api/prev_api_changes/api_changes_1.5.0.rst index b482d8bd7acd..513971098b93 100644 --- a/doc/api/prev_api_changes/api_changes_1.5.0.rst +++ b/doc/api/prev_api_changes/api_changes_1.5.0.rst @@ -189,7 +189,7 @@ algorithm that was not necessarily applicable to custom Axes. Three new private methods, ``matplotlib.axes._base._AxesBase._get_view``, ``matplotlib.axes._base._AxesBase._set_view``, and ``matplotlib.axes._base._AxesBase._set_view_from_bbox``, allow for custom -*Axes* classes to override the pan and zoom algorithms. Implementors of +*Axes* classes to override the pan and zoom algorithms. Implementers of custom *Axes* who override these methods may provide suitable behaviour for both pan and zoom as well as the view navigation buttons on the interactive toolbars. diff --git a/doc/api/prev_api_changes/api_changes_3.1.0.rst b/doc/api/prev_api_changes/api_changes_3.1.0.rst index 365476f54e3c..d5b2a1369cf1 100644 --- a/doc/api/prev_api_changes/api_changes_3.1.0.rst +++ b/doc/api/prev_api_changes/api_changes_3.1.0.rst @@ -533,7 +533,7 @@ The following miscellaneous API elements have been removed logger = logging.getLogger('matplotlib') logger.setLevel(logging.INFO) # configure log handling: Either include it into your ``logging`` hierarchy, - # e.g. by configuring a root looger using ``logging.basicConfig()``, + # e.g. by configuring a root logger using ``logging.basicConfig()``, # or add a standalone handler to the matplotlib logger: logger.addHandler(logging.StreamHandler()) diff --git a/doc/api/prev_api_changes/api_changes_3.10.1.rst b/doc/api/prev_api_changes/api_changes_3.10.1.rst index 26d43ddf8b17..71a2f71efc94 100644 --- a/doc/api/prev_api_changes/api_changes_3.10.1.rst +++ b/doc/api/prev_api_changes/api_changes_3.10.1.rst @@ -8,7 +8,7 @@ Behaviour ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When passing and array to ``imshow(..., alpha=...)``, the parameter was silently ignored -if the image data was a RGB or RBGA image or if :rc:`interpolation_state` +if the image data was an RGB or RBGA image or if :rc:`image.interpolation_stage` resolved to "rbga". This is now fixed, and the alpha array overwrites any previous transparency information. diff --git a/doc/api/prev_api_changes/api_changes_3.10.9.rst b/doc/api/prev_api_changes/api_changes_3.10.9.rst new file mode 100644 index 000000000000..592faadc347b --- /dev/null +++ b/doc/api/prev_api_changes/api_changes_3.10.9.rst @@ -0,0 +1,20 @@ +API Changes for 3.10.9 +====================== + + +Deprecations +------------ + + +Arbitrary code in ``axes.prop_cycle`` rcParam strings +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``axes.prop_cycle`` rcParam accepts Python expressions that are evaluated +in a limited context. The evaluation context has been further limited and some +expressions that previously worked (list comprehensions, for example) no longer +will. This change is made without a deprecation period to improve security. +The previously documented cycler operations at +https://matplotlib.org/cycler/ are still supported. + +This change was originally slated for v3.11.0 of Matplotlib, but was additionally +backported due to the security implications. diff --git a/doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst b/doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst index 742a18f04072..04836687f76a 100644 --- a/doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst +++ b/doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst @@ -47,7 +47,7 @@ type. See their documentation for the types they expect. Discouraged: ``plot_date`` ~~~~~~~~~~~~~~~~~~~~~~~~~~ -The use of `~.Axes.plot_date` is discouraged. This method exists for historic +The use of ``plot_date`` is discouraged. This method exists for historic reasons and may be deprecated in the future. - ``datetime``-like data should directly be plotted using `~.Axes.plot`. diff --git a/doc/api/prev_api_changes/api_changes_3.9.0/deprecations.rst b/doc/api/prev_api_changes/api_changes_3.9.0/deprecations.rst index 00469459d20a..2cf1df8c9579 100644 --- a/doc/api/prev_api_changes/api_changes_3.9.0/deprecations.rst +++ b/doc/api/prev_api_changes/api_changes_3.9.0/deprecations.rst @@ -4,7 +4,7 @@ Deprecations ``plot_date`` ^^^^^^^^^^^^^ -Use of `~.Axes.plot_date` has been discouraged since Matplotlib 3.5 and the function is +Use of ``plot_date`` has been discouraged since Matplotlib 3.5 and the function is now formally deprecated. - ``datetime``-like data should directly be plotted using `~.Axes.plot`. diff --git a/doc/api/pyplot_summary.rst b/doc/api/pyplot_summary.rst index d0def34c4995..97d9c576cc86 100644 --- a/doc/api/pyplot_summary.rst +++ b/doc/api/pyplot_summary.rst @@ -51,7 +51,6 @@ Basic plot errorbar scatter - plot_date step loglog semilogx @@ -61,9 +60,11 @@ Basic bar barh bar_label + grouped_bar stem eventplot pie + pie_label stackplot broken_barh vlines diff --git a/doc/api/ticker_api.rst b/doc/api/ticker_api.rst index 652050dafedc..ba8f4886b19f 100644 --- a/doc/api/ticker_api.rst +++ b/doc/api/ticker_api.rst @@ -5,6 +5,7 @@ .. automodule:: matplotlib.ticker :members: :undoc-members: + :special-members: __call__ :show-inheritance: diff --git a/doc/api/toolkits/axisartist.rst b/doc/api/toolkits/axisartist.rst index 5f58d134d370..2dec9cafa01d 100644 --- a/doc/api/toolkits/axisartist.rst +++ b/doc/api/toolkits/axisartist.rst @@ -4,7 +4,7 @@ =========================== The *axisartist* namespace provides a derived Axes implementation -(:class:`mpl_toolkits.axisartist.Axes`), designed to support curvilinear +(:class:`~mpl_toolkits.axisartist.axislines.Axes`), designed to support curvilinear grids. The biggest difference is that the artists that are responsible for drawing axis lines, ticks, ticklabels, and axis labels are separated out from Matplotlib's Axis class. diff --git a/doc/api/toolkits/mplot3d.rst b/doc/api/toolkits/mplot3d.rst index 0d860bd2cfea..4810bb742bd2 100644 --- a/doc/api/toolkits/mplot3d.rst +++ b/doc/api/toolkits/mplot3d.rst @@ -63,7 +63,7 @@ the toolbar pan and zoom buttons are not used. =================================== .. note:: - See :attr:`mpl_toolkits.mplot3d.axis3d._axinfo` for a dictionary containing + See :attr:`!mpl_toolkits.mplot3d.axis3d._axinfo` for a dictionary containing constants that may be modified for controlling the look and feel of mplot3d axes (e.g., label spacing, font colors and panel colors). Historically, axis3d has suffered from having hard-coded constants diff --git a/doc/api/toolkits/mplot3d/axes3d.rst b/doc/api/toolkits/mplot3d/axes3d.rst index 83cd8dd63cef..612b3dd82a4b 100644 --- a/doc/api/toolkits/mplot3d/axes3d.rst +++ b/doc/api/toolkits/mplot3d/axes3d.rst @@ -99,10 +99,16 @@ Axis limits and direction get_zlim set_zlim get_w_lims + get_xinverted + set_xinverted invert_xaxis xaxis_inverted + get_yinverted + set_yinverted invert_yaxis yaxis_inverted + get_zinverted + set_zinverted invert_zaxis zaxis_inverted get_xbound diff --git a/doc/api/toolkits/mplot3d/faq.rst b/doc/api/toolkits/mplot3d/faq.rst index e9ba804648e0..20fe81e574fe 100644 --- a/doc/api/toolkits/mplot3d/faq.rst +++ b/doc/api/toolkits/mplot3d/faq.rst @@ -6,8 +6,7 @@ mplot3d FAQ How is mplot3d different from Mayavi? ===================================== -`Mayavi `_ -is a very powerful and featureful 3D graphing library. For advanced +Mayavi_ is a very powerful and featureful 3D graphing library. For advanced 3D scenes and excellent rendering capabilities, it is highly recommended to use Mayavi. @@ -37,8 +36,7 @@ rendered properly in matplotlib's 2D rendering engine. This problem will likely not be solved until OpenGL support is added to all of the backends (patches are greatly welcomed). Until then, if you need complex -3D scenes, we recommend using -`MayaVi `_. +3D scenes, we recommend using Mayavi_. I don't like how the 3D plot is laid out, how do I change that? @@ -49,3 +47,5 @@ Work is being done to eliminate this issue. For matplotlib v1.1.0, there is a semi-official manner to modify these parameters. See the note in the :mod:`.mplot3d.axis3d` section of the mplot3d API documentation for more information. + +.. _Mayavi: https://docs.enthought.com/mayavi/mayavi/ diff --git a/doc/api/toolkits/mplot3d/view_angles.rst b/doc/api/toolkits/mplot3d/view_angles.rst index 75b24ba9c7b0..e4200cd2d0e4 100644 --- a/doc/api/toolkits/mplot3d/view_angles.rst +++ b/doc/api/toolkits/mplot3d/view_angles.rst @@ -11,8 +11,7 @@ The position of the viewport "camera" in a 3D plot is defined by three angles: *elevation*, *azimuth*, and *roll*. From the resulting position, it always points towards the center of the plot box volume. The angle direction is a common convention, and is shared with -`PyVista `_ and -`MATLAB `_. +`PyVista `_ and MATLAB_. Note that a positive roll angle rotates the viewing plane clockwise, so the 3d axes will appear to rotate counter-clockwise. @@ -51,8 +50,7 @@ can be specified by setting :rc:`axes3d.mouserotationstyle`, see :doc:`/users/explain/customizing`. Prior to v3.10, the 2D mouse position corresponded directly -to azimuth and elevation; this is also how it is done -in `MATLAB `_. +to azimuth and elevation; this is also how it is done in MATLAB_. To keep it this way, set ``mouserotationstyle: azel``. This approach works fine for spherical coordinate plots, where the *z* axis is special; however, it leads to a kind of 'gimbal lock' when looking down the *z* axis: @@ -131,7 +129,7 @@ Henriksen et al. [Henriksen2002]_ provide an overview. In summary: You can try out one of the various mouse rotation styles using: -.. code:: +.. code-block:: python import matplotlib as mpl mpl.rcParams['axes3d.mouserotationstyle'] = 'trackball' # 'azel', 'trackball', 'sphere', or 'arcball' @@ -188,6 +186,7 @@ the arcball to the border occurs at 45°, set the border width to The border is a circular arc, wrapped around the arcball sphere cylindrically (like a doughnut), joined smoothly to the sphere, much like Bell's hyperbola. +.. _MATLAB: https://www.mathworks.com/help/matlab/ref/view.html .. [Shoemake1992] Ken Shoemake, "ARCBALL: A user interface for specifying three-dimensional rotation using a mouse", in Proceedings of Graphics diff --git a/doc/api/typing_api.rst b/doc/api/typing_api.rst index 10582f8111d0..b63222eda43d 100644 --- a/doc/api/typing_api.rst +++ b/doc/api/typing_api.rst @@ -2,18 +2,62 @@ ``matplotlib.typing`` ********************* +.. automodule:: matplotlib.typing + :no-members: + :no-undoc-members: + +.. types are written out explicitly as `.. autodata::` directives, so that we + can meaningfully group them in sections. + test_typing.py::test_typing_aliases_documented ensures that the documented + types are in sync with the actual types defined in matplotlib.typing. + +Color +===== + +.. autodata:: matplotlib.typing.ColorType .. autodata:: matplotlib.typing.RGBColorType -.. autodata:: matplotlib.typing.RGBColourType .. autodata:: matplotlib.typing.RGBAColorType -.. autodata:: matplotlib.typing.RGBAColourType -.. autodata:: matplotlib.typing.ColorType .. autodata:: matplotlib.typing.ColourType +.. autodata:: matplotlib.typing.RGBColourType +.. autodata:: matplotlib.typing.RGBAColourType + +Artist styles +============= + .. autodata:: matplotlib.typing.LineStyleType .. autodata:: matplotlib.typing.DrawStyleType .. autodata:: matplotlib.typing.MarkEveryType +.. autodata:: matplotlib.typing.MarkerType .. autodata:: matplotlib.typing.FillStyleType .. autodata:: matplotlib.typing.CapStyleType .. autodata:: matplotlib.typing.JoinStyleType + +Events +====== + +.. autodata:: matplotlib.typing.MouseEventType +.. autodata:: matplotlib.typing.KeyEventType +.. autodata:: matplotlib.typing.DrawEventType +.. autodata:: matplotlib.typing.PickEventType +.. autodata:: matplotlib.typing.ResizeEventType +.. autodata:: matplotlib.typing.CloseEventType +.. autodata:: matplotlib.typing.EventType + +rcParams and stylesheets +======================== + +.. autodata:: matplotlib.typing.RcKeyType +.. autodata:: matplotlib.typing.RcGroupKeyType .. autodata:: matplotlib.typing.RcStyleType + +Other types +=========== + +.. autodata:: matplotlib.typing.CoordsType +.. autodata:: matplotlib.typing.LegendLocType +.. autodata:: matplotlib.typing.LogLevel .. autodata:: matplotlib.typing.HashableList - :annotation: Nested list with Hashable values + + +.. intentionally undocumented types (one type per row) + CoordsBaseType diff --git a/doc/api/widgets_api.rst b/doc/api/widgets_api.rst index 014361e70377..30b6c6758d6b 100644 --- a/doc/api/widgets_api.rst +++ b/doc/api/widgets_api.rst @@ -2,11 +2,54 @@ ``matplotlib.widgets`` ********************** -.. inheritance-diagram:: matplotlib.widgets +.. currentmodule:: matplotlib.widgets + +.. automodule:: matplotlib.widgets + :no-members: + :no-undoc-members: + + +Widget classes +============== + +.. inheritance-diagram:: matplotlib.widgets.Widget :parts: 1 + :private-bases: + :include-subclasses: +.. autosummary:: + :toctree: _as_gen + :template: autosummary.rst + :nosignatures: -.. automodule:: matplotlib.widgets - :members: - :undoc-members: - :show-inheritance: + Widget + AxesWidget + Cursor + MultiCursor + Button + _Buttons + CheckButtons + RadioButtons + SliderBase + Slider + RangeSlider + TextBox + _SelectorWidget + RectangleSelector + EllipseSelector + Lasso + LassoSelector + PolygonSelector + SpanSelector + SubplotTool + +Helper classes +============== + +.. autosummary:: + :toctree: _as_gen + :nosignatures: + + LockDraw + ToolHandles + ToolLineHandles diff --git a/doc/conf.py b/doc/conf.py index 96738492b68b..6651383fcacb 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -57,7 +57,7 @@ def _parse_skip_subdirs_file(): can make partial builds very fast. """ default_skip_subdirs = [ - 'users/prev_whats_new/*', 'users/explain/*', 'api/*', 'gallery/*', + 'release/prev_whats_new/*', 'users/explain/*', 'api/*', 'gallery/*', 'tutorials/*', 'plot_types/*', 'devel/*'] try: with open(".mpl_skip_subdirs.yaml", 'r') as fin: @@ -102,6 +102,14 @@ def _parse_skip_subdirs_file(): # usage in the gallery. warnings.filterwarnings('error', append=True) +# Warnings for missing glyphs occur during `savefig`, and would cause any such plot to +# not be created. Because the exception occurs in savefig, there is no way for the plot +# itself to ignore these warnings locally, so we must do so globally. +warnings.filterwarnings('default', category=UserWarning, + message=r'Glyph \d+ \(.+\) missing from font\(s\)') +warnings.filterwarnings('default', category=UserWarning, + message=r'Matplotlib currently does not support .+ natively\.') + # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ @@ -124,7 +132,7 @@ def _parse_skip_subdirs_file(): 'sphinxext.math_symbol_table', 'sphinxext.missing_references', 'sphinxext.mock_gui_toolkits', - 'sphinxext.skip_deprecated', + 'sphinxext.rcparams', 'sphinxext.redirect_from', 'sphinx_copybutton', 'sphinx_design', @@ -186,6 +194,7 @@ def _check_dependencies(): gallery_order_sectionorder = 'sphinxext.gallery_order.sectionorder' gallery_order_subsectionorder = 'sphinxext.gallery_order.subsectionorder' clear_basic_units = 'sphinxext.util.clear_basic_units' + patch_header = 'sphinxext.util.patch_header' matplotlib_reduced_latex_scraper = 'sphinxext.util.matplotlib_reduced_latex_scraper' else: # gallery_order.py from the sphinxext folder provides the classes that @@ -193,15 +202,14 @@ def _check_dependencies(): from sphinxext.gallery_order import ( sectionorder as gallery_order_sectionorder, subsectionorder as gallery_order_subsectionorder) - from sphinxext.util import clear_basic_units, matplotlib_reduced_latex_scraper + from sphinxext.util import (clear_basic_units, matplotlib_reduced_latex_scraper, + patch_header) if parse_version(sphinx_gallery.__version__) >= parse_version('0.17.0'): sg_matplotlib_animations = (True, 'mp4') else: sg_matplotlib_animations = True -# The following import is only necessary to monkey patch the signature later on -from sphinx_gallery import gen_rst # Prevent plt.show() from emitting a non-GUI backend warning. warnings.filterwarnings('ignore', category=UserWarning, @@ -262,11 +270,12 @@ def autodoc_process_bases(app, name, obj, options, bases): 'dateutil': ('https://dateutil.readthedocs.io/en/stable/', None), 'ipykernel': ('https://ipykernel.readthedocs.io/en/latest/', None), 'numpy': ('https://numpy.org/doc/stable/', None), - 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None), + 'pandas': ('https://pandas.pydata.org/docs/', None), 'pytest': ('https://pytest.org/en/stable/', None), 'python': ('https://docs.python.org/3/', None), 'scipy': ('https://docs.scipy.org/doc/scipy/', None), 'tornado': ('https://www.tornadoweb.org/en/stable/', None), + 'wx': ('https://docs.wxpython.org/', None), 'xarray': ('https://docs.xarray.dev/en/stable/', None), 'meson-python': ('https://mesonbuild.com/meson-python/', None), 'pip': ('https://pip.pypa.io/en/stable/', None), @@ -284,6 +293,7 @@ def autodoc_process_bases(app, name, obj, options, bases): sphinx_gallery_conf = { 'backreferences_dir': Path('api', '_as_gen'), + 'minigallery_sort_order': 'sphinxext.gallery_order.preserve_order', # Compression is a significant effort that we skip for local and CI builds. 'compress_images': ('thumbnails', 'images') if is_release_build else (), 'doc_module': ('matplotlib', 'mpl_toolkits'), @@ -299,7 +309,7 @@ def autodoc_process_bases(app, name, obj, options, bases): 'reference_url': {'matplotlib': None, 'mpl_toolkits': None}, 'prefer_full_module': {r'mpl_toolkits\.'}, 'remove_config_comments': True, - 'reset_modules': ('matplotlib', clear_basic_units), + 'reset_modules': ('matplotlib', clear_basic_units, patch_header), 'subsection_order': gallery_order_sectionorder, 'thumbnail_size': (320, 224), 'within_subsection_order': gallery_order_subsectionorder, @@ -347,31 +357,6 @@ def gallery_image_warning_filter(record): mathmpl_fontsize = 11.0 mathmpl_srcset = ['2x'] -# Monkey-patching gallery header to include search keywords -gen_rst.EXAMPLE_HEADER = """ -.. DO NOT EDIT. -.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. -.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: -.. "{0}" -.. LINE NUMBERS ARE GIVEN BELOW. - -.. only:: html - - .. meta:: - :keywords: codex - - .. note:: - :class: sphx-glr-download-link-note - - :ref:`Go to the end ` - to download the full example code.{2} - -.. rst-class:: sphx-glr-example-title - -.. _sphx_glr_{1}: - -""" - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -587,7 +572,7 @@ def js_tag_with_cache_busting(js): # no sidebar for release notes, because that page is only a collection of links # to sub-pages. The sidebar would repeat all the titles of the sub-pages and # thus basically repeat all the content of the page. - "users/release_notes": ["empty_sidebar.html"], + "release/release_notes": ["empty_sidebar.html"], # '**': ['localtoc.html', 'pagesource.html'] } @@ -852,58 +837,6 @@ def linkcode_resolve(domain, info): extensions.append('sphinx.ext.viewcode') -def generate_ScalarMappable_docs(): - - import matplotlib.colorizer - from numpydoc.docscrape_sphinx import get_doc_object - from pathlib import Path - import textwrap - from sphinx.util.inspect import stringify_signature - target_file = Path(__file__).parent / 'api' / 'scalarmappable.gen_rst' - with open(target_file, 'w') as fout: - fout.write(""" -.. class:: ScalarMappable(colorizer, **kwargs) - :canonical: matplotlib.colorizer._ScalarMappable - -""") - for meth in [ - matplotlib.colorizer._ScalarMappable.autoscale, - matplotlib.colorizer._ScalarMappable.autoscale_None, - matplotlib.colorizer._ScalarMappable.changed, - """ - .. attribute:: colorbar - - The last colorbar associated with this ScalarMappable. May be None. -""", - matplotlib.colorizer._ScalarMappable.get_alpha, - matplotlib.colorizer._ScalarMappable.get_array, - matplotlib.colorizer._ScalarMappable.get_clim, - matplotlib.colorizer._ScalarMappable.get_cmap, - """ - .. property:: norm -""", - matplotlib.colorizer._ScalarMappable.set_array, - matplotlib.colorizer._ScalarMappable.set_clim, - matplotlib.colorizer._ScalarMappable.set_cmap, - matplotlib.colorizer._ScalarMappable.set_norm, - matplotlib.colorizer._ScalarMappable.to_rgba, - ]: - if isinstance(meth, str): - fout.write(meth) - else: - name = meth.__name__ - sig = stringify_signature(inspect.signature(meth)) - docstring = textwrap.indent( - str(get_doc_object(meth)), - ' ' - ).rstrip() - fout.write(f""" - .. method:: {name}{sig} -{docstring} - -""") - - # ----------------------------------------------------------------------------- # Sphinx setup # ----------------------------------------------------------------------------- @@ -917,4 +850,4 @@ def setup(app): app.connect('autodoc-process-bases', autodoc_process_bases) if sphinx.version_info[:2] < (7, 1): app.connect('html-page-context', add_html_cache_busting, priority=1000) - generate_ScalarMappable_docs() + app.config.autodoc_use_legacy_class_based = True diff --git a/doc/devel/MEP/MEP10.rst b/doc/devel/MEP/MEP10.rst index 9e9650587f55..2b39959eaca7 100644 --- a/doc/devel/MEP/MEP10.rst +++ b/doc/devel/MEP/MEP10.rst @@ -44,8 +44,7 @@ these new features. Numpy docstring format ---------------------- -`Numpy docstring format -`_: +`Numpy docstring format `_: This format divides the docstring into clear sections, each having different parsing rules that make the docstring easy to read both as raw text and as HTML. We could consider alternatives, or invent our diff --git a/doc/devel/MEP/MEP11.rst b/doc/devel/MEP/MEP11.rst index aee44ae9a0e4..03bc3013b3e3 100644 --- a/doc/devel/MEP/MEP11.rst +++ b/doc/devel/MEP/MEP11.rst @@ -130,7 +130,7 @@ ordered from best/hardest to worst/easiest): 1. The distutils wininst installer allows a post-install script to run. It might be possible to get this script to run pip_ to install the other dependencies. (See `this thread - `_ + `_ for someone who has trod that ground before). 2. Continue to ship dateutil_, pytz_, six_ and pyparsing_ in @@ -177,4 +177,4 @@ out of the box. .. _pytz: https://pypi.org/project/pytz/ .. _setuptools: https://pypi.org/project/setuptools/ .. _six: https://pypi.org/project/six/ -.. _easy_install: https://setuptools.readthedocs.io/en/latest/easy_install.html +.. _easy_install: https://setuptools.pypa.io/en/latest/deprecated/easy_install.html diff --git a/doc/devel/MEP/MEP14.rst b/doc/devel/MEP/MEP14.rst index 2c696adf8a58..d79d3c2d3115 100644 --- a/doc/devel/MEP/MEP14.rst +++ b/doc/devel/MEP/MEP14.rst @@ -78,7 +78,7 @@ number of other projects: - `Microsoft DirectWrite`_ - `Apple Core Text`_ -.. _pango: https://pango.gnome.org +.. _pango: https://github.com/GNOME/pango .. _harfbuzz: https://github.com/harfbuzz/harfbuzz .. _QtTextLayout: https://doc.qt.io/archives/qt-4.8/qtextlayout.html .. _Microsoft DirectWrite: https://docs.microsoft.com/en-ca/windows/win32/directwrite/introducing-directwrite diff --git a/doc/devel/api_changes.rst b/doc/devel/api_changes.rst index 6e134d6b9509..6880cf10ae62 100644 --- a/doc/devel/api_changes.rst +++ b/doc/devel/api_changes.rst @@ -13,8 +13,8 @@ the API and any changes, either semantic or aesthetic, are backwards-incompatibl API changes. -Add new API and features ------------------------- +Add new API +----------- Every new function, parameter and attribute that is not explicitly marked as private (i.e., starts with an underscore) becomes part of Matplotlib's public @@ -32,6 +32,20 @@ take particular care when adding new API: __ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters +Add new rcParams +^^^^^^^^^^^^^^^^ + +When adding a new rcParam, the following files must be updated: + +1. :file:`lib/matplotlib/rcsetup.py` - Add a validator entry to the + ``_validators`` dict and a corresponding ``_Param`` entry with default value + and description. +2. :file:`lib/matplotlib/mpl-data/matplotlibrc` - Add a commented-out entry + showing the default value. +3. :file:`lib/matplotlib/typing.py` - Add the key to the ``RcKeyType`` Literal + so that it is recognized as a valid rcParam key. + + Add or change colormaps, color sequences, and styles ---------------------------------------------------- Visual changes are considered an API break. Therefore, we generally do not modify @@ -54,6 +68,36 @@ them. While the decision is case-by-case, evaluation criteria include: Deprecate API ------------- +When deciding to deprecate API we carefully consider the balance between the advantages +(clearer interfaces, better usability, less maintenance) and the disadvantages (users +have to learn new API and have to modify existing code). + +.. tip:: + + A rough estimate on the current usage of an API can be obtained by a GitHub code + search. A good search pattern is typically + ``[expression] language:Python NOT is:fork``. ``[expression]`` may be a simple + string, but often regular expressions are helpful to exclude incorrect matches. + You can start simple and look at the search results, if there are too many + incorrect matches, gradually refine your search criteria. + + It can also be helpful to add ``NOT path:**/matplotlib/** NOT path:**/site-packages/**`` + to exclude matches where the matplotlib codebase is checked into another repo, + either as direct sources or as part of an environment. + + *Example*: Calls of the method ``Figure.draw()`` could be matched using + ``/\bfig(ure)?\.draw\(/``. This expression employs a number of patterns: + + - Add the opening bracket ``(`` after the method name to only find method calls. + - Include a common object name if there are otherwise too many false positives. + There are many ``draw()`` functions out there, but the ones we are looking for + are likely called via ``fig.draw()`` or ``figure.draw()``. + - Use the word boundary marker ``\b`` to make sure your expression is not a + matching as part of a longer word. + + `Link to the resulting GitHub search `_ + + API changes in Matplotlib have to be performed following the deprecation process below, except in very rare circumstances as deemed necessary by the development team. Generally API deprecation happens in two stages: @@ -62,11 +106,12 @@ team. Generally API deprecation happens in two stages: * **expire:** API *is* changed as described in the introduction period This ensures that users are notified before the change will take effect and thus -prevents unexpected breaking of code. +prevents unexpected breaking of code. Occasionally deprecations are marked as +**pending**, which means that the deprecation will be introduced in a future release. Rules ^^^^^ -- Deprecations are targeted at the next :ref:`meso release ` (e.g. 3.x) +- Deprecations are targeted at the next :ref:`meso release ` (e.g. 3.Y) - Deprecated API is generally removed (expired) two point-releases after introduction of the deprecation. Longer deprecations can be imposed by core developers on a case-by-case basis to give more time for the transition @@ -76,12 +121,17 @@ Rules - If in doubt, decisions about API changes are finally made by the `API consistency lead `_ developer. + .. _intro-deprecation: Introduce deprecation ^^^^^^^^^^^^^^^^^^^^^ -#. Create :ref:`deprecation notice ` +Deprecations are introduced to warn users that the API will change. The deprecation +notice describes how the API will change. When alternatives to the deprecated API exist, +they are also listed in the notice and decorators. + +#. Create a :ref:`deprecation notice ` #. If possible, issue a `~matplotlib.MatplotlibDeprecationWarning` when the deprecated API is used. There are a number of helper tools for this: @@ -117,8 +167,10 @@ Introduce deprecation Expire deprecation ^^^^^^^^^^^^^^^^^^ +The API changes described in the introduction notice are only implemented after the +introduction period has expired. -#. Create :ref:`deprecation announcement `. For the content, +#. Create a :ref:`deprecation announcement `. For the content, you can usually copy the deprecation notice and adapt it slightly. #. Change the code functionality and remove any related deprecation warnings. @@ -137,6 +189,35 @@ Expire deprecation instead. For removed items that were not in the stub file, only deleting from the allowlist is required. +.. _pending-deprecation: + +Pending deprecation +^^^^^^^^^^^^^^^^^^^ + +A pending deprecation is an announcement that a deprecation will be introduced in the +future. By default, pending deprecations do not raise a warning to the user; however, +pending deprecations are rendered in the documentation and listed in the release notes. +Pending notices are primarily intended to give downstream library and tool developers +time to adapt their code so that it does not raise a deprecation +warning. This is because their users cannot act on warnings triggered by how the tools +and libraries use Matplotlib. It's also possible to run Python in dev mode to raise +`PendingDeprecationWarning`. + +To mark a deprecation as pending, set the following parameters on the appropriate +deprecation decorator: +* the *pending* parameter is set to ``True`` +* the *removal* parameter is left blank + +When converting a pending deprecation to an introduced deprecation, update the +decorator such that: +* *pending* is set to ``False`` +* *since* is set to the next meso release (3.Y+1) +* *removal* is set to at least 2 meso releases after (3.Y+3) introduction. + +Pending deprecations are documented in the :ref:`API change notes ` in +the same manner as introduced and expired deprecations. The notice should include +*pending deprecation* in the title. + .. redirect-from:: /devel/coding_guide#new-features-and-api-changes @@ -147,12 +228,13 @@ Announce new and deprecated API When adding or changing the API in a backward in-compatible way, please add the appropriate :ref:`versioning directive ` and document it -for the release notes and add the entry to the appropriate folder: +in the :ref:`release notes ` by adding an entry to the appropriate +folder: +-------------------+-----------------------------+----------------------------------------------+ | | versioning directive | announcement folder | +===================+=============================+==============================================+ -| new feature | ``.. versionadded:: 3.N`` | :file:`doc/users/next_whats_new/` | +| new feature | ``.. versionadded:: 3.N`` | :file:`doc/release/next_whats_new/` | +-------------------+-----------------------------+----------------------------------------------+ | API change | ``.. versionchanged:: 3.N`` | :file:`doc/api/next_api_changes/[kind]` | +-------------------+-----------------------------+----------------------------------------------+ @@ -215,6 +297,8 @@ For classes and functions, the directive should be placed before the end of the parameter description. The micro release version is omitted and the directive should not be added to entire modules. +.. _release-notes: + Release notes ^^^^^^^^^^^^^ @@ -236,6 +320,28 @@ API change notes What's new notes """""""""""""""" -.. include:: ../users/next_whats_new/README.rst +.. include:: ../release/next_whats_new/README.rst :start-after: whats-new-guide-start :end-before: whats-new-guide-end + +Discourage API +-------------- + +We have API that we do not recommend anymore for new code, but that cannot be +deprecated because its removal would be breaking backward-compatibility and too +disruptive. In such a case we can formally discourage API. This can cover +specific parameters, call patterns, whole methods etc. + +To do so, add a note to the docstring :: + + .. admonition:: Discouraged + + [description and suggested alternative] + +You find several examples for good descriptions if you search the codebase for +``.. admonition:: Discouraged``. + +Additionally, if a whole function is discouraged, prefix the summary line with +``[*Discouraged*]`` so that it renders in the API overview like this + + [*Discouraged*] Return the XAxis instance. diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index 36802de49bd0..45259c61efdd 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -15,22 +15,28 @@ consistency, and maintainability of the code base. .. _code-style: -PEP8, as enforced by flake8 -=========================== +PEP8, as enforced by ruff +========================= -Formatting should follow the recommendations of PEP8_, as enforced by flake8_. +Formatting should follow the recommendations of PEP8_, as enforced by ruff_. Matplotlib modifies PEP8 to extend the maximum line length to 88 -characters. You can check flake8 compliance from the command line with :: +characters. You can check PEP8 compliance from the command line with :: + + python -m pip install ruff + ruff check /path/to/module.py + +or your editor may provide integration with it. To check all files, +and fix any errors in-place (where possible) run :: - python -m pip install flake8 - flake8 /path/to/module.py + ruff check --fix -or your editor may provide integration with it. Note that Matplotlib intentionally -does not use the black_ auto-formatter (1__), in particular due to its inability -to understand the semantics of mathematical expressions (2__, 3__). + +Matplotlib intentionally does not use the black_ auto-formatter (1__), +in particular due to its inability to understand the semantics of +mathematical expressions (2__, 3__). .. _PEP8: https://www.python.org/dev/peps/pep-0008/ -.. _flake8: https://flake8.pycqa.org/ +.. _ruff: https://docs.astral.sh/ruff/ .. _black: https://black.readthedocs.io/ .. __: https://github.com/matplotlib/matplotlib/issues/18796 .. __: https://github.com/psf/black/issues/148 @@ -125,6 +131,44 @@ C/C++ extensions implement new features only if the required changes cannot be made elsewhere in the codebase. In particular, avoid making style fixes to it. +.. _clang-tidy: + +Static analysis with clang-tidy +------------------------------- + +Matplotlib's C/C++ sources in :file:`src/` are checked with +`clang-tidy `__ in CI (see +:file:`.github/workflows/linting.yml`). The check +configuration lives in :file:`.clang-tidy`. + +The logic lives in :file:`tools/run_clang_tidy.py`. It requires +``clang-tidy`` on ``PATH`` and ``meson`` and ``pybind11`` installed:: + + pip install meson pybind11 setuptools-scm + +On macOS, ``clang-tidy`` is not on ``PATH`` after a Homebrew install:: + + brew install llvm + export PATH=$(brew --prefix llvm)/bin:$PATH + +The script uses a dedicated ``build/clang-tidy/`` directory (created +automatically on first run) and delegates to meson's built-in +``clang-tidy`` target. To run locally: + +.. code-block:: bash + + python tools/run_clang_tidy.py + + +To suppress false-positives use narrow checks and a comment: + +.. code-block:: c++ + + *indices++ = value; // NOLINT(clang-analyzer-security.ArrayBound): loop + // iterates exactly N times; the analyzer cannot prove this from the macro. + + + .. _keyword-argument-processing: Keyword argument processing @@ -184,8 +228,8 @@ local arguments and the rest are passed on as .. _using_logging: -Using logging for debug messages -================================ +Use logging for debug messages +============================== Matplotlib uses the standard Python `logging` library to write verbose warnings, information, and debug messages. Please use it! In all those places @@ -209,7 +253,7 @@ If an end-user of Matplotlib sets up `logging` to display at levels more verbose than ``logging.WARNING`` in their code with the Matplotlib-provided helper:: - plt.set_loglevel("debug") + plt.set_loglevel("DEBUG") or manually with :: diff --git a/doc/devel/communication_guide.rst b/doc/devel/communication_guide.rst index 04c5dae93bdc..a0056b80e606 100644 --- a/doc/devel/communication_guide.rst +++ b/doc/devel/communication_guide.rst @@ -10,10 +10,10 @@ community venue managed by Matplotlib. Our approach to community engagement is foremost guided by our :ref:`mission-statement`: -* We demonstrate that we care about visualization as a practice +* We demonstrate that we care about visualization as a practice. * We deepen our practice and the community’s capacity to support users, facilitate exploration, produce high quality visualizations, and be - understandable and extensible + understandable and extensible. * We showcase advanced use of the library without adding maintenance burden to the documentation and recognize contributions that happen outside of the github workflow. @@ -27,20 +27,81 @@ Our approach to community engagement is foremost guided by our :ref:`mission-sta by creating educational resources, building third party tools, and building informal mentoring networks. + +Moderation +========== +Moderation rights are granted specific to each :ref:`official platform `. +All matplotlib maintainers are moderators on github. If you are interested in moderating +any of the other platforms: + +* Matplotlib maintainers should reach out to the `community-manager`_. +* Everyone else should send an email to matplotlib-social-admin@numfocus.org: + + * Introduce yourself - GitHub handle and participation in the community. + * Explain why you want moderation rights + +Enforcement responsibilities +---------------------------- +Any person with moderation rights is granted the authority to clarify and +enforce our standards of expected behavior. This is a supplement to our Code of Conduct, +not a replacement; moderators should make use of the :ref:`code_of_conduct` process for +CoC violations. In addition violations of platform specific terms of service should be +reported to that platform. + +Moderators may hide, edit, or reject comments, commits, code, wiki edits, issues, and +other contributions that do not comply with our :ref:`contributing guidelines `. +Deletion should only be used to remove sensitive information that can not be removed +through edits. On most platforms, these actions can be accessed through the [...] context +menu. + +Communication +^^^^^^^^^^^^^ +After taking action, Moderators should publicly communicate their reasons for +doing so to the user when possible, e.g. when doing so will not reveal sensitive +information. When the situation is sensitive, moderators should reassess whether the +situation would be better handled through the code of conduct process and attempt to +communicate privately with the user (e.g. DMs) if appropriate. + +Consequences +^^^^^^^^^^^^ +Moderators have the right and responsibility to enforce consequences for disruptive +behavior. Moderators are welcome to consult on levying consequences in the ``staff`` +discourse channel. When possible, this should be done in the following stages: + +* warn: alert the user of their misconduct and how they can remedy the situation + - this can be done privately and then publicly if the behavior persists + - second warning should mention consequence of not heeding warning +* temporary ban: apply a short term ban from the platform (default 1 week) + - temporary bans can be applied in increasing increments at the moderator's discretion +* permanent ban from the platform + +If the user has not modified their behavior in an acceptable fashion, then the moderator +can move to the next stage. Moderators should notify the other maintainers of temporary +and permanent bans via the ``staff`` discourse channel or at the weekly developer meeting. +When feasible, moderators should also maintain a record of the unacceptable behavior. If +the user would like to appeal a ban (on any platform), moderators should make use of the +code of conduct process to resolve the situation by directing the user to file a code of +conduct report. + +Moderators may immediately ban users in extenuating circumstance, such as while a +CoC or TOS report is being investigated or when the user is an agent or bot. Moderators +should file a code of conduct report for (human) users they feel should be permanently +banned from all platforms. + + .. _communication-channels: -Official communication channels -=============================== -The Scientific Python community uses various communications platforms to stay -updated on new features and projects, to contribute by telling us what is on -their mind and suggest issues and bugs, and to showcase their use cases and the -tools they have built. +Official project platforms +========================== +The Scientific Python community uses various platforms to stay updated on new features +and projects, to contribute by telling us what is on their mind and suggest issues and +bugs, and to showcase their use cases and the tools they have built. The following venues are managed by Matplotlib maintainers and contributors: * library and docs: https://github.com/matplotlib/matplotlib * forum: https://discourse.matplotlib.org/ -* chat: `https://matrix.to/#/#matplotlib:matrix.org `_ +* chat: `https://discourse.matplotlib.org/chat/c/community/3 `_ * blog: https://blog.scientific-python.org/ .. _social-media: @@ -51,13 +112,14 @@ Social media Active social media ^^^^^^^^^^^^^^^^^^^ -* https://twitter.com/matplotlib +* https://bsky.app/profile/matplotlib.bsky.social +* https://fosstodon.org/@matplotlib +* https://x.com/matplotlib * https://instagram.com/matplotart/ Official accounts ^^^^^^^^^^^^^^^^^ -* https://bsky.app/profile/matplotlib.bsky.social -* https://fosstodon.org/@matplotlib + * https://www.tiktok.com/@matplotart * https://www.youtube.com/matplotlib @@ -76,22 +138,7 @@ Mailing lists Social media coordination ------------------------- * Team mailing list: matplotlib-social@numfocus.org -* Public chat room: `https://matrix.to/#/#matplotlib_community:gitter.im `_ - - -Maintenance ------------ - -If you are interested in moderating the chat or forum or accessing the social -media accounts: - -* Matplotlib maintainers should reach out to the `community-manager`_. - -* Everyone else should send an email to matplotlib-social-admin@numfocus.org: - - * Introduce yourself - github handle and participation in the community. - * Describe the reason for wanting to moderate or contribute to social. - +* Public chat room on Discourse: `Community `_ Content guidelines ================== @@ -104,6 +151,8 @@ guidelines, ask on the :ref:`social-media-coordination` channels before posting. General guidelines ------------------ +* Do not share information that violates Matplotlib's :ref:`code of conduct ` or does not align with Matplotlib's :ref:`mission-statement`. + * Focus on Matplotlib, 3rd party packages, and visualizations made with Matplotlib. * These are also acceptable topics: @@ -117,14 +166,15 @@ General guidelines * Follow communication best practices: - * Do not share non-expert visualizations when it could cause harm: + * Do not share non-expert visualizations when it could cause harm, e.g.: - * e.g. https://twitter.com/matplotlib/status/1244178154618605568 + * Could the information affect someone's decisions in a way that impacts their personal health or safety? + * Could the information be used as part of a politicised debate? * Clearly state when the visualization data/conclusions cannot be verified. * Do not rely on machine translations for sensitive visualization. -* Verify sourcing of content (especially on instagram & blog): +* Verify sourcing of content (especially on Instagram & blog): * Instagram/blog: ensure mpl has right to repost/share content * Make sure content is clearly cited: @@ -144,7 +194,7 @@ Specifically: * Visual media must conform to the guidelines of all sites it may be posted on: - * https://help.twitter.com/en/rules-and-policies/twitter-rules + * https://help.x.com/en/rules-and-policies/x-rules * https://help.instagram.com/477434105621119 * Emphasize the visualization techniques demonstrated by the visual media. @@ -211,7 +261,7 @@ On social media, Matplotlib: * Highlights various parts of the library, especially the more obscure bits and bobbles. * Acknowledges that it is a sometimes frustrating tangle of bits & bobbles that - can confuse even the folks who work on it & signal boosts their confuzzlment. + can confuse even the folks who work on it & signal boosts their confuzzlement. Behavior @@ -258,8 +308,8 @@ Changing the guidelines As the person tasked with implementing these guidelines, the `community-manager`_ should be alerted to proposed changes. Similarly, specific platform guidelines -(e.g. twitter, instagram) should be reviewed by the person responsible for that -platform, when different from the community manager. If there is no consensus, +(e.g. github, discourse, Instagram) should be reviewed by the person responsible for +that platform, when different from the community manager. If there is no consensus, decisions about guidelines revert to the community manager. .. _community-manager: https://matplotlib.org/governance/people.html#deputy-project-leads diff --git a/doc/devel/contribute.rst b/doc/devel/contribute.rst index 0e7a9ef5115e..9d95f8a9808f 100644 --- a/doc/devel/contribute.rst +++ b/doc/devel/contribute.rst @@ -21,18 +21,18 @@ Ways to contribute :open: :icon: person-fill - 100% yes! There are so many ways to contribute to our community. Take a look - at the following sections to learn more. - - There are a few typical new contributor profiles: + Here are a few typical new contributor profiles. If you + don't fit into one of them, come talk to us on `Discourse + `_ about how you might contribute. * **You are a Matplotlib user, and you see a bug, a potential improvement, or something that annoys you, and you can fix it.** - You can search our issue tracker for an existing issue that describes your problem or + You can search our `issue tracker `__ + for an existing issue that describes your problem or open a new issue to inform us of the problem you observed and discuss the best approach to fix it. If your contributions would not be captured on GitHub (social media, - communication, educational content), you can also reach out to us on gitter_, + communication, educational content), you can also reach out to us on `Discourse `__ or attend any of our `community meetings `__. @@ -40,16 +40,13 @@ Ways to contribute visualization, 3D plotting, design, technical writing, statistics, or some other field where Matplotlib could be improved.** - Awesome -- you have a focus on a specific application and domain and can + Awesome — you have a focus on a specific application and domain and can start there. In this case, maintainers can help you figure out the best - implementation; open an issue or pull request with a starting point, and we'll - be happy to discuss technical approaches. + implementation; `open an issue `__ + in our issue tracker, and we'll be happy to discuss technical approaches. - If you prefer, you can use the `GitHub functionality for "draft" pull requests - `__ - and request early feedback on whatever you are working on, but you should be - aware that maintainers may not review your contribution unless it has the - "Ready to review" state on GitHub. + If you can implement the solution yourself, even better! Consider contributing + the change as a :ref:`pull request ` right away. * **You are new to Matplotlib, both as a user and contributor, and want to start contributing but have yet to develop a particular interest.** @@ -62,12 +59,14 @@ Ways to contribute chance it is a unique context in any given conversation) and make it easier to understand where other people are coming from. - Understanding the entire codebase is a long-term project, and nobody expects - you to do this right away. If you are determined to get started with - Matplotlib and want to learn, going through the basic functionality, - choosing something to focus on (3d, testing, documentation, animations, etc.) - and gaining context on this area by reading the issues and pull requests - touching these subjects is a reasonable approach. + Understanding the entire codebase is a long-term project, and nobody + expects you to do this right away. Start by building your experience in + using Matplotlib: make complicated visualizations, use niche features, + dive deep into one part of the library. This will help you build the + context to then look at the existing issues and pull requests. You can + then reach out to us at the :ref:`new contributor ` + meeting or Discourse channel (incubator) to discuss what you would like + to work on. .. _contribute_code: @@ -165,7 +164,7 @@ we mean by triage are: Our triage process is discussed in detail in :ref:`bug_triaging`. If you have any questions about the process, please reach out on the -:ref:`contributor_incubator` +:ref:`contributor_incubator`. .. _other_ways_to_contribute: @@ -186,27 +185,56 @@ If you have developed an extension to Matplotlib, please consider adding it to o .. _generative_ai: +Use of Generative AI +==================== + +Generative AI tools are evolving rapidly and can be helpful. As with any tool, +the resulting contribution is the responsibility of the human contributor. We +expect dedicated and authentic engagement in our community. In particular when +using AI, carefully consider what and how to communicate, question results, +think things through thoroughly and make well-informed decisions. + +Some examples of acceptable and unacceptable AI uses are: + +.. grid:: 1 1 2 2 + + .. grid-item:: + + :octicon:`check;1em;sd-text-success` **Acceptable uses** -Restrictions on Generative AI Usage -=================================== + - Gaining understanding of the existing code + - Getting solution ideas + - Translating or proof-reading your comments or PR descriptions. Please keep + the wording as close as possible to your original wording. -We expect authentic engagement in our community. Be wary of posting output -from Large Language Models or similar generative AI as comments on GitHub or -our discourse server, as such comments tend to be formulaic and low content. -If you use generative AI tools as an aid in developing code or documentation -changes, ensure that you fully understand the proposed changes and can explain -why they are the correct approach and an improvement to the current state. + .. grid-item:: + :octicon:`x;1em;sd-text-danger` **Unacceptable uses** + + - External AI tooling (e.g. bots, agents) directly interacting with the project; + including creating issues, PRs or commenting on GitHub or Discourse. + - Solving topics that you wouldn't be able to solve yourself without AI + - Using AI output without ensuring that you fully understand the output or + without verifying that it is the correct approach. + - Increasing breadth of contributions, i.e. simultaneously contributing to several + projects. Instead of spreading your resources, you can provide greater value + by engaging more deeply with one or two projects. + +To ensure project health and preserve limited core developer capacity, we will flag +and reject low-value contributions that we believe are AI generated. We may ban +and/or report users to GitHub if they harm the project or its community through +irresponsible use of AI. .. _new_contributors: New contributors ================ -There is no pre-defined pathway for new contributors - we recommend looking at -existing issue and pull request discussions, and following the conversations -during pull request reviews to get context. Or you can deep-dive into a subset -of the code-base to understand what is going on. +Everyone comes to the project from a different place — in terms of experience +and interest — so there is no one-size-fits-all path to getting involved. We +recommend looking at existing issue or pull request discussions, and following +the conversations during pull request reviews to get context. Or you can +deep-dive into a subset of the code-base to understand what is going on. .. _new_contributors_meeting: @@ -223,8 +251,8 @@ you can browse previous meeting notes on `GitHub `_. We recommend joining the meeting to clarify any doubts, or lingering questions you might have, and to get to know a few of the people behind the -GitHub handles 😉. You can reach out to us on gitter_ for any clarifications or -suggestions. We ❤ feedback! +GitHub handles 😉. You can reach out to us on `incubator chat`_ for any +clarifications or suggestions. We ❤ feedback! .. _contributor_incubator: @@ -232,41 +260,34 @@ Contributor incubator --------------------- The incubator is our non-public communication channel for new contributors. It -is a private gitter_ (chat) room moderated by core Matplotlib developers where -you can get guidance and support for your first few PRs. It's a place where you -can ask questions about anything: how to use git, GitHub, how our PR review -process works, technical questions about the code, what makes for good +is a public chat room on Discourse_ moderated by core Matplotlib developers +where you can get guidance and support for your first few PRs. It's a place +where you can ask questions about anything: how to use git, GitHub, how our PR +review process works, technical questions about the code, what makes for good documentation or a blog post, how to get involved in community work, or get a "pre-review" on your PR. -To join, please go to our public community_ channel, and ask to be added to -``#incubator``. One of our core developers will see your message and will add you. +To join, go to Discourse_ and click on the chat bubble icon next to the search +icon at the top right of the page. Then, find the "Incubator" channel. -.. _gitter: https://gitter.im/matplotlib/matplotlib -.. _community: https://gitter.im/matplotlib/community +.. _Discourse: https://discourse.matplotlib.org/ +.. _development chat: https://discourse.matplotlib.org/chat/c/matplotlib/2 +.. _community chat: https://discourse.matplotlib.org/chat/c/community/3 +.. _incubator chat: https://discourse.matplotlib.org/chat/c/incubator/4 .. _good_first_issues: Good first issues ----------------- -While any contributions are welcome, we have marked some issues as -particularly suited for new contributors by the label `good first issue -`_. These -are well documented issues, that do not require a deep understanding of the -internals of Matplotlib. The issues may additionally be tagged with a -difficulty. ``Difficulty: Easy`` is suited for people with little Python -experience. ``Difficulty: Medium`` and ``Difficulty: Hard`` require more -programming experience. This could be for a variety of reasons, among them, -though not necessarily all at the same time: - -- The issue is in areas of the code base which have more interdependencies, - or legacy code. -- It has less clearly defined tasks, which require some independent - exploration, making suggestions, or follow-up discussions to clarify a good - path to resolve the issue. -- It involves Python features such as decorators and context managers, which - have subtleties due to our implementation decisions. +We have marked some issues as `good first issue +`_ because we +think they are a good entry point into the process of contributing to Matplotlib. These +issues are well documented, do not require a deep understanding of the internals of +Matplotlib, and do not need urgent resolution. Good first issues are intended to onboard +newcomers with a genuine interest in improving Matplotlib, in the hopes that they will +continue to participate in our development community; therefore, pull requests that are +:ref:`AI generated ` will be closed. .. _first_contribution: @@ -282,15 +303,28 @@ guide you through each step: & `"Good first Issue" `_ (optional). 3. Click on an issue you would like to work on, and check to see if the issue has a pull request opened to resolve it. - * A good way to judge if you chose a suitable issue is by asking yourself, "Can I independently submit a PR in 1-2 weeks?" + * A good way to judge if you chose a suitable issue is by asking yourself, "Can I + independently submit a PR in a reasonable time frame?" This should (at most) + be a few days for an easy issue. If it takes longer, let us know why. + * If you are new to open source, we strongly recommend that you do not choose a + complicated issue for your first contribution - please ask in the incubator + channel if you need help gauging the complexity of the work. 4. Check existing pull requests (e.g., :ghpull:`28476`) and filter by the issue number to make sure the issue is not in progress: * If the issue has a pull request (is in progress), tag the user working on the issue, and ask to collaborate (optional). - * If a pull request does not exist, create a `draft pull request `_ and follow the `pull request guidelines `_. + * If there is no pull request, :ref:`create a new pull request `. 5. Please familiarize yourself with the pull request template (see below), and ensure you understand/are able to complete the template when you open your pull request. Additional information can be found in the `pull request guidelines `_. +.. important:: + + Make sure you finish addressing any review comments on your first PR and wait + for it to be merged (or closed) before opening a new one. It can be a valuable + learning experience to go through the review process and to get feedback on + your contribution, while also helping maintainers spend their time + effectively. + .. dropdown:: `Pull request template `_ :open: @@ -305,12 +339,10 @@ Get connected When in doubt, we recommend going together! Get connected with our community of active contributors, many of whom felt just like you when they started out and are happy to welcome you and support you as you get to know how we work, and -where things are. You can reach out on any of our :ref:`communication-channels`. -For development questions we recommend reaching out on our development gitter_ -chat room and for community questions reach out at community_. - -.. _gitter: https://gitter.im/matplotlib/matplotlib -.. _community: https://gitter.im/matplotlib/community +where things are. You can reach out on any of our :ref:`communication-channels`, +including the chat space on Discourse_. For development questions we recommend +reaching out on our `development chat`_ and for community questions reach out at +the `community chat`_. .. _managing_issues_prs: @@ -327,6 +359,22 @@ a new PR; duplicate PRs are subject to being closed. However, if the existing PR is an outline, unlikely to work, or stalled, and the original author is unresponsive, feel free to open a new PR referencing the old one. +Difficulty +---------- +Issues may additionally be tagged with a difficulty. ``Difficulty: Easy`` is suitable +for people with beginner scientific Python experience, i.e. fluency with Python syntax +and some experience using libraries like Numpy, Pandas, or Xarray. ``Difficulty: Medium`` +and ``Difficulty: Hard`` require more programming experience. This could be for a variety +of reasons, for example: + +- requires understanding intermediate to advanced Python features, such as decorators, + context managers, or meta-programming +- is in areas of the code base which have more interdependencies or is legacy code. +- involves complex or significant changes to algorithms or architecture. + +Generally, the difficulty level is correlated with how much conceptual (and contextual) +understanding of Matplotlib is required to resolve it. + .. _how-to-pull-request: Start a pull request @@ -334,19 +382,21 @@ Start a pull request The preferred way to contribute to Matplotlib is to fork the `main repository `__ on GitHub, -then submit a "pull request" (PR). To work on a a pull request: +then submit a "pull request" (PR). To work on a pull request: #. **First** set up a development environment, either by cloning a copy of the Matplotlib repository to your own computer or by using Github codespaces, by following the instructions in :ref:`installing_for_devs` -#. **Then** start a pull request by following the guidance in :ref:`development workflow ` +#. **Then** start solving the issue, following the guidance in + :ref:`development workflow ` -#. **After starting** check that your contribution meets the :ref:`pull request guidelines ` - and :ref:`update the pull request ` as needed. +#. **As part of verifying your changes** check that your contribution meets + the :ref:`pull request guidelines ` + and then :ref:`open a pull request `. #. **Finally** follow up with maintainers on the PR if waiting more than a few days for - feedback. + feedback. :ref:`Update the pull request ` as needed. If you have questions of any sort, reach out on the :ref:`contributor_incubator` and join the :ref:`new_contributors_meeting`. diff --git a/doc/devel/development_setup.rst b/doc/devel/development_setup.rst index cffda17939a7..2ee9193c9fa5 100644 --- a/doc/devel/development_setup.rst +++ b/doc/devel/development_setup.rst @@ -14,9 +14,9 @@ .. _installing_for_devs: -===================================== -Setting up Matplotlib for development -===================================== +================= +Development setup +================= To set up Matplotlib for development follow these steps: @@ -34,8 +34,31 @@ repository, you should first fork this repository by *clicking* the This creates a copy of the code under your account on the GitHub server. See `the GitHub documentation `__ for more details. -Retrieve the latest version of the code -======================================= +Set up development environment +============================== + +You can either work locally on your machine, or online in +`GitHub Codespaces`_, a cloud-based in-browser development +environment. + + +:local: If you are making extensive or frequent contributions to Matplotlib then it + is probably worth taking the time to set up on your local machine: As well as + having the convenience of your local familiar tools, you will not need to worry + about Codespace's monthly usage limits. + +:codespaces: If you are making a one-off, relatively simple, change then working in + GitHub Codespaces can be a good option because most of the setting + up is done for you and you can skip the next few sections. + +If you want to use Codespaces, skip to :ref:`development-codespaces`, +otherwise, continue with the next section. + +Create local environment +------------------------ + +Get most recent code +^^^^^^^^^^^^^^^^^^^^ Now that your fork of the repository lives under your GitHub username, you can retrieve the most recent version of the source code with one of the following @@ -96,8 +119,8 @@ code, as described in :ref:`development-workflow`. * `GitHub-Contributing to a Project `_ * `GitHub Skills `_ - * :ref:`using-git` - * :ref:`git-resources` + * :external+scipy:ref:`using-git` + * :external+scipy:ref:`git-resources` * `Installing git `_ * `Managing remote repositories `_ @@ -107,7 +130,8 @@ code, as described in :ref:`development-workflow`. .. _dev-environment: Create a dedicated environment -============================== +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + You should set up a dedicated environment to decouple your Matplotlib development from other Python and Matplotlib installations on your system. @@ -126,18 +150,35 @@ setup. python -m venv - and activate it with one of the following :: + and activate it with one of the following : + + .. tab-set:: + + .. tab-item:: Linux and macOS + + .. code-block:: bash + + source /bin/activate # Linux/macOS + + .. tab-item:: Windows cmd.exe + + .. code-block:: bat + + \Scripts\activate.bat - source /bin/activate # Linux/macOS - \Scripts\activate.bat # Windows cmd.exe - \Scripts\Activate.ps1 # Windows PowerShell + .. tab-item:: Windows PowerShell + + .. code-block:: ps1con + + \Scripts\Activate.ps1 On some systems, you may need to type ``python3`` instead of ``python``. For a discussion of the technical reasons, see `PEP-394 `_. Install the Python dependencies with :: - pip install -r requirements/dev/dev-requirements.txt + pip install -U pip # You may skip this step if pip 25.1 is already available. + pip install --group dev Remember to activate the environment whenever you start working on Matplotlib! @@ -158,64 +199,69 @@ setup. Remember to activate the environment whenever you start working on Matplotlib! - .. tab-item:: :octicon:`codespaces` GitHub Codespaces - `GitHub Codespaces `_ is a cloud-based - in-browser development environment that comes with the appropriate setup to - contribute to Matplotlib. +Install external dependencies +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Python dependencies were installed as part of :ref:`setting up the environment `. +Additionally, the following non-Python dependencies must also be installed locally: + +.. rst-class:: checklist - #. Open codespaces on your fork by clicking on the green :octicon:`code` ``Code`` - button on the GitHub web interface and selecting the ``Codespaces`` tab. +* :ref:`compile-build-dependencies` +* :ref:`external tools used by the documentation build ` - #. Next, click on "Open codespaces on ". You will be - able to change branches later, so you can select the default - ``main`` branch. - #. After the codespace is created, you will be taken to a new browser - tab where you can use the terminal to activate a pre-defined conda - environment called ``mpl-dev``:: +For a full list of dependencies, see :ref:`dependencies`. External dependencies do not +need to be installed when working in codespaces. - conda activate mpl-dev +.. _development-codespaces: - Remember to activate the *mpl-dev* environment whenever you start working on - Matplotlib. +Create GitHub Codespace :octicon:`codespaces` +--------------------------------------------- - If you need to open a GUI window with Matplotlib output on Codespaces, our - configuration includes a `light-weight Fluxbox-based desktop - `_. - You can use it by connecting to this desktop via your web browser. To do this: +`GitHub Codespaces`_ is a cloud-based +in-browser development environment that comes with the appropriate setup to +contribute to Matplotlib. - #. Press ``F1`` or ``Ctrl/Cmd+Shift+P`` and select - ``Ports: Focus on Ports View`` in the VSCode session to bring it into - focus. Open the ports view in your tool, select the ``noVNC`` port, and - click the Globe icon. - #. In the browser that appears, click the Connect button and enter the desktop - password (``vscode`` by default). +#. Open codespaces on your fork by clicking on the green :octicon:`code` ``Code`` + button on the GitHub web interface and selecting the ``Codespaces`` tab. - Check the `GitHub instructions - `_ - for more details on connecting to the desktop. +#. Next, click on "Open codespaces on ". You will be + able to change branches later, so you can select the default + ``main`` branch. - If you also built the documentation pages, you can view them using Codespaces. - Use the "Extensions" icon in the activity bar to install the "Live Server" - extension. Locate the ``doc/build/html`` folder in the Explorer, right click - the file you want to open and select "Open with Live Server." +#. After the codespace is created, you will be taken to a new browser + tab where you can use the terminal to activate a pre-defined conda + environment called ``mpl-dev``:: + conda activate mpl-dev -Install external dependencies -============================= +Remember to activate the *mpl-dev* environment whenever you start working on +Matplotlib. -Python dependencies were installed as part of :ref:`setting up the environment `. -Additionally, the following non-Python dependencies must also be installed locally: +If you need to open a GUI window with Matplotlib output on Codespaces, our +configuration includes a `light-weight Fluxbox-based desktop +`_. +You can use it by connecting to this desktop via your web browser. To do this: -.. rst-class:: checklist +#. Press ``F1`` or ``Ctrl/Cmd+Shift+P`` and select + ``Ports: Focus on Ports View`` in the VSCode session to bring it into + focus. Open the ports view in your tool, select the ``noVNC`` port, and + click the Globe icon. +#. In the browser that appears, click the Connect button and enter the desktop + password (``vscode`` by default). -* :ref:`c++ compiler` -* :ref:`documentation build dependencies ` +Check the `GitHub instructions +`_ +for more details on connecting to the desktop. +If you also built the documentation pages, you can view them using Codespaces. +Use the "Extensions" icon in the activity bar to install the "Live Server" +extension. Locate the ``doc/build/html`` folder in the Explorer, right click +the file you want to open and select "Open with Live Server." -For a full list of dependencies, see :ref:`dependencies`. External dependencies do not -need to be installed when working in codespaces. +.. _Github Codespaces: https://docs.github.com/codespaces .. _development-install: @@ -225,7 +271,7 @@ Install Matplotlib in editable mode Install Matplotlib in editable mode from the :file:`matplotlib` directory using the command :: - python -m pip install --verbose --no-build-isolation --editable ".[dev]" + python -m pip install --verbose --no-build-isolation --group dev --editable . The 'editable/develop mode' builds everything and places links in your Python environment so that Python will be able to import Matplotlib from your development source directory. @@ -237,7 +283,7 @@ have :ghpull:`26621` in its history (log), you will have to reinstall from sourc each time you change any compiled extension code. If the installation is not working, please consult the :ref:`troubleshooting guide `. -If the guide does not offer a solution, please reach out via `chat `_ +If the guide does not offer a solution, please reach out via `discourse `_ or :ref:`open an issue `. @@ -277,7 +323,7 @@ you are aware of the existing issues beforehand. Install pre-commit hooks ======================== -`pre-commit `_ hooks save time in the review process by +`prek `_ hooks save time in the review process by identifying issues with the code before a pull request is formally opened. Most hooks can also aide in fixing the errors, and the checks should have corresponding :ref:`development workflow ` and @@ -288,8 +334,8 @@ committed files, import order, and incorrect branching. Install pre-commit hooks :: - python -m pip install pre-commit - pre-commit install + python -m pip install prek + prek install Hooks are run automatically after the ``git commit`` stage of the :ref:`editing workflow`. When a hook has found and fixed an error in a @@ -298,11 +344,11 @@ file, that file must be *staged and committed* again. Hooks can also be run manually. All the hooks can be run, in order as listed in ``.pre-commit-config.yaml``, against the full codebase with :: - pre-commit run --all-files + prek run --all-files -To run a particular hook manually, run ``pre-commit run`` with the hook id :: +To run a particular hook manually, run ``prek run`` with the hook id :: - pre-commit run --all-files + prek run --all-files Please note that the ``mypy`` pre-commit hook cannot check the :ref:`type-hints` diff --git a/doc/devel/development_workflow.rst b/doc/devel/development_workflow.rst index 438b93314171..99c7e29234aa 100644 --- a/doc/devel/development_workflow.rst +++ b/doc/devel/development_workflow.rst @@ -22,8 +22,7 @@ why you did it, we recommend the following: * Make a new branch for each feature or bug fix — "one task, one branch". * Name your branch for the purpose of the changes - e.g. ``bugfix-for-issue-14`` or ``refactor-database-code``. -* If you get stuck, reach out on Gitter or - `discourse `__. +* If you get stuck, reach out on `discourse `__. * When you're ready or need feedback on your code, open a pull request so that the Matplotlib developers can give feedback and eventually include your suggested code into the ``main`` branch. @@ -36,11 +35,11 @@ workflow is: #. Fetch all changes from ``upstream/main``:: - git fetch upstream/main + git fetch upstream #. Start a new *feature branch* from ``upstream/main``:: - git checkout -b my-feature upstream/main + git checkout -b my-new-feature upstream/main #. When you're done editing, e.g., ``lib/matplotlib/collections.py``, record your changes in Git:: @@ -49,7 +48,7 @@ workflow is: #. Push the changes to your GitHub fork:: - git push -u origin my-feature + git push -u origin my-new-feature .. _update-mirror-main: @@ -138,13 +137,31 @@ The editing workflow Note the ``-am`` options to ``commit``. The ``m`` flag signals that you are going to type a message on the command line. The ``a`` flag stages every file that has been modified, except files listed in ``.gitignore``. For more - information, see `why the -a flag?`_ and the - `git commit `_ manual page. + information, see the `git commit `_ manual page. #. To push the changes up to your forked repo on GitHub, do a ``git push``. -.. _why the -a flag?: http://gitready.com/beginner/2009/01/18/the-staging-area.html +Verify your changes +=================== + +Check that your change does what you intend. For code changes: + +* If the issue you are working on provided a code example, run that example + against your branch and check that you now get the desired result. Note that + adapting the issue example is often a good way to create a new test. + +* Run the tests to check that your change has not had unintended consequences + on existing functionality. See :ref:`run_tests`. + +For documentation changes, build the documentation locally to check that +it renders how you intended and that any new links work correctly. See +:ref:`build_docs`. + +This is also a good time to look through the :ref:`pr-author-guidelines` and +address as many of the relevant points as you can. + +.. _open-pull-request: Open a pull request =================== @@ -161,9 +178,9 @@ Enter a title for the set of changes with some explanation of what you've done. Mention anything you'd like particular attention for - such as a complicated change or some code you are not happy with. -If you don't think your request is ready to be merged, just say so in your pull -request message and use the "Draft PR" feature of GitHub. This is a good way of -getting some preliminary code review. +If you don't think your request is ready to be merged, make a +:ref:`draft pull request ` and state what aspects you want to have +feedback on. This is a good way of getting some preliminary code review. For more guidance on the mechanics of making a pull request, see GitHub's `pull request tutorial `_. @@ -232,15 +249,15 @@ If you notice you messed up after the rebase:: If you forgot to make a backup branch:: # look at the reflog of the branch - git reflog show cool-feature + git reflog show my-new-feature - 8630830 cool-feature@{0}: commit: BUG: io: close file handles immediately - 278dd2a cool-feature@{1}: rebase finished: refs/heads/my-feature-branch onto 11ee694744f2552d - 26aa21a cool-feature@{2}: commit: BUG: lib: make seek_gzip_factory not leak gzip obj + 8630830 my-new-feature@{0}: commit: BUG: io: close file handles immediately + 278dd2a my-new-feature@{1}: rebase finished: refs/heads/my-new-feature onto 11ee694744f2552d + 26aa21a my-new-feature@{2}: commit: BUG: lib: make seek_gzip_factory not leak gzip obj ... # reset the branch to where it was before the botched rebase - git reset --hard cool-feature@{2} + git reset --hard my-new-feature@{2} .. _rewriting-commit-history: @@ -258,73 +275,85 @@ This can be done via *interactive rebasing*. Suppose that the commit history looks like this:: - git log --oneline - eadc391 Fix some remaining bugs - a815645 Modify it so that it works - 2dec1ac Fix a few bugs + disable - 13d7934 First implementation - 6ad92e5 * masked is now an instance of a new object, MaskedConstant - 29001ed Add pre-nep for a copule of structured_array_extensions. + $ git log --oneline + b7e99a8659 (HEAD -> my-new-feature) Fix some remaining bugs + 8a5de78b17 Modify it so that it works + 34448c69eb Fix a few bugs + disable + 9a5d1ca186 First implementation + d1da6fbf0b (upstream/main) Merge pull request #30778 from timhoffm/decorator-tracebackhide + 6ad937ad83 Merge pull request #30838 from has2k1/fix-numpy-integer-markers ... -and ``6ad92e5`` is the last commit in the ``cool-feature`` branch. Suppose we +and ``b7e99a8659`` is the most recent commit in the ``my-new-feature`` branch. Suppose we want to make the following changes: -* Rewrite the commit message for ``13d7934`` to something more sensible. -* Combine the commits ``2dec1ac``, ``a815645``, ``eadc391`` into a single one. +* Rewrite the commit message for ``9a5d1ca186`` to something more specific. +* Combine the commits ``34448c69eb``, ``8a5de78b17``, ``b7e99a8659`` into a single one. We do as follows:: # make a backup of the current state git branch tmp HEAD # interactive rebase - git rebase -i 6ad92e5 + git rebase -i d1da6fbf0b This will open an editor with the following text in it:: - pick 13d7934 First implementation - pick 2dec1ac Fix a few bugs + disable - pick a815645 Modify it so that it works - pick eadc391 Fix some remaining bugs + pick 9a5d1ca186 First implementation + pick 34448c69eb Fix a few bugs + disable + pick 8a5de78b17 Modify it so that it works + pick b7e99a8659 Fix some remaining bugs - # Rebase 6ad92e5..eadc391 onto 6ad92e5 + # Rebase d1da6fbf0b..b7e99a8659 onto d1da6fbf0b (4 commands) # # Commands: - # p, pick = use commit - # r, reword = use commit, but edit the commit message - # e, edit = use commit, but stop for amending - # s, squash = use commit, but meld into previous commit - # f, fixup = like "squash", but discard this commit's log message + # p, pick = use commit + # r, reword = use commit, but edit the commit message + # e, edit = use commit, but stop for amending + # s, squash = use commit, but meld into previous commit + # f, fixup [-C | -c] = like "squash" but keep only the previous + # commit's log message, unless -C is used, in which case + # keep only this commit's message; -c is same as -C but + # opens the editor + # x, exec = run command (the rest of the line) using shell + # b, break = stop here (continue rebase later with 'git rebase --continue') + # d, drop = remove commit + # l, label