Skip to content

Commit c348bf4

Browse files
authored
Using sphinxcontrib.spelling as extension (#1800)
* Using sphinxcontrib.spelling as extension * Installing enchant package required by sphinxcontrib-spelling * Run a spelling checker for docs * Installing pyenchant package * Aligned docstrings of elementwise functions with dpctl.tensor * Aligned docstrings of returns in elementwise functions with dpctl.tensor * Install enchant apt package * Extend dictionary with dpnp, dtype, ndarray, ufunc and ufuncs words * Fixed spelling issues and added 15 new words to known list * Fixed spelling issues and added 7 new words to known list * Fixed spelling issues and added 15 new words to known list * Fixed spelling issues and added 10 new words to known list * Fixed spelling issues and added 4 new words to known list * Fixed spelling issues and added 7 new words to known list * Added missing docstrings to ndarray methods * Fixed building issue in ndarray.rst * Resolved a warning: term not in glossary: 'universal function' * Resolve a warning after rebase with master
1 parent 8d04592 commit c348bf4

32 files changed

+532
-367
lines changed

.github/workflows/build-sphinx.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ jobs:
7777
intel-oneapi-mkl-devel \
7878
intel-oneapi-compiler-dpcpp-cpp
7979
80+
# required by sphinxcontrib-spelling extension
81+
- name: Install enchant package
82+
run: |
83+
sudo apt-get install enchant-2
84+
8085
# https://github.com/marketplace/actions/checkout
8186
- name: Install nvidia-cuda support drivers
8287
run: |
@@ -103,7 +108,8 @@ jobs:
103108
- name: Install sphinx dependencies
104109
run: |
105110
conda install sphinx sphinx_rtd_theme
106-
pip install sphinxcontrib-googleanalytics==0.4
111+
pip install sphinxcontrib-googleanalytics==0.4 \
112+
pyenchant sphinxcontrib-spelling
107113
108114
- name: Install dpnp dependencies
109115
run: |
@@ -122,6 +128,10 @@ jobs:
122128
- name: Build library
123129
run: python scripts/build_locally.py
124130

131+
- name: Run a spelling checker for docs
132+
run: make spelling
133+
working-directory: doc
134+
125135
- name: Build docs
126136
run: make html
127137
working-directory: doc

doc/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,18 @@
5959
"sphinx.ext.autodoc",
6060
"sphinx.ext.autosummary",
6161
"sphinxcontrib.googleanalytics",
62+
"sphinxcontrib.spelling",
6263
]
6364

6465
googleanalytics_id = "G-554F8VNE28"
6566
googleanalytics_enabled = True
6667

68+
# Enable a misspelling as a sphinx warning
69+
spelling_warning = True
70+
71+
# Define a list of words known to be spelled correctly
72+
spelling_word_list_filename = "known_words.txt"
73+
6774
# Add any paths that contain templates here, relative to this directory.
6875
templates_path = ["_templates"]
6976

doc/known_words.txt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
backend
2+
bitwise
3+
boolean
4+
broadcastable
5+
broadcasted
6+
byteorder
7+
Cholesky
8+
conda
9+
Decompositions
10+
dimensionality
11+
docstring
12+
dpctl
13+
dpnp
14+
dtype
15+
dtypes
16+
einsum
17+
endian
18+
eps
19+
epsneg
20+
Extrema
21+
finfo
22+
finiteness
23+
Fortran
24+
Frobenius
25+
Hypergeometric
26+
iinfo
27+
Infs
28+
iterable
29+
Lomax
30+
Mersenne
31+
meshgrid
32+
Mises
33+
multinomial
34+
NaN
35+
NaT
36+
ndarray
37+
ndarrays
38+
ndim
39+
normed
40+
oneAPI
41+
orthonormal
42+
Penrose
43+
Polyutils
44+
prepend
45+
prepending
46+
representable
47+
runtimes
48+
scikit
49+
signbit
50+
signum
51+
subarray
52+
subarrays
53+
subclasses
54+
subtype
55+
SyclDevice
56+
SyclQueue
57+
th
58+
ufunc
59+
ufuncs
60+
Unary
61+
unicode
62+
usm
63+
Vandermonde
64+
vectorized
65+
von
66+
Weibull
67+
whitespace
68+
Zipf

doc/quick_start_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ And to build dpnp package from the sources:
7171
7272
conda build conda-recipe -c intel -c conda-forge
7373
74-
Finanly, to install the result package:
74+
Finally, to install the result package:
7575

7676
.. code-block:: bash
7777

doc/reference/binary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Binary Operations
33

44
.. https://docs.scipy.org/doc/numpy/reference/routines.bitwise.html
55
6-
Elementwise bit operations
6+
Element-wise bit operations
77
--------------------------
88

99
.. autosummary::

doc/reference/ndarray.rst

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ Each of the arithmetic operations (``+``, ``-``, ``*``, ``/``, ``//``,
231231
``%``, ``divmod()``, ``**`` or ``pow()``, ``<<``, ``>>``, ``&``,
232232
``^``, ``|``, ``~``) and the comparisons (``==``, ``<``, ``>``,
233233
``<=``, ``>=``, ``!=``) is equivalent to the corresponding
234-
universal function (or **ufunc** for short) in DPNP. For
234+
universal function (or :term:`ufunc` for short) in DPNP. For
235235
more information, see the section on :ref:`Universal Functions
236-
<ufunc>`.
236+
<ufuncs>`.
237237

238238

239239
Comparison operators:
@@ -249,6 +249,23 @@ Comparison operators:
249249
dpnp.ndarray.__eq__
250250
dpnp.ndarray.__ne__
251251

252+
Truth value of an array (:func:`bool()`):
253+
254+
.. autosummary::
255+
:toctree: generated/
256+
257+
dpnp.ndarray.__bool__
258+
259+
.. note::
260+
261+
Truth-value testing of an array invokes
262+
:meth:`dpnp.ndarray.__bool__`, which raises an error if the number of
263+
elements in the array is larger than 1, because the truth value
264+
of such arrays is ambiguous. Use :meth:`.any() <dpnp.ndarray.any>` and
265+
:meth:`.all() <dpnp.ndarray.all>` instead to be clear about what is meant
266+
in such cases. (If the number of elements is 0, the array evaluates
267+
to ``False``.)
268+
252269

253270
Unary operations:
254271

@@ -303,6 +320,14 @@ Arithmetic, in-place:
303320
dpnp.ndarray.__ixor__
304321

305322

323+
Matrix Multiplication:
324+
325+
.. autosummary::
326+
:toctree: generated/
327+
328+
dpnp.ndarray.__matmul__
329+
330+
306331
Special methods
307332
---------------
308333

doc/reference/ufunc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Universal Functions (ufunc)
55

66
.. https://docs.scipy.org/doc/numpy/reference/ufuncs.html
77
8-
DPNP provides universal functions (a.k.a. ufuncs) to support various elementwise operations.
8+
DPNP provides universal functions (a.k.a. ufuncs) to support various element-wise operations.
99

1010
Available ufuncs
1111
----------------

dpnp/dparray.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ cdef class dparray:
10641064
Limitations
10651065
-----------
10661066
Input array is supported as :obj:`dpnp.ndarray`.
1067-
Input kth is supported as :obj:`int`.
1067+
Input `kth` is supported as :obj:`int`.
10681068
Parameters `axis`, `kind` and `order` are supported only with default values.
10691069

10701070
"""

0 commit comments

Comments
 (0)