Skip to content

Commit 053627d

Browse files
rocco8773pre-commit-ci[bot]namurphy
authored
Fill out some basic documentation (#17)
* put install and import test into its own workflow * add tests on py 3.6 and 3.13 * cache tests and set fetch-depth to 1 * restrict workflow permissions * no not explicitly install plasmapy * set upper sphinx limit to < 8.2 * set upper sphinx limit to < 7.4 * add plasmapy dependency to the documentation requirements * set min python version to 3.8 * set min setuptools version to 61 * remove fail on warnings and add 3x verbosity * remove the 3x verbosity * add dependency "packaging" * adopt a kwarg passing scheme so we can be flexible in passing args to generate_autosummary_content(), who's signature changes for sphinx >= 8.0 * put sphinx upper limit to 8.2 * add sphinx_limits workflow * repair sphinx_limits workflow * repair sphinx_limits workflow * replace double quotes with single quotes * put ${{ matrix.sphinx }} between quotes * put fail on warning for the sphinx_limit workflow * put fail on warning for the documentation workflow * explicitly pass prefixes to import_by_name * explicitly remove prefixes before passing to parent method * add a nitpick exception for SphinxDirective.parse_inline * remove the quiet tag from sphinx builds workflow * add to nitpick exceptions * remove the string prefix in a python agnostic way * correct the prefix removal +1 * add nitpick ignore for ObjectMembers type annotation * make nitpick ignore rules a little more generic * add ObjectMember to nitpick ignore rules * remove upper dependency limit on sphinx * add a build on py3.11 * add kwargs for generate_autosummary_content() that are specific to sphinx >= 8.2 specific * remove trailing whitespace * add check on py3.11 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * modify docstring of plasmapy_sphinx.autodoc to it reads better when inserted into the docstring of plasmapy_sphinx.ext.autodoc * add docstring to plasmapy_sphinx.ext.autodoc * wrangle option :no-index: to :index: for sphinx < 7.2 * PEP 8 line length * remove unused import * remove wrongly placed handling of the no-index option for sphinx < 7.2 * add the 'no-index' option to option_spec if ModuleDocumenter.option_spec does not have it * wrangle option :no-index: to :index: for sphinx < 7.2 * remove unused import * fix typo * remove unused import * update docstrings for automodsumm * update docstrings for css and directives * add docstring for plasmapy_sphinx.theme * plasmapy_sphinx.theme to the sidebar Extensions section * remove admonition note about not being released on PyPI * delete docs/first_steps/configure.rst * rename Installing to Installation * add noqa * copy and modify installation instructions from plasmapy docs * remove noqa * add permissions statement * remove if-clause for importing importlib.metadata * Apply suggestions from code review Co-authored-by: Nick Murphy <[email protected]> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nick Murphy <[email protected]>
1 parent 3582c44 commit 053627d

File tree

12 files changed

+203
-29
lines changed

12 files changed

+203
-29
lines changed

docs/first_steps/configure.rst

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

docs/first_steps/install.rst

Lines changed: 128 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,130 @@
1+
.. _plasmapy-install:
2+
3+
.. |minpython| replace:: 3.8
4+
5+
.. _git: https://git-scm.com/
6+
.. |git| replace:: git_
7+
8+
.. _pip: https://pip.pypa.io
9+
.. |pip| replace:: pip_
10+
11+
.. _Python: https://www.python.org/
12+
.. |Python| replace:: Python_
13+
14+
.. _PyPI: https://pypi.org/
15+
.. |PyPI| replace:: PyPI_
16+
17+
.. _`Github repository`: https://github.com/PlasmaPy/plasmapy_sphinx
18+
.. |Github repository| replace:: `Github repository`_
19+
20+
.. role:: py(code)
21+
:language: python
22+
23+
.. role:: bash(code)
24+
:language: bash
25+
26+
****************************
127
Installing `plasmapy_sphinx`
2-
============================
28+
****************************
29+
30+
`plasmapy_sphinx` requires a minimum |Python| version of |minpython|. If
31+
you do not have |Python| installed already, here are the instructions
32+
to `download Python`_ and install it. 🐍
33+
34+
.. contents:: Contents
35+
:local:
36+
37+
.. _install-pip:
38+
39+
Installing with pip
40+
===================
41+
42+
To install the most recent release of `plasmapy_sphinx` on |PyPI| with
43+
|pip| into an existing |Python| |minpython|\ + environment on macOS or
44+
Linux, open a terminal and run:
45+
46+
.. code-block:: bash
47+
48+
python -m pip install plasmapy
49+
50+
On some systems, it might be necessary to specify the |Python| version
51+
number by using ``python3``, ``python3.8``, ``python3.9``,
52+
``python3.10``, or ``python3.11`` instead of ``python``.
53+
54+
To install PlasmaPy on Windows, run:
55+
56+
.. code-block:: bash
57+
58+
py -3.11 -m pip install plasmapy
59+
60+
The version of |Python| may be changed from ``3.11`` to another supported
61+
Python |minpython|\ + release that has been installed on your computer.
62+
63+
For more detailed information, please refer to this tutorial on
64+
`installing packages`_.
65+
66+
Installing from source code
67+
===========================
68+
69+
Obtaining official releases
70+
---------------------------
71+
72+
A ZIP_ file containing the source code for official releases of
73+
`plasmapy_sphinx` can be obtained `from PyPI`_.
74+
75+
Alternatively, official releases can be downloaded from the releases_
76+
page on the |GitHub repository|.
77+
78+
Obtaining source code from GitHub
79+
---------------------------------
80+
81+
If you have |git| installed on your computer, you may clone the
82+
|Github repository| and access the source code from the most
83+
recent development version by running:
84+
85+
.. code-block:: bash
86+
87+
git clone https://github.com/PlasmaPy/plasmapy_sphinx.git
88+
89+
The repository will be cloned inside a new subdirectory called
90+
:file:`plasmapy_sphinx`.
91+
92+
If you do not have |git| installed on your computer, then you may
93+
download the most recent source code from |Github repository|
94+
by going to :guilabel:`Code` and selecting :guilabel:`Download ZIP`.
95+
`Unzipping <https://www.wikihow.com/Unzip-a-File>`__ the file will
96+
create a subdirectory called :file:`plasmapy_sphinx` that contains the
97+
source code.
98+
99+
Building and installing
100+
-----------------------
101+
102+
To install the downloaded version of `plasmapy_sphinx`, enter the
103+
:file:`plasmapy_sphinx` directory and run:
104+
105+
.. code-block:: bash
106+
107+
pip install .
108+
109+
If you expect to occasionally edit the source code, instead run:
110+
111+
.. code-block:: bash
112+
113+
pip install -e .
114+
115+
The ``-e`` flag makes the installation editable.
116+
117+
.. note::
118+
119+
If you noticed any places where the installation instructions could
120+
be improved or have become out of date, please `create an issue`_ on
121+
|Github repository|. It would really help!
3122

4-
blah
123+
.. _clone a repository using SSH: https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-ssh-urls
124+
.. _create an issue: https://github.com/PlasmaPy/plasmapy_sphinx/issues/new
125+
.. _download Python: https://www.python.org/downloads
126+
.. _from PyPI: https://pypi.org/project/plasmapy_sphinx
127+
.. _installing packages: https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-from-vcs
128+
.. _releases: https://github.com/PlasmaPy/plasmapy_sphinx/releases
129+
.. _virtual environment: https://realpython.com/python-virtual-environments-a-primer
130+
.. _ZIP: https://en.wikipedia.org/wiki/ZIP_(file_format)

docs/index.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,15 @@ just a selection of desired ones.
1515

1616
.. note::
1717

18-
`plasmapy_sphinx` is not currently released in any form and can
19-
only be installed directly from its `GitHub repository
20-
<https://github.com/plasmapy/plasmapy_sphinx>`__. We do plan to
21-
release it to https://pypi.org but there is no scheduled release
22-
date at this time.
23-
24-
Additionally, this package currently has no tests covering its
18+
This package currently has no tests covering its
2519
functionality.
2620

2721

2822
.. toctree::
2923
:caption: First Steps
3024
:maxdepth: 1
3125

32-
Installing <first_steps/install>
33-
Configuring <first_steps/configure>
26+
Installation <first_steps/install>
3427

3528
.. toctree::
3629
:caption: Extensions
@@ -40,6 +33,7 @@ just a selection of desired ones.
4033
api_static/plasmapy_sphinx.ext.automodsumm
4134
api_static/plasmapy_sphinx.ext.css
4235
api_static/plasmapy_sphinx.ext.directives
36+
api_static/plasmapy_sphinx.theme
4337

4438
.. toctree::
4539
:caption: Contributor Guide

plasmapy_sphinx/autodoc/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
2-
This sub-package contains functionality that extends `sphinx.ext.autodoc`.
2+
`plasmapy_sphinx.autodoc` contains functionality that extends
3+
`sphinx.ext.autodoc`.
34
45
*This functionality was highly influenced by and adapted from*
56
`sphinx.ext.autodoc` *and* `sphinx_automodapi.automodapi`.

plasmapy_sphinx/automodsumm/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
This sub-package contains functionality that defines the :rst:dir:`automodsumm`
3-
directive and the
2+
`plasmapy_sphinx.automodsumm` contains functionality that defines the
3+
:rst:dir:`automodsumm` directive, and the associated automatic
44
`stub file generation
55
<https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html
66
#sphinx-autogen-generate-autodoc-stub-pages>`_
7-
for items listed in :rst:dir:`automodsumm` tables.
7+
for the documented items in the generated :rst:dir:`automodsumm` tables.
88
99
*This functionality was highly influenced by and adapted from*
1010
`sphinx.ext.autosummary` *and* `sphinx_automodapi.automodsumm`.

plasmapy_sphinx/automodsumm/core.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,17 @@ def __init__(
283283
Instance of the sphinx application.
284284
285285
modname : `str`
286-
Name of the module given in the :rst:dir:`automodsumm` directive. This
287-
is the module to be inspected and have it's objects grouped.
286+
Name of the module given in the :rst:dir:`automodsumm`
287+
directive. This is the module to be inspected and have
288+
its objects grouped.
288289
289290
options : Dict[str, Any]
290-
Dictionary of options given for the :rst:dir:`automodsumm` directive
291-
declaration.
291+
Dictionary of options given for the :rst:dir:`automodsumm`
292+
directive declaration.
292293
293294
docname : str
294-
Name of the document/file where the :rst:dir:`automodsumm` direction
295-
was declared.
295+
Name of the document/file where the :rst:dir:`automodsumm`
296+
direction was declared.
296297
"""
297298

298299
self._app = app
@@ -609,8 +610,9 @@ def run(self):
609610

610611
def option_processor(self):
611612
"""
612-
Instance of `~plasmapy_sphinx.automodsumm.core.Automodsumm` so further processing
613-
(beyond :attr:`option_spec`) of directive options can be performed.
613+
Instance of `~plasmapy_sphinx.automodsumm.core.Automodsumm` so
614+
further processing (beyond :attr:`option_spec`) of directive
615+
options can be performed.
614616
"""
615617
processor = AutomodsummOptions(
616618
app=self.env.app,

plasmapy_sphinx/directives/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This sub-package defines
2+
`plasmapy_sphinx.directives` defines
33
`directives
44
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html>`_
55
and

plasmapy_sphinx/ext/autodoc.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1+
"""
2+
This module is a `Sphinx extension
3+
<https://www.sphinx-doc.org/en/master/usage/extensions/index.html>`_
4+
that exposes the functionality of `plasmapy_sphinx.autodoc`.
5+
6+
.. automodapi:: plasmapy_sphinx.autodoc
7+
:no-index:
8+
:no-groups:
9+
10+
"""
11+
__all__ = ["automodapi", "setup"]
112
from sphinx.application import Sphinx
213

314
from plasmapy_sphinx.autodoc import automodapi
415

516

617
def setup(app: Sphinx):
718
"""
8-
Sphinx ``setup()`` function for setting up all of the
19+
Sphinx ``setup()`` function for setting up all the
920
`plasmapy_sphinx.autodoc` functionality, this includes
1021
`plasmapy_sphinx.automodsumm` functionality.
1122
"""

plasmapy_sphinx/ext/automodsumm.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
"""
2+
This module is a `Sphinx extension
3+
<https://www.sphinx-doc.org/en/master/usage/extensions/index.html>`_
4+
that exposes the functionality of `plasmapy_sphinx.automodsumm`.
5+
6+
.. automodapi:: plasmapy_sphinx.automodsumm
7+
:no-index:
8+
:no-groups:
9+
10+
"""
111
from sphinx.application import Sphinx
212

313
from plasmapy_sphinx.automodsumm import core

plasmapy_sphinx/ext/css.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
This module is a `Sphinx extension
3+
<https://www.sphinx-doc.org/en/master/usage/extensions/index.html>`_
4+
that adds the PlasmaPy CSS style sheet to the `sphinx` build
5+
environment. The :file:`plasmapy.css` is loaded into the build system
6+
using `~sphinx.application.Sphinx.add_css_file` with a priority of
7+
``501``.
8+
"""
9+
110
from sphinx.application import Sphinx
211

312
from plasmapy_sphinx.utils import static_dir, css_dir

0 commit comments

Comments
 (0)