Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
epinzur committed Oct 8, 2023
1 parent 49cf94a commit dcf1127
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
29 changes: 29 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,32 @@ Alternatively, install nox and run the tests inside an isolated environment:
```shell
nox
```

## Previewing Docs

* Install `quarto-cli` on your machine. Also consider installing an IDE extension.

See: https://quarto.org/docs/get-started/

* Generate reference docs

```shell
nox -s gen-docs
```

You should re-run this after making any updates to the `pysrc` docstrings.
If _Preview Docs_ is running in another shell, the system should auto-refresh with your changes.

* Preview docs (with auto-refresh on edit)

```shell
nox -s docs
```

* Cleanup generated and cached docs

```shell
nox -s docs-clean
```

Try this if you see something unexpected (especially after deleting or renaming).
27 changes: 10 additions & 17 deletions python/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,22 @@ def xdoctest(session: nox.Session) -> None:
install(session, groups=["test"])
session.run("python", "-m", "xdoctest", *args)

@nox.session(name="docs-clean", python=python_versions[0])
def docs_clean(session: nox.Session) -> None:
"""Clean up generated and cached docs"""

for item in [".quarto", "reference", "_inv", "objects.json"]:
p = Path("docs", item)
if p.exists() and p.is_dir():
shutil.rmtree(dir)
elif p.exists() and p.is_file():
p.unlink()

@nox.session(name="docs-gen", python=python_versions[0])
def docs_gen(session: nox.Session) -> None:
"""Generate API reference docs"""
install(session, groups=["docs"])

reference_dir = Path("docs", "reference")
if reference_dir.exists():
shutil.rmtree(reference_dir)

interlinks_dir = Path("docs", "_inv")
if interlinks_dir.exists():
shutil.rmtree(interlinks_dir)

objects_file = Path("docs", "objects.json")
if objects_file.exists():
objects_file.unlink()

with session.chdir("docs"):
session.run("python", "_scripts/gen_reference.py")
session.run("python", "-m", "quartodoc", "interlinks")
Expand All @@ -140,13 +138,8 @@ def docs_gen(session: nox.Session) -> None:
@nox.session(python=python_versions[0])
def docs(session: nox.Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""

install(session, groups=["docs"])

build_dir = Path("docs", ".quarto", "_site")
if build_dir.exists():
shutil.rmtree(build_dir)

with session.chdir("docs"):
session.run("quarto", "preview", external=True)

Expand Down

0 comments on commit dcf1127

Please sign in to comment.