8000 Merge pull request #22116 from melissawm/add-sphinx-design · numpy/numpy@b6a3e83 · GitHub
[go: up one dir, main page]

Skip to content

Commit b6a3e83

Browse files
authored
Merge pull request #22116 from melissawm/add-sphinx-design
MAINT,DOC: Remove sphinx-panels in favor of sphinx-design
2 parents c2ddceb + 9de446a commit b6a3e83

File tree

10 files changed

+89
-80
lines changed

10 files changed

+89
-80
lines changed

doc/source/_static/numpy.css

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,29 @@ Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618
6464

6565
/* Main page overview cards */
6666

67-
.intro-card {
67+
.sd-card {
6868
background: #fff;
6969
border-radius: 0;
7070
padding: 30px 10px 20px 10px;
7171
margin: 10px 0px;
7272
}
7373

74-
.intro-card p.card-text {
74+
.sd-card .sd-card-header {
75+
text-align: center;
76+
}
77+
78+
.sd-card .sd-card-header .sd-card-text {
7579
margin: 0px;
7680
}
7781

78-
.intro-card .card-img-top {
82+
.sd-card .sd-card-img-top {
7983
height: 52px;
8084
width: 52px;
8185
margin-left: auto;
8286
margin-right: auto;
8387
}
8488

85-
.intro-card .card-header {
89+
.sd-card .sd-card-header {
8690
border: none;
8791
background-color: white;
8892
color: #150458 !important;
@@ -91,35 +95,37 @@ Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618
9195
padding: 2.5rem 0rem 0.5rem 0rem;
9296
}
9397

94-
.intro-card .card-footer {
98+
.sd-card .sd-card-footer {
9599
border: none;
96100
background-color: white;
97101
}
98102

99-
.intro-card .card-footer p.card-text {
103+
.sd-card .sd-card-footer .sd-card-text {
100104
max-width: 220px;
101105
margin-left: auto;
102106
margin-right: auto;
103107
}
104108

105-
106-
107109
/* Dark theme tweaking */
108-
html[data-theme=dark] .intro-card img[src*='.svg'] {
110+
html[data-theme=dark] .sd-card img[src*='.svg'] {
109111
filter: invert(0.82) brightness(0.8) contrast(1.2);
110112
}
111113

112114
/* Main index page overview cards */
113-
html[data-theme=dark] .shadow {
114-
box-shadow: 0 .5rem 1rem rgba(250, 250, 250, .6) !important
115+
html[data-theme=dark] .sd-card {
116+
background-color:var(--pst-color-background);
117+
}
118+
119+
html[data-theme=dark] .sd-shadow-sm {
120+
box-shadow: 0 .1rem 1rem rgba(250, 250, 250, .6) !important
115121
}
116122

117-
html[data-theme=dark] .intro-card .card-header {
123+
html[data-theme=dark] .sd-card .sd-card-header {
118124
background-color:var(--pst-color-background);
119125
color: #150458 !important;
120126
}
121127

122-
html[data-theme=dark] .intro-card .card-footer {
128+
html[data-theme=dark] .sd-card .sd-card-footer {
123129
background-color:var(--pst-color-background);
124130
}
125131

doc/source/conf.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class PyTypeObject(ctypes.Structure):
8484
'IPython.sphinxext.ipython_console_highlighting',
8585
'IPython.sphinxext.ipython_directive',
8686
'sphinx.ext.mathjax',
87-
'sphinx_panels',
87+
'sphinx_design',
8888
]
8989

9090
skippable_extensions = [
@@ -200,11 +200,6 @@ def setup(app):
200200
html_last_updated_fmt = '%b %d, %Y'
201201
html_css_files = ["numpy.css"]
202202
html_context = {"default_mode": "light"}
203-
204-
# Prevent sphinx-panels from loading bootstrap css, the pydata-sphinx-theme
205-
# already loads it
206-
panels_add_bootstrap_css = False
207-
208203
html_use_modindex = True
209204
html_copy_source = False
210205
html_domain_indices = False

doc/source/index.rst

Lines changed: 59 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -34,76 +34,84 @@ fast operations on arrays, including mathematical, logical, shape manipulation,
3434
sorting, selecting, I/O, discrete Fourier transforms, basic linear algebra,
3535
basic statistical operations, random simulation and much more.
3636

37-
.. panels::
38-
:card: + intro-card text-center
39-
:column: col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex
4037

41-
---
42-
:img-top: ../source/_static/index-images/getting_started.svg
4338

44-
Getting Started
45-
^^^^^^^^^^^^^^^
39+
.. grid:: 2
4640

47-
New to NumPy? Check out the Absolute Beginner's Guide. It contains an
48-
introduction to NumPy's main concepts and links to additional tutorials.
41+
.. grid-item-card::
42+
:img-top: ../source/_static/index-images/getting_started.svg
4943

50-
+++
44+
Getting Started
45+
^^^^^^^^^^^^^^^
5146

52-
.. link-button:: user/absolute_beginners
53-
:type: ref
54-
:text: To the absolute beginner's guide
55-
:classes: btn-block btn-secondary stretched-link
56-
57-
---
58-
:img-top: ../source/_static/index-images/user_guide.svg
47+
New to NumPy? Check out the Absolute Beginner's Guide. It contains an
48+
introduction to NumPy's main concepts and links to additional tutorials.
5949

60-
User Guide
61-
^^^^^^^^^^
50+
+++
6251

63-
The user guide provides in-depth information on the
64-
key concepts of NumPy with useful background information and explanation.
52+
.. button-ref:: user/absolute_beginners
53+
:expand:
54+
:color: secondary
55+
:click-parent:
6556

66-
+++
57+
To the absolute beginner's guide
6758

68-
.. link-button:: user
69-
:type: ref
70-
:text: To the user guide
71-
:classes: btn-block btn-secondary stretched-link
59+
.. grid-item-card::
60+
:img-top: ../source/_static/index-images/user_guide.svg
7261

73-
---
74-
:img-top: ../source/_static/index-images/api.svg
62+
User Guide
63+
^^^^^^^^^^
7564

76-
API Reference
77-
^^^^^^^^^^^^^
65+
The user guide provides in-depth information on the
66+
key concepts of NumPy with useful background information and explanation.
7867

79-
The reference guide contains a detailed description of the functions,
80-
modules, and objects included in NumPy. The reference describes how the
81-
methods work and which parameters can be used. It assumes that you have an
82-
understanding of the key concepts.
68+
+++
8369

84-
+++
70+
.. button-ref:: user
71+
:expand:
72+
:color: secondary
73+
:click-parent:
8574

86-
.. link-button:: reference
87-
:type: ref
88-
:text: To the reference guide
89-
:classes: btn-block btn-secondary stretched-link
75+
To the user guide
9076

91-
---
92-
:img-top: ../source/_static/index-images/contributor.svg
77+
.. grid-item-card::
78+
:img-top: ../source/_static/index-images/api.svg
9379

94-
Contributor's Guide
95-
^^^^^^^^^^^^^^^^^^^
80+
API Reference
81+
^^^^^^^^^^^^^
9682

97-
Want to add to the codebase? Can help add translation or a flowchart to the
98-
documentation? The contributing guidelines will guide you through the
99-
process of improving NumPy.
83+
The reference guide contains a detailed description of the functions,
84+
modules, and objects included in NumPy. The reference describes how the
85+
methods work and which parameters can be used. It assumes that you have an
86+
understanding of the key concepts.
10087

101-
+++
88+
+++
10289

103-
.. link-button:: devindex
104-
:type: ref
105-
:text: To the contributor's guide
106-
:classes: btn-block btn-secondary stretched-link
90+
.. button-ref:: reference
91+
:expand:
92+
:color: secondary
93+
:click-parent:
94+
95+
To the reference guide
96+
97+
.. grid-item-card::
98+
:img-top: ../source/_static/index-images/contributor.svg
99+
100+
Contributor's Guide
101+
^^^^^^^^^^^^^^^^^^^
102+
103+
Want to add to the codebase? Can help add translation or a flowchart to the
104+
documentation? The contributing guidelines will guide you through the
105+
process of improving NumPy.
106+
107+
+++
108+
109+
.. button-ref:: devindex
110+
:expand:
111+
:color: secondary
112+
:click-parent:
113+
114+
To the contributor's guide
107115

108116
.. This is not really the index page, that is found in
109117
_templates/indexcontent.html The toctree content here will be added to the

doc/source/reference/arrays.interface.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ This approach to the interface consists of the object having an
125125
**Default**: ``[('', typestr)]``
126126

127127
**data** (optional)
128-
A 2-tuple whose first argument is a :doc:`Python integer <c-api/long>`
128+
A 2-tuple whose first argument is a :doc:`Python integer <python:c-api/long>`
129129
that points to the data-area storing the array contents.
130130

131131
.. note::
@@ -253,7 +253,7 @@ flag is present.
253253
.. note::
254254

255255
:obj:`__array_struct__` is considered legacy and should not be used for new
256-
code. Use the :py:doc:`buffer protocol <c-api/buffer>` or the DLPack protocol
256+
code. Use the :doc:`buffer protocol <python:c-api/buffer>` or the DLPack protocol
257257
`numpy.from_dlpack` instead.
258258

259259

doc/source/user/basics.interoperability.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ objects to be treated as NumPy arrays whenever possible. When NumPy functions
4444
encounter a foreign object, they will try (in order):
4545

4646
1. The buffer protocol, described :py:doc:`in the Python C-API documentation
47-
<c-api/buffer>`.
47+
<python:c-api/buffer>`.
4848
2. The ``__array_interface__`` protocol, described
4949
:ref:`in this page <arrays.interface>`. A precursor to Python's buffer
5050
protocol, it defines a way to access the contents of a NumPy array from other

doc/source/user/how-to-how-to.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ deep dives intended to give understanding rather than immediate assistance,
105105
and `References`, which give complete, authoritative data on some concrete
106106
part of NumPy (like its API) but aren't obligated to paint a broader picture.
107107

108-
For more on tutorials, see :doc:`content/tutorial-style-guide`
108+
For more on tutorials, see :doc:`numpy-tutorials:content/tutorial-style-guide`
109109

110110
******************************************************************************
111111
Is this page an example of a how-to?

doc/source/user/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,4 +1485,4 @@ Further reading
14851485
- `SciPy Tutorial <https://docs.scipy.org/doc/scipy/ref 10000 erence/tutorial/index.html>`__
14861486
- `SciPy Lecture Notes <https://scipy-lectures.org>`__
14871487
- A `matlab, R, IDL, NumPy/SciPy dictionary <http://mathesaurus.sf.net/>`__
1488-
- :doc:`tutorial-svd <content/tutorial-svd>`
1488+
- :doc:`tutorial-svd <numpy-tutorials:content/tutorial-svd>`

doc_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sphinx>=4.5.0
33
numpydoc==1.4
44
pydata-sphinx-theme==0.9.0
5-
sphinx-panels
5+
sphinx-design
66
ipython!=8.1.0
77
scipy
88
matplotlib

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies:
2323
- typing_extensions>=4.2.0
2424
# For building docs
2525
- sphinx>=4.5.0
26-
- sphinx-panels
26+
- sphinx-design
2727
- numpydoc=1.4.0
2828
- ipython
2929
- scipy

numpy/core/_add_newdocs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,9 +1756,9 @@
17561756
In such cases, the use of `numpy.linspace` should be preferred.
17571757
17581758
The built-in :py:class:`range` generates :std:doc:`Python built-in integers
1759-
that have arbitrary size <c-api/long>`, while `numpy.arange` produces
1760-
`numpy.int32` or `numpy.int64` numbers. This may result in incorrect
1761-
results for large integer values::
1759+
that have arbitrary size <python:c-api/long>`, while `numpy.arange`
1760+
produces `numpy.int32` or `numpy.int64` numbers. This may result in
1761+
incorrect results for large integer values::
17621762
17631763
>>> power = 40
17641764
>>> modulo = 10000

0 commit comments

Comments
 (0)
0