diff --git a/.appveyor.yml b/.appveyor.yml index c3fcb0ea9591..13705adc99f9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -94,7 +94,7 @@ on_finish: - 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..94090783b764 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 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 bf483dbdd4f4..06cd0d2fd3bf 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,13 +14,15 @@ 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 +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..ba29818c46de 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,9 @@ updates: actions: patterns: - "*" + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + exclude-paths: + - "ci/minver-requirements.txt" 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..7e0fbd2055e9 --- /dev/null +++ b/.github/workflows/autoclose_schedule.yml @@ -0,0 +1,37 @@ +--- +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 + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.13' + - name: Install PyGithub + run: pip install -Uq PyGithub + + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - 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 6920b4cee2de..905955e7fea0 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,16 +36,18 @@ jobs: ) name: Build sdist runs-on: ubuntu-latest + permissions: + contents: read outputs: SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }} steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: false - - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 name: Install Python with: python-version: '3.11' @@ -72,7 +73,7 @@ jobs: run: twine check dist/* - name: Upload sdist result - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 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: >- @@ -137,13 +140,13 @@ jobs: steps: - name: Download sdist - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: cibw-sdist path: dist/ - name: Build wheels for CPython 3.14 - uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -153,7 +156,7 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 - name: Build wheels for CPython 3.13 - uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -162,7 +165,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.12 - uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -170,7 +173,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.11 - uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -178,7 +181,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -187,7 +190,7 @@ jobs: CIBW_ENABLE: pypy if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest' && matrix.os != 'windows-11-arm' - - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: cibw-wheels-${{ runner.os }}-${{ matrix.cibw_archs }} path: ./wheelhouse/*.whl diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 05a30eb032cb..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' }}" @@ -28,7 +31,7 @@ jobs: runs-on: ubuntu-latest name: Post warnings/errors as review steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false diff --git a/.github/workflows/clean_pr.yml b/.github/workflows/clean_pr.yml index 5107bb92fa1c..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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - 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 2aa1ce9f911d..83f47a0e27bf 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1 with: languages: ${{ matrix.language }} @@ -43,4 +45,4 @@ jobs: pip install --user -v . - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1 diff --git a/.github/workflows/conflictcheck.yml b/.github/workflows/conflictcheck.yml index f4a687cd28d7..2058da8ca9fb 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' diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index ae80020e08b7..bd9ec07de39f 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: false - - uses: cygwin/cygwin-install-action@f2009323764960f80959895c7bc3bb30210afe4d # v6 + - 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@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 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@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 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@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 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' || diff --git a/.github/workflows/good-first-issue.yml b/.github/workflows/good-first-issue.yml index 5bb69db0595c..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' @@ -18,13 +21,16 @@ jobs: 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 17c4922df054..2914c64a8461 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: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index bcc7d406043a..e73165c504d8 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -2,22 +2,23 @@ name: Linting on: [pull_request] -permissions: - contents: read +permissions: {} jobs: pre-commit: name: precommit runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: false - - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: "3.x" - - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 + - uses: j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1 with: extra_args: --hook-stage manual --all-files @@ -25,14 +26,15 @@ jobs: name: ruff runs-on: ubuntu-latest permissions: + contents: read checks: write steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Python 3 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: '3.11' @@ -54,19 +56,20 @@ jobs: name: mypy runs-on: ubuntu-latest permissions: + contents: read checks: write steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Python 3 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: '3.11' - name: Install mypy - run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt + run: pip3 install --group build --group typing - name: Set up reviewdog uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0 @@ -85,9 +88,10 @@ jobs: name: eslint runs-on: ubuntu-latest permissions: + contents: read checks: write steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false diff --git a/.github/workflows/mypy-stubtest.yml b/.github/workflows/mypy-stubtest.yml index dad980b4fae9..81fcd48462e8 100644 --- a/.github/workflows/mypy-stubtest.yml +++ b/.github/workflows/mypy-stubtest.yml @@ -2,22 +2,22 @@ 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Python 3 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: '3.11' diff --git a/.github/workflows/nightlies.yml b/.github/workflows/nightlies.yml index e8ff8ad7acbc..661234c3e16f 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,28 +32,28 @@ 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/ diff --git a/.github/workflows/pr_welcome.yml b/.github/workflows/pr_welcome.yml index 2580b5a008a0..48691e61d87b 100644 --- a/.github/workflows/pr_welcome.yml +++ b/.github/workflows/pr_welcome.yml @@ -1,37 +1,51 @@ --- 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@1c4688942c71f71d4f5502a26ea67c331730fa4d # v3.1.0 + - uses: plbstl/first-contribution@7c31f41b0e7a70adfcae06cf964679f61af6780b # v4.3.0 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - pr_message: >+ + labels: first-contribution + 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/stale-tidy.yml b/.github/workflows/stale-tidy.yml index 1d0d42ce761b..feb1fe701d70 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@997185467fa4f803885201cee163a9f38240193d # v10.1.1 + - uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 300 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index a61a0b2e92c8..63f1a1ce3b05 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -4,12 +4,17 @@ on: schedule: - 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@997185467fa4f803885201cee163a9f38240193d # v10.1.1 + - uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 20 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e066f6d9d296..d0298805eefa 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 @@ -50,14 +52,14 @@ jobs: - name-suffix: "(Minimum Versions)" os: ubuntu-22.04 python-version: '3.11' - extra-requirements: '-c requirements/testing/minver.txt' + extra-requirements: '-c ci/minver-requirements.txt' delete-font-cache: true # https://github.com/matplotlib/matplotlib/issues/29844 pygobject-ver: '<3.52.0' - os: ubuntu-22.04 python-version: '3.11' CFLAGS: "-fno-lto" # Ensure that disabling LTO works. - extra-requirements: '-r requirements/testing/extra.txt' + extra-requirements: '--group test-extra' # https://github.com/matplotlib/matplotlib/issues/29844 pygobject-ver: '<3.52.0' - name-suffix: "(Extra TeX packages)" @@ -73,6 +75,8 @@ jobs: pygobject-ver: '<3.52.0' - os: ubuntu-24.04 python-version: '3.12' + - 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. @@ -87,15 +91,19 @@ jobs: python-version: '3.13' # https://github.com/matplotlib/matplotlib/issues/29732 pygobject-ver: '<3.52.0' + - 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - 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@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true @@ -178,23 +186,25 @@ jobs: esac - name: Cache pip - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 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@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 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@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 with: path: | ~/.ccache @@ -202,7 +212,7 @@ jobs: restore-keys: | ${{ matrix.os }}-py${{ matrix.python-version }}-ccache- - name: Cache Matplotlib - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 with: path: | ~/.cache/matplotlib @@ -227,12 +237,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 @@ -264,8 +270,8 @@ jobs: # 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 + if [[ "${{ matrix.os }}" != 'macos-14' && "${{ matrix.python-version }}" == '3.11' + ]]; then python -mpip install --upgrade pyside2 && python -c 'import PySide2.QtCore' && echo 'PySide2 is available' || @@ -389,12 +395,12 @@ jobs: fi - name: Upload code coverage if: ${{ !cancelled() && github.event_name != 'schedule' }} - uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }}" token: ${{ secrets.CODECOV_TOKEN }} - - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 if: failure() with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }} result images" diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml new file mode 100644 index 000000000000..578acc7f8c6e --- /dev/null +++ b/.github/workflows/wasm.yml @@ -0,0 +1,62 @@ +--- +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" + + - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: cibw-wheels-wasm + path: ./wheelhouse/*.whl + if-no-files-found: error diff --git a/.gitignore b/.gitignore index 9389a1612b14..0460152a792f 100644 --- a/.gitignore +++ b/.gitignore @@ -104,6 +104,10 @@ __conda_version__.txt lib/png.lib lib/z.lib +# uv files # +############ +uv.lock + # Environments # ################ .env diff --git a/.mailmap b/.mailmap index 44005da6e2d8..bbadcb8ff879 100644 --- a/.mailmap +++ b/.mailmap @@ -11,6 +11,8 @@ Alon Hershenhorn Alvaro Sanchez +Andreas C Mueller Andreas Mueller + Andrew Dawson anykraus @@ -32,6 +34,8 @@ Carsten Schelp Casper van der Wel +CharlesHe16 + Chris Holdgraf Cho Yin Yong @@ -57,6 +61,8 @@ David Kua Devashish Deshpande +Diego Leal Petrola + Dietmar Schwertberger Dora Fraeman Caswell @@ -84,16 +90,26 @@ Hajoon Choi hannah +Hannes Breytenbach + Hans Moritz Günther Harshal Prakash Patankar Harshit Patni +Harutaka Kawamura + +Hood Chatham Hood + +Ian Hunt-Isaak + ImportanceOfBeingErnest J. Goutin JGoutin +Jakub Klus <48711526+deep-jkl@users.noreply.github.com> + Jack Kelly Jack Kelly @@ -105,6 +121,8 @@ Jake Vanderplas James R. Evans +Jan-Hendrik Müller <44469195+kolibril13@users.noreply.github.com> + Jeff Lutgen Jeffrey Bingham @@ -112,12 +130,18 @@ Jeffrey Bingham Jens Hedegaard Nielsen Jens Hedegaard Nielsen +Jerome F. Villegas + 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 @@ -149,11 +173,15 @@ Leon Yin Lion Krischer +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> @@ -215,6 +243,8 @@ Paul Ivanov Per Parker +Péter Leéh + Peter Würtz Peter Würtz @@ -222,12 +252,18 @@ Phil Elson Phil Elson Phil Elson +Philipp Nagel + productivememberofsociety666 none Rishikesh +Ruth Nainggolan Ruth G. N <32371319+ruthgn@users.noreply.github.com> + RyanPan +Richard Sheridan + Samesh Lakhotia Samesh Lakhotia <43701530+sameshl@users.noreply.github.com> ' @@ -236,6 +272,8 @@ Scott Lasley Sebastian Raschka Sebastian Raschka +ShawnChen1996 + Sidharth Bansal Sidharth Bansal <20972099+SidharthBansal@users.noreply.github.com> @@ -257,6 +295,7 @@ 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”> diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11499188509e..4bba747d451b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,6 +5,7 @@ ci: exclude: | (?x)^( extern| + subprojects/packagefiles| LICENSE| lib/matplotlib/mpl-data| doc/devel/gitwash| diff --git a/README.md b/README.md index 8f9edaad2b5b..bbbbec35331e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![LFX Health Score](https://insights.linuxfoundation.org/api/badge/health-score?project=matplotlib)](https://insights.linuxfoundation.org/project/matplotlib) [![Discourse help forum](https://img.shields.io/badge/help_forum-discourse-blue.svg)](https://discourse.matplotlib.org) -[![Gitter](https://badges.gitter.im/matplotlib/matplotlib.svg)](https://gitter.im/matplotlib/matplotlib) +[![Discourse chat](https://img.shields.io/badge/chat-discourse-mediumaquamarine)](https://discourse.matplotlib.org/chat/c/matplotlib/2) [![GitHub issues](https://img.shields.io/badge/issue_tracking-github-blue.svg)](https://github.com/matplotlib/matplotlib/issues) [![Contributing](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://matplotlib.org/stable/devel/index.html) @@ -61,9 +61,9 @@ Our active mailing lists (which are mirrored on Discourse) are: - [Development](https://mail.python.org/mailman/listinfo/matplotlib-devel) mailing list: -[Gitter](https://gitter.im/matplotlib/matplotlib) is for coordinating -development and asking questions directly related to contributing to -matplotlib. +[Discourse Chat](https://discourse.matplotlib.org/chat/c/matplotlib/2) is for +coordinating development and asking questions directly related to contributing +to matplotlib. ## Citing Matplotlib diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d68a9d36f0d3..829a1c7b9005 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -74,8 +74,8 @@ stages: - bash: | python -m pip install --upgrade pip - python -m pip install --upgrade -r requirements/dev/build-requirements.txt - python -m pip install -r requirements/testing/all.txt -r requirements/testing/extra.txt + python -m pip install --upgrade --group build + python -m pip install --prefer-binary --group test --group test-extra displayName: 'Install dependencies with pip' - bash: | diff --git a/requirements/testing/minver.txt b/ci/minver-requirements.txt similarity index 100% rename from requirements/testing/minver.txt rename to ci/minver-requirements.txt diff --git a/ci/mypy-stubtest-allowlist.txt b/ci/mypy-stubtest-allowlist.txt index 12b6feb9b2e0..359168608edf 100644 --- a/ci/mypy-stubtest-allowlist.txt +++ b/ci/mypy-stubtest-allowlist.txt @@ -28,7 +28,6 @@ matplotlib\.ticker\.LogitLocator\.nonsingular # Stdlib/Enum considered inconsistent (no fault of ours, I don't think) matplotlib\.backend_bases\._Mode\.__new__ -matplotlib\.units\.Number\.__hash__ # 3.6 Pending deprecations matplotlib\.figure\.Figure\.set_constrained_layout diff --git a/doc/_static/multipage_pdf_thumbnail.svg b/doc/_static/multipage_pdf_thumbnail.svg new file mode 100644 index 000000000000..864c4c647492 --- /dev/null +++ b/doc/_static/multipage_pdf_thumbnail.svg @@ -0,0 +1,12 @@ + + + + + + + + + + Multipage + PDF + diff --git a/doc/_static/switcher.json b/doc/_static/switcher.json index 3912afd8a17d..36e743db21b8 100644 --- a/doc/_static/switcher.json +++ b/doc/_static/switcher.json @@ -1,7 +1,7 @@ [ { "name": "3.10 (stable)", - "version": "3.10.7", + "version": "3.10.8", "url": "https://matplotlib.org/stable/", "preferred": true }, 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 f5af8744a2bc..1f5f3e403bee 100644 --- a/doc/api/axes_api.rst +++ b/doc/api/axes_api.rst @@ -450,6 +450,7 @@ Units Axes.convert_yunits Axes.have_units +.. _axes-api-adding-artists: Adding artists ============== @@ -628,6 +629,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/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/behavior/28437-CH.rst b/doc/api/next_api_changes/behavior/28437-CH.rst index 6121dfec8163..9d0161b6aac9 100644 --- a/doc/api/next_api_changes/behavior/28437-CH.rst +++ b/doc/api/next_api_changes/behavior/28437-CH.rst @@ -1,8 +1,11 @@ *alpha* parameter handling on images ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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` -resolved to "rbga". +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". -This is now fixed, and the alpha array overwrites any previous transparency information. +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/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/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/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/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/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/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/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/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/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/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 806561f0bfc0..1fec5f632d4e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -132,8 +132,9 @@ def _parse_skip_subdirs_file(): 'sphinxext.math_symbol_table', 'sphinxext.missing_references', 'sphinxext.mock_gui_toolkits', - 'sphinxext.skip_deprecated', + 'sphinxext.rcparams', 'sphinxext.redirect_from', + 'sphinxext.skip_deprecated', 'sphinx_copybutton', 'sphinx_design', 'sphinx_tags', @@ -194,6 +195,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 @@ -201,7 +203,8 @@ 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') @@ -268,7 +271,7 @@ 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), @@ -305,7 +308,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, 'sphinxext.util.patch_header'), + 'reset_modules': ('matplotlib', clear_basic_units, patch_header), 'subsection_order': gallery_order_sectionorder, 'thumbnail_size': (320, 224), 'within_subsection_order': gallery_order_subsectionorder, @@ -899,3 +902,4 @@ def setup(app): 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/api_changes.rst b/doc/devel/api_changes.rst index 5fed9f683a48..6880cf10ae62 100644 --- a/doc/devel/api_changes.rst +++ b/doc/devel/api_changes.rst @@ -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 diff --git a/doc/devel/communication_guide.rst b/doc/devel/communication_guide.rst index c90d1d93b99d..a0056b80e606 100644 --- a/doc/devel/communication_guide.rst +++ b/doc/devel/communication_guide.rst @@ -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: @@ -77,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 ================== @@ -262,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. X, 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 bd4fe8e64c52..cf158cbe67ad 100644 --- a/doc/devel/contribute.rst +++ b/doc/devel/contribute.rst @@ -21,10 +21,9 @@ 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.** @@ -33,7 +32,7 @@ Ways to contribute 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 `__. @@ -60,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: @@ -163,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: @@ -184,24 +185,42 @@ 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 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 -Restrictions on Generative AI Usage -=================================== + .. grid-item:: -We expect authentic engagement in our community. + :octicon:`check;1em;sd-text-success` **Acceptable uses** -- Do not post 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. + - 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. -Make sure you have added value based on your personal competency to your -contributions. Just taking some input, feeding it to an AI and posting the -result is not of value to the project. To preserve precious core developer -capacity, we reserve the right to rigorously reject seemingly AI generated -low-value contributions. + .. 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. + +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: @@ -229,8 +248,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: @@ -238,41 +257,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 gitter`_ 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 gitter: 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: @@ -288,7 +300,12 @@ 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). @@ -297,6 +314,14 @@ guide you through each step: 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: @@ -311,9 +336,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`_. +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: @@ -330,6 +356,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 diff --git a/doc/devel/development_setup.rst b/doc/devel/development_setup.rst index 4e452fb3bfe7..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: @@ -177,7 +177,8 @@ setup. 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! @@ -270,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. @@ -282,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 `. @@ -322,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 @@ -333,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 @@ -343,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 c0300acf1f7f..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. @@ -40,7 +39,7 @@ workflow is: #. 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: @@ -250,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: @@ -276,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