Skip to content

Commit 194149d

Browse files
committed
Add aggregate AutoAPI reference built from httk-core/httk-atomistic submodules
1 parent c6f739a commit 194149d

17 files changed

Lines changed: 483 additions & 95 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Install project + docs deps
3030
run: |
31-
pip install -e .[docs]
31+
pip install -e .[docs] -e submodules/httk-core -e submodules/httk-atomistic
3232
3333
- name: Build docs
3434
run: make docs

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
*~
22
\#*\#
33
.\#*
4-
docs/reference/autoapi
4+
# AutoAPI output is generated at build time from the submodule sources; the src/
5+
# symlinks and the submodules/ checkouts themselves are tracked and must NOT be ignored.
6+
docs/reference/autoapi/
57

68
# Byte-compiled / optimized / DLL files
79
__pycache__/

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "submodules/httk-core"]
22
path = submodules/httk-core
33
url = https://github.com/httk/httk-core
4+
[submodule "submodules/httk-atomistic"]
5+
path = submodules/httk-atomistic
6+
url = https://github.com/httk/httk-atomistic

‎Makefile‎

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
11
PYTHON ?= python3
22

3-
.PHONY: docs docs-clean format format-check typecheck_pyright typecheck lint
3+
# Base URL of the published httk documentation site, used for cross-linking docs
4+
# between httk repositories (read by docs/conf.py via HTTK_DOCS_BASE_URL).
5+
DOCS_BASE_URL ?= https://docs.httk.org
46

5-
docs:
6-
$(PYTHON) -m sphinx -b html -W --keep-going docs docs/_build/html
7+
.PHONY: docs docs-live docs-clean clean
8+
9+
docs: docs-clean
10+
HTTK_DOCS_BASE_URL=$(DOCS_BASE_URL) $(PYTHON) -m sphinx -E -a -b html -W --keep-going docs docs/_build/html
711

812
docs-live:
9-
sphinx-autobuild docs docs/_build/html
13+
HTTK_DOCS_BASE_URL=$(DOCS_BASE_URL) sphinx-autobuild docs docs/_build/html
1014

1115
docs-clean:
12-
rm -rf docs/_build docs/reference/autoapi
13-
16+
rm -rf docs/_build
1417

1518
clean: docs-clean
1619
find . -name "*.pyc" -print0 | xargs -0 rm -f
1720
find . -name "*~" -print0 | xargs -0 rm -f
1821
find . -name "__pycache__" -print0 | xargs -0 rm -rf
19-
20-
format:
21-
$(PYTHON) -m ruff check src examples --select F401 --fix
22-
$(PYTHON) -m isort src examples
23-
$(PYTHON) -m black src examples
24-
25-
format-check:
26-
$(PYTHON) -m ruff check src examples
27-
$(PYTHON) -m isort --check-only src examples
28-
$(PYTHON) -m black --check src examples
29-
30-
typecheck_pyright:
31-
$(PYTHON) -m pyright
32-
33-
typecheck:
34-
$(PYTHON) -m mypy
35-
36-
lint:
37-
$(PYTHON) -m ruff check src examples

‎README.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# httk.github.io
2-
Documentation umbrella website
2+
3+
The top-level documentation site for *httk₂*, published to the root of
4+
[docs.httk.org](https://docs.httk.org). It introduces the toolkit and links to each
5+
module; the detailed API reference for every module lives on its own per-module
6+
subsite (e.g. `docs.httk.org/httk-core/`, `docs.httk.org/httk-atomistic/`).

‎docs/_templates/autoapi/index.rst‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
API Reference
2+
=============
3+
4+
This page contains auto-generated API reference documentation [#f1]_.
5+
6+
.. toctree::
7+
:titlesonly:
8+
9+
{% for page in pages %}
10+
{% set state = namespace(has_rendered_parent=false) %}
11+
{% for candidate in pages %}
12+
{% if candidate.id != page.id and page.id.startswith(candidate.id ~ ".") %}
13+
{% set state.has_rendered_parent = true %}
14+
{% endif %}
15+
{% endfor %}
16+
{% if not state.has_rendered_parent %}
17+
{{ page.include_path }}
18+
{% endif %}
19+
{% endfor %}
20+
21+
.. [#f1] Created with `sphinx-autoapi <https://github.com/readthedocs/sphinx-autoapi>`_

‎docs/conf.py‎

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,46 @@
11
import os
2-
import sys
32
import warnings
43
from datetime import date
54

65
from sphinx.deprecation import RemovedInSphinx10Warning
76
warnings.filterwarnings("ignore", category=RemovedInSphinx10Warning)
87

8+
# The notebooks are executed by a Jupyter kernel whose working directory is the
9+
# notebook's own folder, not this project root. Any relative PYTHONPATH entry (used
10+
# in local builds to point at a sibling module checkout, e.g. ../httk-atomistic/src)
11+
# would fail to resolve there, so normalize PYTHONPATH to absolute paths before the
12+
# kernel subprocess inherits it. Relative entries are resolved against the project
13+
# root (this conf.py's parent directory), which is where such a PYTHONPATH is meant
14+
# to be interpreted. This is a no-op in CI, where the modules are pip-installed and
15+
# PYTHONPATH is unset.
16+
_project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17+
_pythonpath = os.environ.get("PYTHONPATH")
18+
if _pythonpath:
19+
os.environ["PYTHONPATH"] = os.pathsep.join(
20+
os.path.join(_project_root, entry) if entry and not os.path.isabs(entry) else entry
21+
for entry in _pythonpath.split(os.pathsep)
22+
)
23+
924
project = "httk₂"
1025
author = "The httk₂ AUTHORS"
1126
copyright = f"{date.today().year}, {author}"
1227

1328
extensions = [
1429
# Core API docs
15-
"sphinx.ext.autodoc", # pull docstrings :contentReference[oaicite:4]{index=4}
16-
"sphinx.ext.autosummary", # API summary tables + stub gen :contentReference[oaicite:5]{index=5}
30+
"sphinx.ext.autodoc", # pull docstrings
31+
"sphinx.ext.autosummary", # API summary tables + stub gen
1732
"sphinx.ext.napoleon", # Google/NumPy docstrings
1833
"sphinx.ext.viewcode",
1934
"sphinx.ext.intersphinx",
35+
"sphinx.ext.extlinks",
2036
"sphinx.ext.mathjax", # math rendering via MathJax
2137

2238
# Nice-to-haves
2339
"sphinx_autodoc_typehints",
2440
"sphinx_copybutton",
2541

2642
# Markdown + notebooks
27-
"myst_nb", # .ipynb support :contentReference[oaicite:6]{index=6}
43+
"myst_nb", # .ipynb support
2844

2945
"autoapi.extension",
3046
]
@@ -61,20 +77,33 @@
6177
]
6278
myst_heading_anchors = 3
6379

64-
# myst-nb config: don't execute notebooks during docs build by default
65-
nb_execution_mode = "off"
80+
# Execute the example notebooks as part of the (strict) docs build, so that an
81+
# example that no longer matches the current httk-core / httk-atomistic API fails
82+
# the build instead of silently going stale.
83+
nb_execution_mode = "force"
6684

67-
html_theme = "furo" # modern theme :contentReference[oaicite:7]{index=7}
85+
html_theme = "furo"
6886
html_theme_options = {
6987
"sidebar_hide_name": False,
7088
"navigation_with_keys": True,
7189
}
7290

73-
# Optional: helpful external linking (edit as needed)
91+
# This top-level site now carries a full aggregate API reference built from the
92+
# submodule sources (see autoapi settings below), so cross-module references resolve
93+
# inside this site's own inventory rather than against the per-module subsites. The
94+
# DOCS_BASE_URL plumbing remains for the module directory's "go to the module's own
95+
# subsite" links. The base URL comes from the DOCS_BASE_URL Makefile variable
96+
# (exported as HTTK_DOCS_BASE_URL); the default below keeps bare sphinx invocations
97+
# working.
98+
_docs_base_url = os.environ.get("HTTK_DOCS_BASE_URL", "https://docs.httk.org")
99+
74100
intersphinx_mapping = {
75101
"python": ("https://docs.python.org/3", None),
76102
}
77103

104+
# Plain "go to the module's docs" links, e.g. {moduledocs}`httk-core`.
105+
extlinks = {"moduledocs": (f"{_docs_base_url}/%s/", "%s documentation")}
106+
78107
autoapi_options = [
79108
"members",
80109
"undoc-members",
@@ -85,16 +114,19 @@
85114
autoapi_root = "reference/autoapi"
86115
autoapi_ignore = [] # include everything
87116

88-
autoapi_follow_symlinks = True
89117
autoapi_type = "python"
118+
# The merged httk namespace tree: src/httk/core and src/httk/atomistic are committed
119+
# symlinks into the two submodule checkouts, so AutoAPI parses both distributions as
120+
# a single PEP 420 httk root and cross-module references (httk.atomistic subclassing
121+
# httk.core objects) resolve internally.
90122
autoapi_dirs = ["../src/httk"]
91-
autoapi_add_toctree_entry = False
123+
autoapi_add_toctree_entry = True
92124
autoapi_keep_files = True
93125
autoapi_member_order = "bysource"
94126
autoapi_python_class_content = "module" # docstring under class, not merged from __init__
95127
autoapi_python_use_implicit_namespaces = True
96-
autoapi_ignore = []
97-
#autoapi_template_dir = "_templates/autoapi"
128+
autoapi_follow_symlinks = True
129+
autoapi_template_dir = "_templates/autoapi"
98130

99131
nitpicky = True
100132
nitpick_ignore = [
@@ -116,4 +148,3 @@ def skip_member(app, what, name, obj, skip, options):
116148

117149
def setup(sphinx):
118150
sphinx.connect('autoapi-skip-member', skip_member)
119-

‎docs/index.md‎

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,65 @@
11
# *httk₂*
22

3-
This is the aggregate documentation website for *httk₂*.
3+
*httk₂* is a modular high-throughput toolkit for computational materials science.
4+
It is not a single package: the `httk.*` import namespace is a PEP 420 native
5+
namespace shared by a set of independently developed and released module repositories.
6+
Installing the `httk` namespace by itself provides no functionality; you install the
7+
modules you need — starting with {moduledocs}`httk-core <httk-core>`, which supplies
8+
the shared primitives (type dispatch, datastreams, the `DataLoader`), and adding domain
9+
modules such as {moduledocs}`httk-atomistic <httk-atomistic>` for crystal-structure
10+
representations.
411

5-
*httk₂* is comprised of independent modules.
6-
There is a "standard set" that one can install to get started;
7-
and then additional modules can be added.
12+
This site is the top-level documentation for *httk₂*. It carries an aggregate
13+
{doc}`API reference <reference/index>` covering the published modules (pinned to the
14+
submodule revisions this site is built against), and each module additionally
15+
publishes its own subsite under [docs.httk.org](https://docs.httk.org); the
16+
{doc}`module directory <modules>` links to each one.
817

9-
## Install a standard set of modules
18+
```{admonition} Quick links
19+
:class: tip
20+
21+
- **Module directory**: {doc}`modules` — every *httk₂* module and where its docs live.
22+
- **API reference**: {doc}`reference/index` — the aggregate reference for the published modules on this site.
23+
- **Example notebooks**: {doc}`notebooks/index` — runnable tours of the core and cross-module APIs.
24+
```
25+
26+
## Install
27+
28+
Preferably work in a Python virtual environment. Install {moduledocs}`httk-core <httk-core>`
29+
first — it brings in the `httk` namespace and the shared primitives:
1030

11-
Preferably work in a Python virtual environment, then do:
1231
```bash
13-
git clone https://github.com/httk/httk2
32+
git clone https://github.com/httk/httk-core
1433
cd httk-core
1534
python -m pip install -e .
1635
```
1736

18-
## Add a manually installed plugin module
37+
Then add whichever further modules you need, each the same way. For example, to add
38+
crystal-structure support from {moduledocs}`httk-atomistic <httk-atomistic>`:
1939

20-
Use the same Python virual environment, and do, e.g.:
2140
```bash
22-
git clone https://github.com/httk/httk-symgen
23-
cd httk-symgen
41+
git clone https://github.com/httk/httk-atomistic
42+
cd httk-atomistic
2443
python -m pip install -e .
2544
```
2645

46+
Each module is its own repository and can be installed independently; the shared
47+
`httk.*` namespace lets them compose at import time.
48+
2749
## Small usage example
2850

2951
```python
3052
from httk.core import subpackages
3153

54+
# The httk.* subpackages discovered in the current environment.
3255
print(subpackages)
3356
```
3457

35-
## Documentation
3658
```{toctree}
3759
:maxdepth: 2
60+
:hidden:
3861
62+
modules
3963
reference/index
4064
notebooks/index
4165
```

‎docs/modules.md‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Module directory
2+
3+
*httk₂* is delivered as a set of independent module repositories that share the
4+
`httk.*` namespace. Published modules are documented both here — in this site's
5+
aggregate {doc}`API reference <reference/index>`, pinned to the submodule revisions
6+
this site is built against — and on their own documentation subsite (both linked
7+
below); the remaining modules are under active development and do not yet publish
8+
docs.
9+
10+
## Published modules
11+
12+
### httk-core
13+
14+
Shared core primitives for *httk₂*: type dispatch and the view/backend pattern,
15+
datastreams, and the `DataLoader` for reading httk dataset files. Every other module
16+
builds on it. Import path: `httk.core`.
17+
18+
- API reference on this site: {doc}`httk.core </reference/autoapi/httk/core/index>`
19+
- Documentation subsite: {moduledocs}`httk-core`
20+
- Repository: <https://github.com/httk/httk-core>
21+
22+
### httk-atomistic
23+
24+
Crystal-structure representations — the `Structure` domain (Simple and primitive
25+
views, `Species`) built on the httk-core view/backend pattern. Import path:
26+
`httk.atomistic`.
27+
28+
- API reference on this site: {doc}`httk.atomistic </reference/autoapi/httk/atomistic/index>`
29+
- Documentation subsite: {moduledocs}`httk-atomistic`
30+
- Repository: <https://github.com/httk/httk-atomistic>
31+
32+
## In development
33+
34+
These modules are planned or in progress; their APIs and documentation are not yet
35+
published.
36+
37+
### httk-io
38+
39+
File I/O for *httk₂*, including the CIF reader/writer stack, registered as httk-core
40+
loaders. Import path: `httk.io`.
41+
42+
- Repository: <https://github.com/httk/httk-io>
43+
- Status: in development.
44+
45+
### httk-symgen
46+
47+
Symmetry-based crystal-structure generation. Import path: `httk.symgen`.
48+
49+
- Repository: <https://github.com/httk/httk-symgen>
50+
- Status: in development.
51+
52+
### httk-ml
53+
54+
Tooling for machine-learned interatomic potentials. Import path: `httk.ml`.
55+
56+
- Repository: <https://github.com/httk/httk-ml>
57+
- Status: in development.
58+
59+
### httk-optimade
60+
61+
OPTIMADE serving and client tooling. Import path: `httk.optimade`.
62+
63+
- Repository: <https://github.com/httk/httk-optimade>
64+
- Status: in development.
65+
66+
### httk-web
67+
68+
The web and OPTIMADE serving stack. Import path: `httk.web`.
69+
70+
- Repository: <https://github.com/httk/httk-web>
71+
- Status: in development.
72+
73+
### httk-magnetism
74+
75+
Magnetism workflows. Import path: `httk.magnetism`.
76+
77+
- Repository: <https://github.com/httk/httk-magnetism>
78+
- Status: in development.

0 commit comments

Comments
 (0)