8000 Merge remote-tracking branch 'upstream/main' into bugfix/29860-handle… · matplotlib/matplotlib@a5c1d34 · GitHub
[go: up one dir, main page]

Skip to content

Commit a5c1d34

Browse files
committed
Merge remote-tracking branch 'upstream/main' into bugfix/29860-handle-nan-inf
2 parents a129589 + b9da4fd commit a
8000
5c1d34

File tree

96 files changed

+3139
-9369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3139
-9369
lines changed

.flake8

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

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
persist-credentials: false
3232

3333
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
34+
uses: github/codeql-action/init@fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2 # v3.28.14
3535
with:
3636
languages: ${{ matrix.language }}
3737

@@ -42,4 +42,4 @@ jobs:
4242
pip install --user -v .
4343
4444
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
45+
uses: github/codeql-action/analyze@fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2 # v3.28.14

.github/workflows/reviewdog.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ permissions:
66
contents: read
77

88
jobs:
9-
flake8:
10-
name: flake8
9+
ruff:
10+
name: ruff
1111
runs-on: ubuntu-latest
1212
permissions:
1313
checks: write
@@ -21,19 +21,19 @@ jobs:
2121
with:
2222
python-version: '3.10'
2323

24-
- name: Install flake8
25-
run: pip3 install -r requirements/testing/flake8.txt
24+
- name: Install ruff
25+
run: pip3 install ruff
2626

2727
- name: Set up reviewdog
2828
uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893 # v1.3.9
2929

30-
- name: Run flake8
30+
- name: Run ruff
3131
env:
3232
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
run: |
3434
set -o pipefail
35-
flake8 --docstring-convention=all | \
36-
reviewdog -f=pep8 -name=flake8 \
35+
ruff check --output-format rdjson | \
36+
reviewdog -f=rdjson \
3737
-tee -reporter=github-check -filter-mode nofilter
3838
mypy:
3939
name: mypy

.pre-commit-config.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ repos:
4141
args: ["--config-file=pyproject.toml", "lib/matplotlib"]
4242
files: lib/matplotlib # Only run when files in lib/matplotlib are changed.
4343
pass_filenames: false
44-
- repo: https://github.com/pycqa/flake8
45-
rev: 7.1.1
44+
45+
- repo: https://github.com/astral-sh/ruff-pre-commit
46+
# Ruff version.
47+
rev: v0.11.0
4648
hooks:
47-
- id: flake8
48-
additional_dependencies:
49-
- pydocstyle>5.1.0
50-
- flake8-docstrings>1.4.0
51-
- flake8-force
52-
args: ["--docstring-convention=all"]
49+
# Run the linter.
50+
- id: ruff
51+
args: [--fix, --show-fixes]
5352
- repo: https://github.com/codespell-project/codespell
5453
rev: v2.3.0
5554
hooks:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
New minimum version of pyparsing
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The minimum required version of ``pyparsing`` has been updated from 2.3.1 to 3.0.0.

doc/devel/coding_guide.rst

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,28 @@ consistency, and maintainability of the code base.
1515

1616
.. _code-style:
1717

18-
PEP8, as enforced by flake8
19-
===========================
18+
PEP8, as enforced by ruff
19+
=========================
2020

21-
Formatting should follow the recommendations of PEP8_, as enforced by flake8_.
21+
Formatting should follow the recommendations of PEP8_, as enforced by ruff_.
2222
Matplotlib modifies PEP8 to extend the maximum line length to 88
23-
characters. You can check flake8 compliance from the command line with ::
23+
characters. You can check PEP8 compliance from the command line with ::
24+
25+
python -m pip install ruff
26+
ruff check /path/to/module.py
27+
28+
or your editor may provide integration with it. To check all files,
29+
and fix any errors in-place (where possible) run ::
30+
31+
ruff check --fix
2432

25-
python -m pip install flake8
26-
flake8 /path/to/module.py
2733

28-
or your editor may provide integration with it. Note that Matplotlib intentionally
29-
does not use the black_ auto-formatter (1__), in particular due to its inability
30-
to understand the semantics of mathematical expressions (2__, 3__).
34+
Matplotlib intentionally does not use the black_ auto-formatter (1__),
35+
in particular due to its inability to understand the semantics of
36+
mathematical expressions (2__, 3__).
3137

3238
.. _PEP8: https://www.python.org/dev/peps/pep-0008/
33-
.. _flake8: https://flake8.pycqa.org/
39+
.. _ruff: https://docs.astral.sh/ruff/
3440
.. _black: https://black.readthedocs.io/
3541
.. __: https://github.com/matplotlib/matplotlib/issues/18796
3642
.. __: https://github.com/psf/black/issues/148

doc/devel/testing.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,10 @@ the tests, they should now pass.
163163

164164
It is preferred that new tests use ``style='mpl20'`` as this leads to smaller
165165
figures and reflects the newer look of default Matplotlib plots. Also, if the
166-
texts (labels, tick labels, etc) are not really part of what is tested, use
167-
``remove_text=True`` as this will lead to smaller figures and reduce possible
168-
issues with font mismatch on different platforms.
166+
texts (labels, tick labels, etc) are not really part of what is tested, use the
167+
``remove_text=True`` argument or add the ``text_placeholders`` fixture as this
168+
will lead to smaller figures and reduce possible issues with font mismatch on
169+
different platforms.
169170

170171

171172
Compare two methods of creating an image

doc/install/dependencies.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ reference.
2929
* `NumPy <https://numpy.org>`_ (>= 1.23)
3030
* `packaging <https://pypi.org/project/packaging/>`_ (>= 20.0)
3131
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 9.0)
32-
* `pyparsing <https://pypi.org/project/pyparsing/>`_ (>= 2.3.1)
32+
* `pyparsing <https://pypi.org/project/pyparsing/>`_ (>= 3)
3333

3434

3535
.. _optional_dependencies:
@@ -346,7 +346,6 @@ otherwise they must be installed manually:
346346
- pikepdf_ used in some tests for the pgf and pdf backends
347347
- psutil_ used in testing the interactive backends
348348
- pytest-cov_ (>= 2.3.1) to collect coverage information
349-
- pytest-flake8_ to test coding standards using flake8_
350349
- pytest-timeout_ to limit runtime in case of stuck tests
351350
- pytest-xdist_ to run tests in parallel
352351
- pytest-xvfb_ to run tests without windows popping up (Linux)
@@ -373,15 +372,13 @@ them will be skipped by pytest.
373372
.. _Ghostscript: https://ghostscript.com/
374373
.. _Inkscape: https://inkscape.org
375374
.. _WenQuanYi Zen Hei: http://wenq.org/en/
376-
.. _flake8: https://pypi.org/project/flake8/
377375
.. _nbconvert: https://pypi.org/project/nbconvert/
378376
.. _nbformat: https://pypi.org/project/nbformat/
379377
.. _pandas: https://pypi.org/project/pandas/
380378
.. _pikepdf: https://pypi.org/project/pikepdf/
381379
.. _psutil: https://pypi.org/project/psutil/
382380
.. _pytz: https://fonts.google.com/noto/use#faq
383381
.. _pytest-cov: https://pytest-cov.readthedocs.io/en/latest/
384-
.. _pytest-flake8: https://pypi.org/project/pytest-flake8/
385382
.. _pytest-timeout: https://pypi.org/project/pytest-timeout/
386383
.. _pytest-xdist: https://pypi.org/project/pytest-xdist/
387384
.. _pytest-xvfb: https://pypi.org/project/pytest-xvfb/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Figure size units
2+
-----------------
3+
4+
When creating figures, it is now possible to define figure sizes in cm or pixel.
5+
6+
Up to now the figure size is specified via ``plt.figure(..., figsize=(6, 4))``,
7+
and the given numbers are interpreted as inches. It is now possible to add a
8+
unit string to the tuple, i.e. ``plt.figure(..., figsize=(600, 400, "px"))``.
9+
Supported unit strings are "in", "cm", "px".

environment.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- pillow>=9
2525
- pkg-config
2626
- pygobject
27-
- pyparsing>=2.3.1
27+
- pyparsing>=3
2828
- pyqt
2929
- python>=3.10
3030
- python-dateutil>=2.1
@@ -55,8 +55,6 @@ dependencies:
5555
# testing
5656
- black<24
5757
- coverage
58-
- flake8>=3.8,<7.2
59-
- flake8-docstrings>=1.4.0
6058
- gtk4
6159
- ipykernel
6260
- nbconvert[execute]!=6.0.0,!=6.0.1,!=7.3.0,!=7.3.1
@@ -72,4 +70,5 @@ dependencies:
7270
- pytest-xdist
7371
- tornado
7472
- pytz
73+
- ruff
7574
- tox

galleries/examples/text_labels_and_annotations/figlegend_demo.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@
2525
# %%
2626
# The outside positioning is discussed in detail here:
2727
# https://matplotlib.org/stable/users/explain/axes/legend_guide.html#figure-legends
28+
#
29+
#
30+
# .. seealso::
31+
#
32+
# The :ref:`legend_guide` contains an in depth discussion on the configuration
33+
# options for legends.

galleries/examples/text_labels_and_annotations/legend.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@
3737
#
3838
# - `matplotlib.axes.Axes.plot` / `matplotlib.pyplot.plot`
3939
# - `matplotlib.axes.Axes.legend` / `matplotlib.pyplot.legend`
40+
#
41+
# .. seealso::
42+
#
43+
# The :ref:`legend_guide` contains an in depth discussion on the configuration
44+
# options for legends.

galleries/examples/text_labels_and_annotations/legend_demo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,10 @@ def create_artists(self, legend, orig_handle,
178178
handlelength=2.5, handleheight=3)
179179

180180
plt.show()
181+
182+
# %%
183+
#
184+
# .. seealso::
185+
#
186+
# The :ref:`legend_guide` contains an in depth discussion on the configuration
187+
# options for legends.

galleries/examples/units/basic_units.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,1 F438 4 @@
55
Basic units
66
===========
77
8+
9+
This file implements a units library that supports registering arbitrary units,
10+
conversions between units, and math with unitized data. This library also implements a
11+
Matplotlib unit converter and registers its units with Matplotlib. This library is used
12+
in the examples to demonstrate Matplotlib's unit support. It is only maintained for the
13+
purposes of building documentation and should never be used outside of the Matplotlib
14+
documentation.
15+
816
"""
917

1018
import itertools

galleries/examples/userdemo/simple_legend01.py

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

galleries/examples/userdemo/simple_legend02.py

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

galleries/users_explain/axes/legend_guide.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""
22
.. redirect-from:: /tutorials/intermediate/legend_guide
3+
.. redirect-from:: /galleries/examples/userdemo/simple_legend01
4+
.. redirect-from:: /galleries/examples/userdemo/simple_legend02
35
46
.. _legend_guide:
57

0 commit comments

Comments
 (0)
0