Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*.html
/.quarto/
**/*.quarto_ipynb
/_freeze/
/_site/
/*_files/libs/
/quarto/
36 changes: 36 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# HPI docs


- [Docs](#docs)
- [Legacy (org, being migrated)](#legacy-org-being-migrated)

Render all documentation with `tox -e quarto`. For live browser preview,
run `uv run --only-group quarto quarto preview doc --profile preview`
from the repository root.

With `freeze: auto`, Quarto only detects changes to `.qmd` files. After
editing `quarto_helpers.py`, run `tox -e quarto -- --execute` or delete
`_freeze/` to re-execute the docs that import it.

# Docs

User guides:

- [Configuring modules](configuring_modules.md)
- [Querying HPI](QUERY.md)
- [Denylists](DENYLIST.md)

Architecture decisions:

- [Configuration requirements](configuration_requirements.md)

# Legacy (org, being migrated)

- [CONFIGURING](CONFIGURING.org)
- [CONTRIBUTING](CONTRIBUTING.org)
- [DESIGN](DESIGN.org)
- [DEVELOPMENT](DEVELOPMENT.org)
- [MODULES](MODULES.org)
- [MODULE_DESIGN](MODULE_DESIGN.org)
- [OVERLAYS](OVERLAYS.org)
- [SETUP](SETUP.org)
32 changes: 32 additions & 0 deletions doc/README.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "HPI docs"
---

Render all documentation with `tox -e quarto`.
For live browser preview, run `uv run --only-group quarto quarto preview doc --profile preview` from the repository root.

With `freeze: auto`, Quarto only detects changes to `.qmd` files.
After editing `quarto_helpers.py`, run `tox -e quarto -- --execute` or delete `_freeze/` to re-execute the docs that import it.

# Docs

User guides:

- [Configuring modules](configuring_modules.md)
- [Querying HPI](QUERY.md)
- [Denylists](DENYLIST.md)

Architecture decisions:

- [Configuration requirements](configuration_requirements.md)

# Legacy (org, being migrated)

- [CONFIGURING](CONFIGURING.org)
- [CONTRIBUTING](CONTRIBUTING.org)
- [DESIGN](DESIGN.org)
- [DEVELOPMENT](DEVELOPMENT.org)
- [MODULES](MODULES.org)
- [MODULE_DESIGN](MODULE_DESIGN.org)
- [OVERLAYS](OVERLAYS.org)
- [SETUP](SETUP.org)
5 changes: 5 additions & 0 deletions doc/_quarto-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Website mode is only for project-wide live preview and qmd-to-html link resolution.
project:
type: website

format: html
14 changes: 6 additions & 8 deletions doc/quarto/_quarto.yml → doc/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ project:
- "*.qmd" # otherwise picks up .md for some reason??
- "README.qmd" # for whatever reason quarto excludes it by default
format:
gfm:
toc: true
toc-depth: 3
html:
toc: true
toc-depth: 3
anchor-sections: true
# code-fold: true
gfm: default
html: default
toc: true
toc-depth: 3
anchor-sections: true
# code-fold: true
execute:
freeze: auto # re-render only when source changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

This doc describes the technical decisions behind HPI configuration
system. It’s more of a ‘design doc’ rather than usage guide. If you just
want to know how to set up HPI or configure it, see
[SETUP](../SETUP.org).
want to know how to set up HPI or configure it, see [SETUP](SETUP.org).

I feel like it’s good to keep the rationales in the documentation, but
happy to [discuss](https://github.com/karlicoss/HPI/issues/46) it here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,12 @@ format:

```{python}
#| echo: false
from pathlib import Path
import jedi

src_dir = Path.cwd().absolute().parent.parent / 'src'
assert src_dir.exists(), src_dir

project = jedi.Project(src_dir)

def github_link(name: str) -> str:
completions = list(project.complete_search(name, all_scopes=True))
assert len(completions) == 1, f"Expected one completion for {name}, got {completions}"
[c] = completions
[c] = c.goto()
rpath = Path(c.module_path).relative_to(src_dir)
return f"https://github.com/karlicoss/HPI/blob/master/src/{rpath}#L{c.line}"
from quarto_helpers import github_link
```

This doc describes the technical decisions behind HPI configuration system.
It's more of a 'design doc' rather than usage guide.
If you just want to know how to set up HPI or configure it, see [SETUP](../SETUP.org).
If you just want to know how to set up HPI or configure it, see [SETUP](SETUP.org).

I feel like it's good to keep the rationales in the documentation,
but happy to [discuss](https://github.com/karlicoss/HPI/issues/46) it here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Cons:
instantiate the config on first use (TODO link to it later).

See more about this approach
[here](https://github.com/karlicoss/HPI/blob/master/src/my/core/docs/test_configuration.py#L384).
[here](https://github.com/karlicoss/HPI/blob/master/src/my/core/docs/test_configuration.py#L386).

# Other options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,7 @@ format:

```{python}
#| echo: false
from pathlib import Path
import jedi

src_dir = Path.cwd().absolute().parent.parent / 'src'
assert src_dir.exists(), src_dir

project = jedi.Project(src_dir)

def github_link(name: str) -> str:
completions = list(project.complete_search(name, all_scopes=True))
assert len(completions) == 1, f"Expected one completion for {name}, got {completions}"
[c] = completions
[c] = c.goto()
rpath = Path(c.module_path).relative_to(src_dir)
return f"https://github.com/karlicoss/HPI/blob/master/src/{rpath}#L{c.line}"
from quarto_helpers import github_link
```


Expand Down Expand Up @@ -152,4 +138,3 @@ Many actual HPI modules still have different implementations for historic reason
If you're interested to dig more, see [test_configuration](`{python} github_link("my.core.docs.test_configuration")`) that covers various approaches.

However, we've found that the property-based approach described above has the fewest quirks, so we recommend it going forward.

10 changes: 10 additions & 0 deletions doc/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "HPI docs"
format: html
---

<!-- This file only provides the index Quarto requires for project-wide live preview. -->

<meta http-equiv="refresh" content="0; url=README.html">

[Open the documentation index](README.html).
4 changes: 0 additions & 4 deletions doc/quarto/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions doc/quarto/README.md

This file was deleted.

29 changes: 0 additions & 29 deletions doc/quarto/README.qmd

This file was deleted.

53 changes: 0 additions & 53 deletions doc/quarto/validate_references.py

This file was deleted.

24 changes: 24 additions & 0 deletions doc/quarto_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import tomllib
from pathlib import Path

import jedi

REPO = Path(__file__).parent.parent
SRC = REPO / "src"

with (REPO / "pyproject.toml").open("rb") as fo:
pyproject = tomllib.load(fo)
GITHUB = pyproject["project"]["urls"]["Homepage"]
assert isinstance(GITHUB, str), GITHUB
assert GITHUB.startswith("https://github.com/"), GITHUB

project = jedi.Project(SRC)


def github_link(name: str) -> str:
completions = list(project.complete_search(name, all_scopes=True))
assert len(completions) == 1, f"Expected one completion for {name}, got {completions}"
[c] = completions
[c] = c.goto()
rpath = Path(c.module_path).relative_to(SRC)
return f"{GITHUB}/blob/master/src/{rpath}#L{c.line}"
Loading
Loading