Skip to content

Commit 47d64ea

Browse files
committed
Fix sphinx warnings
1 parent 7f63bdc commit 47d64ea

File tree

7 files changed

+49
-233
lines changed

7 files changed

+49
-233
lines changed

docs/source/amaranth-soc.rst

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

docs/source/amaranth.rst

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

docs/source/conf.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import sys
44
from pathlib import Path
5+
from itertools import starmap
56

67
top_path = Path('../../')
78
sys.path.append(str((top_path / 'tools').absolute()))
@@ -15,6 +16,13 @@
1516
('chipflow/chipflow-lib', 'origin/main')
1617
]
1718

19+
# copy in the doc sources from our repos
20+
repo_list = copy_docs(repos)
21+
22+
# add our repos to path
23+
for r in repo_list:
24+
sys.path.append(str(r))
25+
1826
# -- Project information
1927

2028
project = 'ChipFlow'
@@ -75,7 +83,7 @@
7583
top_path / "vendor/chipflow-lib/chipflow_lib",
7684
]
7785
autoapi_generate_api_docs = True
78-
autoapi_template_dir = "_templates/autoapi"
86+
autoapi_template_dir = "chipflow-lib/_templates/autoapi"
7987
# autoapi_verbose_visibility = 2
8088
autoapi_keep_files = True
8189
autoapi_options = [
@@ -84,11 +92,14 @@
8492
'show-module-summary',
8593
'imported-members',
8694
]
95+
autoapi_root = "chipflow-lib/autoapi"
8796

8897
# Exclude autoapi templates and in-progress stuff
8998
exclude_patterns = [
9099
autoapi_template_dir,
91-
"unfinished",
100+
"chipflow-lib/unfinished",
101+
"amaranth/cover.rst",
102+
"amaranth-soc/cover.rst",
92103
]
93104

94105

@@ -97,18 +108,11 @@
97108
}
98109
intersphinx_disabled_domains = ['std']
99110

100-
exclude_patterns = [
101-
'amaranth/index.rst',
102-
'amaranth/cover.rst',
103-
'amaranth-soc/index.rst',
104-
'amaranth-soc/cover.rst',
105-
]
106-
107111
rediraffe_redirects = {
108112
"simulator.rst": "amaranth/simulator.rst",
109113
}
110114

111-
templates_path = ['_templates']
115+
templates_path = ['chipflow-lib/_templates']
112116

113117
# -- Options for HTML output
114118

@@ -159,12 +163,9 @@
159163
r"^https://github\.com/[^/]+/[^/]+/$",
160164
]
161165

166+
suppress_warnings = [ "ref.python" ]
162167

163168
# Silence the warnings globally; otherwise they may fire on object destruction and crash completely
164169
# unrelated tests.
165170
import amaranth._unused
166171
amaranth._unused.MustUse._MustUse__silence = True
167-
168-
# copy in the doc sources from our repos
169-
170-
copy_docs(repos)

docs/source/index.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ChipFlow Library Documentation
22
==============================
33

4-
.. image:: _assets/chipflow-logo.svg
4+
.. image:: chipflow-lib/_assets/chipflow-logo.svg
55
:width: 200px
66
:class: sd-m-auto
77
:name: landing-page-logo
@@ -13,16 +13,14 @@ ChipFlow IC Design Platform
1313
ChipFlow is an open-source platform for designing, testing, and manufacturing custom silicon.
1414
It provides a streamlined workflow from design to fabrication using Python and the Amaranth HDL.
1515

16-
.. toctree::
17-
:maxdepth: 2
18-
:caption: User Guide
19-
2016

2117
Contents
2218
--------
2319

2420
.. toctree::
25-
chipflow-lib
26-
amaranth
27-
amaranth-soc
21+
:caption: User Guide
22+
23+
chipflow-lib/index
24+
Amaranth Language and Toolchain <amaranth/index>
25+
Amaranth System-on-a-Chip toolkit <amaranth-soc/index>
2826
support

pdm.lock

Lines changed: 7 additions & 170 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ dependencies = [
2222
"sphinx_design_elements @ git+https://github.com/panodata/sphinx-design-elements@linktree",
2323
"sphinxext-rediraffe>=0.2.7",
2424
"sphinx-autoapi>=3.6.0",
25+
"jschon>=0.11.1",
2526
]
2627

2728
[build-system]
2829
requires = ["pdm-backend"]
2930
build-backend = "pdm.backend"
3031

31-
[dependency-groups]
32-
dev = [
33-
"-e amaranth@file:///${PROJECT_ROOT}/vendor/amaranth",
34-
"-e amaranth_soc@file:///${PROJECT_ROOT}/vendor/amaranth-soc",
35-
]
36-
3732
[tool.pdm.scripts]
3833
docs.cmd= "sphinx-build docs/source/ docs/build/"
3934
autodocs.cmd= "sphinx-autobuild docs/source/ docs/build/"

tools/copy_docs.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,27 @@
1010
from pathlib import Path
1111
from typing import List, Tuple
1212

13-
def copy_docs(repos: List[Tuple[str, str]]):
13+
def copy_docs(repos: List[Tuple[str, str]]) -> List[Path]:
14+
""""
15+
Pull in docs from other repos.
16+
17+
Clones the repos at the given refs in $PDM_PROJECT_ROOT/vendor
18+
Then copies the doc dirs into this one, tranforming `:role:` references appropriatly
19+
20+
Args:
21+
repos: List of tuples containing git repo and ref
22+
23+
Returns:
24+
A list of the repo locations
25+
"""
26+
1427
# Ensure vendor directory exists
1528
root_path = Path(os.environ['PDM_PROJECT_ROOT'])
1629
vendor = root_path / 'vendor'
1730
vendor.mkdir(exist_ok=True)
1831

32+
repo_list = []
33+
1934
for repo_info in repos:
2035
repo_path = Path(repo_info[0])
2136
ref = repo_info[1]
@@ -40,6 +55,8 @@ def copy_docs(repos: List[Tuple[str, str]]):
4055
# Checkout ref
4156
subprocess.run(['git', '-C', repodir, 'checkout', '-f', '--detach', ref], check=True)
4257

58+
repo_list.append(repodir)
59+
4360
print(f"Binding in {repo_path} docs as {name}")
4461

4562
if docs_dest_path.exists():
@@ -66,3 +83,5 @@ def copy_docs(repos: List[Tuple[str, str]]):
6683

6784
# assemble a
6885
print("Documentation copy completed successfully")
86+
87+
return repo_list

0 commit comments

Comments
 (0)