basic setup

- in the repo root, run:
  `poetry run mkdocs serve`
- Check the result: http://127.0.0.1:8000/

Signed-off-by: Philippe Leprince <philippe@ynput.io>
This commit is contained in:
Philippe Leprince 2025-03-13 15:19:03 +01:00
parent 69d570e02f
commit ee2b7d3ed9
9 changed files with 860 additions and 70 deletions

6
docs/css/custom.css Normal file
View file

@ -0,0 +1,6 @@
[data-md-color-scheme="slate"] {
/* simple slate overrides */
--md-primary-fg-color: hsl(155, 49%, 50%);
--md-accent-fg-color: rgb(93, 200, 156);
--md-typeset-a-color: hsl(155, 49%, 45%) !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
docs/img/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

1
docs/index.md Normal file
View file

@ -0,0 +1 @@
--8<-- "README.md"

2
docs/license.md Normal file
View file

@ -0,0 +1,2 @@
--8<-- "LICENSE"

67
mkdocs.yml Normal file
View file

@ -0,0 +1,67 @@
site_name: ayon-core
nav:
- Home: index.md
- License: license.md
theme:
name: material
palette:
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/toggle-switch-off-outline
name: Switch to light mode
- media: "(prefers-color-scheme: light)"
scheme: default
toggle:
icon: material/toggle-switch
name: Switch to dark mode
logo: img/ay-symbol-blackw-full.png
favicon: img/favicon.ico
features:
- navigation.sections
- navigation.path
- navigation.prune
extra:
version:
provider: mike
extra_css: [css/custom.css]
markdown_extensions:
- mdx_gh_links
- pymdownx.snippets
plugins:
- search
- offline
- mkdocs-autoapi:
autoapi_dir: ./
autoapi_add_nav_entry: Reference
autoapi_ignore:
- .*
- docs/**/*
- tests/**/*
- tools/**/*
- .*/**/*
- ./*.py
- mkdocstrings:
handlers:
python:
paths:
- .
- client
- server
- minify:
minify_html: true
minify_js: true
minify_css: true
htmlmin_opts:
remove_comments: true
cache_safe: true
- mike
hooks:
- mkdocs_hooks.py

54
mkdocs_hooks.py Normal file
View file

@ -0,0 +1,54 @@
import os
import sys
from pathlib import Path
import json
TMP_FILE = "./missing_init_files.json"
def add_missing_init_files(*roots):
nfiles = []
for root in roots:
for dirpath, dirs, files in os.walk(root):
if "__init__.py" in files:
continue
else:
Path(f"{dirpath}/__init__.py").touch()
nfiles.append(f"{dirpath}/__init__.py")
sys.stdout.write(
"\r\x1b[K" + f"PRE-BUILD: created {len(nfiles)} "
"temp __init__.py files"
)
sys.stdout.flush()
with open(TMP_FILE, "w") as f:
json.dump(nfiles, f)
sys.stdout.write(f"\n")
sys.stdout.flush()
def remove_missing_init_files():
with open(TMP_FILE, "r") as f:
nfiles = json.load(f)
for file in nfiles:
Path(file).unlink()
sys.stdout.write(
"\r\x1b[K" + f"POST_BUILD: removed {len(nfiles)} "
"temp __init__.py files"
)
sys.stdout.flush()
os.remove(TMP_FILE)
sys.stdout.write("\n")
sys.stdout.flush()
def on_pre_build(config):
add_missing_init_files("client", "server", "tests")
def on_post_build(config):
remove_missing_init_files()

786
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,14 @@ attrs = "^25.0.0"
pyblish-base = "^1.8.7"
clique = "^2.0.0"
opentimelineio = "^0.17.0"
# mkdocs generation
mkdocs-material = "^9.6.7"
mkdocs-autoapi = "^0.4.0"
mkdocstrings-python = "^1.16.2"
mkdocs-minify-plugin = "^0.8.0"
pymdown-extensions = "^10.14.3"
mdx-gh-links = "^0.4"
mike = "^2.1.3"
[tool.ruff]
@ -85,7 +93,7 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
exclude = [
"client/ayon_core/modules/click_wrap.py",
"client/ayon_core/scripts/slates/__init__.py"
"client/ayon_core/scripts/slates/__init__.py",
]
[tool.ruff.lint.per-file-ignores]
@ -125,6 +133,4 @@ build-backend = "poetry.core.masonry.api"
log_cli = true
log_cli_level = "INFO"
addopts = "-ra -q"
testpaths = [
"client/ayon_core/tests"
]
testpaths = ["client/ayon_core/tests"]