Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66687d0

Browse files
authored
Merge pull request #21240 from QuLogic/doc-cleanup
DOC: Fix source links and flake8 cleanup
2 parents f4f7c4b + 96fa195 commit 66687d0

File tree

5 files changed

+55
-42
lines changed

5 files changed

+55
-42
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ per-file-ignores =
8585
lib/mpl_toolkits/tests/conftest.py: F401
8686
lib/pylab.py: F401, F403
8787

88-
doc/conf.py: E402, E501
88+
doc/conf.py: E402
8989
tutorials/advanced/path_tutorial.py: E402
9090
tutorials/advanced/patheffects_guide.py: E402
9191
tutorials/advanced/transforms_tutorial.py: E402, E501

README.rst

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,24 @@
4242

4343
.. image:: https://matplotlib.org/_static/logo2.svg
4444

45-
Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.
45+
Matplotlib is a comprehensive library for creating static, animated, and
46+
interactive visualizations in Python.
4647

4748
Check out our `home page <https://matplotlib.org/>`_ for more information.
4849

4950
.. image:: https://matplotlib.org/_static/readme_preview.png
5051

51-
Matplotlib produces publication-quality figures in a variety of hardcopy formats
52-
and interactive environments across platforms. Matplotlib can be used in Python scripts,
53-
the Python and IPython shell, web application servers, and various
54-
graphical user interface toolkits.
52+
Matplotlib produces publication-quality figures in a variety of hardcopy
53+
formats and interactive environments across platforms. Matplotlib can be used
54+
in Python scripts, the Python and IPython shell, web application servers, and
55+
various graphical user interface toolkits.
5556

5657

5758
Install
5859
=======
5960

6061
For installation instructions and requirements, see `INSTALL.rst <INSTALL.rst>`_ or the
61-
`install <https://matplotlib.org/users/installing.html>`_ documentation.
62+
`install <https://matplotlib.org/stable/users/installing.html>`_ documentation.
6263

6364
Test
6465
====
@@ -67,28 +68,36 @@ After installation, launch the test suite::
6768

6869
python -m pytest
6970

70-
Read the `testing guide <https://matplotlib.org/devel/testing.html>`_ for more information and alternatives.
71+
Read the `testing guide <https://matplotlib.org/stable/devel/testing.html>`_
72+
for more information and alternatives.
7173

7274
Contribute
7375
==========
76+
7477
You've discovered a bug or something else you want to change - excellent!
7578

7679
You've worked out a way to fix it – even better!
7780

7881
You want to tell us about it – best of all!
7982

80-
Start at the `contributing guide <https://matplotlib.org/devdocs/devel/contributing.html>`_!
83+
Start at the `contributing guide
84+
<https://matplotlib.org/devdocs/devel/contributing.html>`_!
8185

8286
Contact
8387
=======
8488

85-
`Discourse <https://discourse.matplotlib.org/>`_ is the discussion forum for general questions and discussions and our recommended starting point.
89+
`Discourse <https://discourse.matplotlib.org/>`_ is the discussion forum for
90+
general questions and discussions and our recommended starting point.
8691

8792
Our active mailing lists (which are mirrored on Discourse) are:
8893

89-
* `Users <https://mail.python.org/mailman/listinfo/matplotlib-users>`_ mailing list: [email protected]
90-
* `Announcement <https://mail.python.org/mailman/listinfo/matplotlib-announce>`_ mailing list: [email protected]
91-
* `Development <https://mail.python.org/mailman/listinfo/matplotlib-devel>`_ mailing list: [email protected]
94+
* `Users <https://mail.python.org/mailman/listinfo/matplotlib-users>`_ mailing
95+
96+
* `Announcement
97+
<https://mail.python.org/mailman/listinfo/matplotlib-announce>`_ mailing
98+
99+
* `Development <https://mail.python.org/mailman/listinfo/matplotlib-devel>`_
100+
mailing list: [email protected]
92101

93102
Gitter_ is for coordinating development and asking questions directly related
94103
to contributing to matplotlib.
@@ -99,21 +108,21 @@ Citing Matplotlib
99108
If Matplotlib contributes to a project that leads to publication, please
100109
acknowledge this by citing Matplotlib.
101110

102-
`A ready-made citation entry <https://matplotlib.org/citing.html>`_ is available.
111+
`A ready-made citation entry <https://matplotlib.org/stable/citing.html>`_ is
112+
available.
103113

104114
Research notice
105115
~~~~~~~~~~~~~~~
106116

107117
Please note that this repository is participating in a study into
108118
sustainability of open source projects. Data will be gathered about this
109-
repository for approximately the next 12 months, starting from June
110-
2021.
119+
repository for approximately the next 12 months, starting from June 2021.
111120

112-
Data collected will include number of contributors, number of PRs, time
113-
taken to close/merge these PRs, and issues closed.
121+
Data collected will include number of contributors, number of PRs, time taken
122+
to close/merge these PRs, and issues closed.
114123

115-
For more information, please visit `the informational
116-
page <https://sustainable-open-science-and-software.github.io/>`__ or
117-
download the `participant information
118-
sheet <https://sustainable-open-science-and-software.github.io/assets/PIS_sustainable_software.pdf>`__.
124+
For more information, please visit `the informational page
125+
<https://sustainable-open-science-and-software.github.io/>`__ or download the
126+
`participant information sheet
127+
<https://sustainable-open-science-and-software.github.io/assets/PIS_sustainable_software.pdf>`__.
119128

doc/conf.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Matplotlib documentation build configuration file, created by
22
# sphinx-quickstart on Fri May 2 12:33:25 2008.
33
#
4-
# This file is execfile()d with the current directory set to its containing dir.
4+
# This file is execfile()d with the current directory set to its containing
5+
# dir.
56
#
67
# The contents of this file are pickled, so don't put values in the namespace
7-
# that aren't pickleable (module imports are okay, they're removed automatically).
8+
# that aren't pickleable (module imports are okay, they're removed
9+
# automatically).
810
#
911
# All configuration values have a default value; values that are commented out
1012
# serve to show the default value.
@@ -30,7 +32,8 @@
3032

3133
# Parse year using SOURCE_DATE_EPOCH, falling back to current time.
3234
# https://reproducible-builds.org/specs/source-date-epoch/
33-
sourceyear = datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).year
35+
sourceyear = datetime.utcfromtimestamp(
36+
int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).year
3437

3538
# If your extensions are in another directory, add it here. If the directory
3639
# is relative to the documentation root, use os.path.abspath to make it
@@ -226,9 +229,11 @@ def _check_dependencies():
226229
}
227230

228231
project = 'Matplotlib'
229-
copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '
230-
'Michael Droettboom and the Matplotlib development '
231-
f'team; 2012 - {sourceyear} The Matplotlib development team')
232+
copyright = (
233+
'2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom '
234+
'and the Matplotlib development team; '
235+
f'2012 - {sourceyear} The Matplotlib development team'
236+
)
232237

233238

234239
# The default replacements for |version| and |release|, also used in various
@@ -389,8 +394,10 @@ def _check_dependencies():
389394
# The paper size ('letter' or 'a4').
390395
latex_paper_size = 'letter'
391396

392-
# Grouping the document tree into LaTeX files. List of tuples
393-
# (source start file, target name, title, author, document class [howto/manual]).
397+
# Grouping the document tree into LaTeX files.
398+
# List of tuples:
399+
# (source start file, target name, title, author,
400+
# document class [howto/manual])
394401

395402
latex_documents = [
396403
('contents', 'Matplotlib.tex', 'Matplotlib',
@@ -575,8 +582,8 @@ def setup(app):
575582
# You can add build old with link_github = False
576583

577584
if link_github:
578-
import re
579585
import inspect
586+
from packaging.version import parse
580587

581588
extensions.append('sphinx.ext.linkcode')
582589

@@ -618,23 +625,18 @@ def linkcode_resolve(domain, info):
618625
except (OSError, TypeError):
619626
lineno = None
620627

621-
if lineno:
622-
linespec = "#L%d-L%d" % (lineno, lineno + len(source) - 1)
623-
else:
624-
linespec = ""
628+
linespec = (f"#L{lineno:d}-L{lineno + len(source) - 1:d}"
629+
if lineno else "")
625630

626631
startdir = Path(matplotlib.__file__).parent.parent
627632
fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, '/')
628633

629634
if not fn.startswith(('matplotlib/', 'mpl_toolkits/')):
630635
return None
631636

632-
m = re.match(r'^.*post[0-9]+\+\w([a-z0-9]+).\w+$', matplotlib.__version__)
633-
if m:
634-
return "https://github.com/matplotlib/matplotlib/blob/%s/lib/%s%s" % (
635-
m.group(1), fn, linespec)
636-
else:
637-
return "https://github.com/matplotlib/matplotlib/blob/v%s/lib/%s%s" % (
638-
matplotlib.__version__, fn, linespec)
637+
version = parse(matplotlib.__version__)
638+
tag = 'master' if version.is_devrelease else f'v{version.base_version}'
639+
return ("https://github.com/matplotlib/matplotlib/blob"
640+
f"/{tag}/lib/{fn}{linespec}")
639641
else:
640642
extensions.append('sphinx.ext.viewcode')

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies:
2727
- ipython
2828
- ipywidgets
2929
- numpydoc>=0.8
30+
- packaging
3031
- pydata-sphinx-theme
3132
- scipy
3233
- sphinx>=1.8.1,!=2.0.0

requirements/doc/doc-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ colorspacious
1212
ipython
1313
ipywidgets
1414
numpydoc>=0.8
15+
packaging>=20
1516
pydata-sphinx-theme>=0.6.0
1617
sphinxcontrib-svg2pdfconverter>=1.1.0
1718
# sphinx-gallery>=0.7

0 commit comments

Comments
 (0)