-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f5707b
commit a7412ee
Showing
18 changed files
with
589 additions
and
803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
"""Documentation tools.""" | ||
|
||
import os | ||
from pathlib import Path | ||
|
||
DOCS = Path("docs") | ||
"""Docs directory.""" | ||
PYPROJECT = Path("pyproject.toml") | ||
"""Path to `pyproject.toml`.""" | ||
CHECKS = [DOCS, PYPROJECT] | ||
"""Checks for the root directory.""" | ||
|
||
|
||
def chdir_docs() -> Path: | ||
"""Ensure we are in the `docs` directory and return the root directory.""" | ||
root = get_root() | ||
os.chdir(root / "docs") | ||
return root | ||
|
||
|
||
def get_root() -> Path: | ||
"""Get the project root directory.""" | ||
path = Path().cwd() | ||
while not all((path / check).exists() for check in CHECKS): | ||
if path == (path := path.parent): | ||
raise RuntimeError("Either documentation or `pyproject.toml` is missing.") | ||
return path |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.