Skip to content

Commit 7c00a1a

Browse files
authored
Add api docs (#328)
1 parent 00ed92e commit 7c00a1a

File tree

10 files changed

+97
-26
lines changed

10 files changed

+97
-26
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ jobs:
8383
steps:
8484
- uses: actions/checkout@v3
8585
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
86+
- name: Build API docs
87+
run: |
88+
hatch run docs:api
89+
# If this fails run `hatch run docs:api` locally
90+
# and commit.
91+
git status --porcelain
92+
git status -s | grep "A" && exit 1
93+
git status -s | grep "M" && exit 1
94+
echo "API docs done"
8695
- run: hatch run docs:build
8796

8897
test_lint:

docs/api/jupyter_core.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
jupyter\_core package
2+
=====================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
jupyter_core.utils
11+
12+
Submodules
13+
----------
14+
15+
16+
.. automodule:: jupyter_core.application
17+
:members:
18+
:undoc-members:
19+
:show-inheritance:
20+
21+
22+
.. automodule:: jupyter_core.command
23+
:members:
24+
:undoc-members:
25+
:show-inheritance:
26+
27+
28+
.. automodule:: jupyter_core.migrate
29+
:members:
30+
:undoc-members:
31+
:show-inheritance:
32+
33+
34+
.. automodule:: jupyter_core.paths
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
40+
.. automodule:: jupyter_core.troubleshoot
41+
:members:
42+
:undoc-members:
43+
:show-inheritance:
44+
45+
46+
.. automodule:: jupyter_core.version
47+
:members:
48+
:undoc-members:
49+
:show-inheritance:
50+
51+
Module contents
52+
---------------
53+
54+
.. automodule:: jupyter_core
55+
:members:
56+
:undoc-members:
57+
:show-inheritance:

docs/api/jupyter_core.utils.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
jupyter\_core.utils package
2+
===========================
3+
4+
Module contents
5+
---------------
6+
7+
.. automodule:: jupyter_core.utils
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:

docs/api/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
jupyter_core
2+
============
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
jupyter_core

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"sphinx.ext.autodoc",
3434
"sphinx.ext.intersphinx",
3535
"sphinxcontrib_github_alt",
36+
"sphinx_autodoc_typehints",
3637
]
3738

3839
try:

docs/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ Contents:
1010
.. toctree::
1111
:maxdepth: 2
1212

13-
paths
1413
changelog
15-
14+
API Docs <api/modules>
1615

1716
Indices and tables
1817
==================

docs/paths.rst

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

jupyter_core/migrate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
- .ipython/
88
- nbextensions -> JUPYTER_DATA_DIR/nbextensions
99
- kernels -> JUPYTER_DATA_DIR/kernels
10+
1011
- .ipython/profile_default/
1112
- static/custom -> .jupyter/custom
1213
- nbconfig -> .jupyter/nbconfig
1314
- security/
15+
1416
- notebook_secret, notebook_cookie_secret, nbsignatures.db -> JUPYTER_DATA_DIR
17+
1518
- ipython_{notebook,nbconvert,qtconsole}_config.py -> .jupyter/jupyter_{name}_config.py
1619
1720
@@ -183,7 +186,7 @@ def migrate_static_custom(src, dst):
183186

184187

185188
def migrate_config(name, env):
186-
"""Migrate a config file
189+
"""Migrate a config file.
187190
188191
Includes substitutions for updated configurable names.
189192
"""

jupyter_core/utils/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515

1616
def ensure_dir_exists(path, mode=0o777):
17-
"""ensure that a directory exists
17+
"""Ensure that a directory exists
18+
1819
If it doesn't exist, try to create it, protecting against a race condition
1920
if another process is doing the same.
2021
The default permissions are determined by the current umask.
@@ -134,6 +135,7 @@ def run_sync(coro: Callable[..., Awaitable[T]]) -> Callable[..., T]:
134135
----------
135136
coro : coroutine
136137
The coroutine to be executed.
138+
137139
Returns
138140
-------
139141
result :

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ docs = [
5050
"myst-parser",
5151
"sphinxcontrib_github_alt",
5252
"sphinxcontrib_spelling",
53+
"sphinx-autodoc-typehints",
5354
"traitlets",
5455
]
5556

@@ -66,8 +67,11 @@ path = "jupyter_core/version.py"
6667

6768
[tool.hatch.envs.docs]
6869
features = ["docs"]
70+
[tool.hatch.envs.docs.env-vars]
71+
SPHINXOPTS = "-W -n"
6972
[tool.hatch.envs.docs.scripts]
70-
build = "make -C docs html SPHINXOPTS='-W'"
73+
build = "make -C docs html"
74+
api = "sphinx-apidoc -o docs/api -f -E jupyter_core jupyter_core/tests/*"
7175

7276
[tool.hatch.envs.test]
7377
features = ["test"]

0 commit comments

Comments
 (0)