From a2a56c870f342db053ac297d50bb1927ed70cf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Wed, 1 Oct 2025 17:11:18 +0200 Subject: [PATCH 01/11] =?UTF-8?q?=E2=9C=A8=20add=20files=20for=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/css/custom.css | 12 ++ docs/img/ay-symbol-blackw-full.png | Bin 0 -> 1632 bytes docs/img/favicon.ico | Bin 0 -> 490 bytes docs/index.md | 1 + docs/license.md | 1 + mkdocs.yml | 71 +++++++++++ mkdocs_hooks.py | 191 +++++++++++++++++++++++++++++ 7 files changed, 276 insertions(+) create mode 100644 docs/css/custom.css create mode 100644 docs/img/ay-symbol-blackw-full.png create mode 100644 docs/img/favicon.ico create mode 100644 docs/index.md create mode 100644 docs/license.md create mode 100644 mkdocs.yml create mode 100644 mkdocs_hooks.py diff --git a/docs/css/custom.css b/docs/css/custom.css new file mode 100644 index 0000000..28461e6 --- /dev/null +++ b/docs/css/custom.css @@ -0,0 +1,12 @@ +[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; +} +[data-md-color-scheme="default"] { + /* simple default 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; +} diff --git a/docs/img/ay-symbol-blackw-full.png b/docs/img/ay-symbol-blackw-full.png new file mode 100644 index 0000000000000000000000000000000000000000..5edda784cc7a2512bc050aeb5779465cd04c2155 GIT binary patch literal 1632 zcmV-m2A}zfP)|OZpvMT@p z1?fpdK~#9!?VZ_j<2npP2TK@H|Np@^HmE0U%ie zwrho$g@vvQV82#~@&=G|0QSm38essrE`Y6a5b_{_ZveJIfb%f1-vrz!2L}SM1p+`L z4Isw}xJeE|9xN~f!14B_gUlen^`rmtz(@{K+wf~FAPWFI8GpG03nNh40^eR}`_(b* z8-J+-%jO_-@LyF0ur&Y|<1cjpw@$#fOYNM4)DJ)@0%R6|jS=Wiz|C_I=Nf>U7Qk%< zl-9scPo z3Cx5R%E5-s@I$Tu^jl%mX^2B`{K^P4o`yIC$FJK8TTeqAa^qLc!H&}qht%*@TVdC6 zm_umziU@R{2Rn`r7e4;k^z0a1r3ja`U?!+D8k+^NV@nR5yR0fu&YGJ75|)#BI*rkVftrp z6mf5x7MS!FxXP0O7!d_s{e`9_;HZ|^8!I@a1xi9IQ~aY_A&$RusYu0{2`JkVg_?~hiJ*b~gvXT_eUXnFz`lYEZ(}AMJP9^0sPLpoKur{sd`4_Z zO>9cgbt3kxX89CYOcKq(-XDldwJ^)ADT6)$KPJj&9W?#NEl@Q9AEF>tF(b0I#%e9_ z*|&NQ`Ol+Uq1bPvrZndN4n_bb9D5piqzbeXP+Pc20qBW+1JH?p0RZ|CAPWYN>jLO1 z0w5a(G*1bP0MLv8XES2I3D}W?h5%?n0LYR74O0Tlrc|ASkc|m^15k|sXLDk&EwHH- z8U&yU0U(P8RJ20OCWUTWU~Ma$0l@j7br6`6fO4DQ@;OL$4WM;eppF402uw;qB?Ag_ z5N#WPt2_g08E{(!WZeK-WD=lezzqUq-vC-;5};?mRSr&^1u7bF(F!Nd0yPc56_!CX z4S1P@!`=faeIzT?f-O;OXkv+;uQr1D@sJ=(^ko2Q?*wQY@Q{P# z%>Yu~3Q{-V7XswZ0MgwH)HmP<0_f3z?~NdPG=Nlh!xu2%TMeL315ook$O;CKVgxK< zK-N4Du!I4icp_*C12_x_1HynXAPk5$7!N}6DC~YRj4TOu-1xDtOi^ z34H@Fc7|eaFm{LId_WwLi9=FxOfF7}>Nucjz{MK_?BRU@UgEWBy;o)+-Wt1mZ_M(W zqebt|0+LMwsQmr;@f6HAfVk?1WB}2U0f;TXCrO-&VOBDW z7Or(873EIlIT6LwKxI2eo;o=1xOh(J^n}6w)#aY^{rCKb3;!u~VZ}*z0vS*W?WMRo z@~L)%?PUw?ZUL>QT|d}AYNP9!TivPy4YWJ<7X}bou&uG$CfJ;B#)Litao(Fnd9See}c`$7L48j z?CMlAO`U|4=H+hSCoCayPh<3}Ah-rupk8Q%tCxU%DVhvMPf_-612?Pd9uoEZ<3Rxa g4bPjr^y3ws0MrSDl)+%k9smFU07*qoM6N<$f>Hk4NdN!< literal 0 HcmV?d00001 diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..612c7a5 --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +--8<-- "README.md" diff --git a/docs/license.md b/docs/license.md new file mode 100644 index 0000000..f409d45 --- /dev/null +++ b/docs/license.md @@ -0,0 +1 @@ +--8<-- "LICENSE" diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..f9ad7a6 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,71 @@ +site_name: ayon-addon-template +repo_url: https://github.com/ynput/ayon-addon-template + +nav: + - Home: index.md + - License: license.md + +theme: + name: material + palette: + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/weather-sunny + name: Switch to light mode + - media: "(prefers-color-scheme: light)" + scheme: default + toggle: + icon: material/weather-night + 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/**/* + - stubs/**/* # mocha fix + - ./**/pythonrc.py # houdini fix + - .*/**/* + - ./*.py + - mkdocstrings: + handlers: + python: + paths: + - ./ + - client/* + - server/* + - services/* + - minify: + minify_html: true + minify_js: true + minify_css: true + htmlmin_opts: + remove_comments: true + cache_safe: true + - mike + +hooks: + - mkdocs_hooks.py diff --git a/mkdocs_hooks.py b/mkdocs_hooks.py new file mode 100644 index 0000000..1faa195 --- /dev/null +++ b/mkdocs_hooks.py @@ -0,0 +1,191 @@ +import os +from pathlib import Path +from shutil import rmtree +import json +import glob +import logging + +TMP_FILE = "./missing_init_files.json" +NFILES = [] + +# ----------------------------------------------------------------------------- + + +class ColorFormatter(logging.Formatter): + grey = "\x1b[38;20m" + green = "\x1b[32;20m" + yellow = "\x1b[33;20m" + red = "\x1b[31;20m" + bold_red = "\x1b[31;1m" + reset = "\x1b[0m" + fmt = ( + "%(asctime)s - %(name)s - %(levelname)s - %(message)s " # noqa + "(%(filename)s:%(lineno)d)" + ) + + FORMATS = { + logging.DEBUG: grey + fmt + reset, + logging.INFO: green + fmt + reset, + logging.WARNING: yellow + fmt + reset, + logging.ERROR: red + fmt + reset, + logging.CRITICAL: bold_red + fmt + reset, + } + + def format(self, record): + log_fmt = self.FORMATS.get(record.levelno) + formatter = logging.Formatter(log_fmt) + return formatter.format(record) + + +ch = logging.StreamHandler() +ch.setFormatter(ColorFormatter()) + +logging.basicConfig( + level=logging.INFO, + handlers=[ch], +) + + +# ----------------------------------------------------------------------------- + + +def create_init_file(dirpath, msg): + global NFILES + ini_file = f"{dirpath}/__init__.py" + Path(ini_file).touch() + NFILES.append(ini_file) + logging.info(f"{msg}: created '{ini_file}'") + + +def create_parent_init_files(dirpath: str, rootpath: str, msg: str): + parent_path = dirpath + while parent_path != rootpath: + parent_path = os.path.dirname(parent_path) + parent_init = os.path.join(parent_path, "__init__.py") + if not os.path.exists(parent_init): + create_init_file(parent_path, msg) + else: + break + + +def add_missing_init_files(*roots, msg=""): + """ + This function takes in one or more root directories as arguments and scans + them for Python files without an `__init__.py` file. It generates a JSON + file named `missing_init_files.json` containing the paths of these files. + + Args: + *roots: Variable number of root directories to scan. + + Returns: + None + """ + + for root in roots: + if not os.path.exists(root): + continue + rootpath = os.path.abspath(root) + for dirpath, dirs, files in os.walk(rootpath): + if "__init__.py" in files: + continue + + if "." in dirpath: + continue + + if not glob.glob(os.path.join(dirpath, "*.py")): + continue + + create_init_file(dirpath, msg) + create_parent_init_files(dirpath, rootpath, msg) + + with open(TMP_FILE, "w") as f: + json.dump(NFILES, f) + + +def remove_missing_init_files(msg=""): + """ + This function removes temporary `__init__.py` files created in the + `add_missing_init_files()` function. It reads the paths of these files from + a JSON file named `missing_init_files.json`. + + Args: + None + + Returns: + None + """ + global NFILES + nfiles = [] + if os.path.exists(TMP_FILE): + with open(TMP_FILE, "r") as f: + nfiles = json.load(f) + else: + nfiles = NFILES + + for file in nfiles: + Path(file).unlink() + logging.info(f"{msg}: removed {file}") + + os.remove(TMP_FILE) + NFILES = [] + + +def remove_pychache_dirs(msg=""): + """ + This function walks the current directory and removes all existing + '__pycache__' directories. + + Args: + msg: An optional message to display during the removal process. + + Returns: + None + """ + nremoved = 0 + + for dirpath, dirs, files in os.walk("."): + if "__pycache__" in dirs: + pydir = Path(f"{dirpath}/__pycache__") + rmtree(pydir) + nremoved += 1 + logging.info(f"{msg}: removed '{pydir}'") + + if not nremoved: + logging.info(f"{msg}: no __pycache__ dirs found") + + +# mkdocs hooks ---------------------------------------------------------------- + + +def on_startup(command, dirty): + remove_pychache_dirs(msg="HOOK - on_startup") + + +def on_pre_build(config): + """ + This function is called before the MkDocs build process begins. It adds + temporary `__init__.py` files to directories that do not contain one, to + make sure mkdocs doesn't ignore them. + """ + try: + add_missing_init_files( + "client", + "server", + "services", + msg="HOOK - on_pre_build", + ) + except BaseException as e: + logging.error(e) + remove_missing_init_files( + msg="HOOK - on_post_build: cleaning up on error !" + ) + raise + + +def on_post_build(config): + """ + This function is called after the MkDocs build process ends. It removes + temporary `__init__.py` files that were added in the `on_pre_build()` + function. + """ + remove_missing_init_files(msg="HOOK - on_post_build") From 0fe6d35dc643fca31546c14345f624ee3255c995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Wed, 1 Oct 2025 17:12:12 +0200 Subject: [PATCH 02/11] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20add=20dependencies?= =?UTF-8?q?=20for=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index efe7db6..c192749 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ # be used only for local development and CI/CD purposes. To define addon # dependencies, use pyproject.toml file in the `client` directory. - [project] name = "ayon-addon-template" version = "0.1.0" @@ -12,15 +11,23 @@ description = "Add your description here" license = "Apache-2.0" readme = "README.md" requires-python = ">=3.9.6" -dependencies = [] +dependencies = [ + "pre-commit", + "ruff ~= 0.11.4", + "mypy", + "mkdocs-material ~= 9.6.7", + "mkdocs-autoapi ~= 0.4.0", + "mkdocstrings-python ~= 1.16.2", + "mkdocs-minify-plugin ~= 0.8.0", + "markdown-checklist ~= 0.4.4", + "mdx-gh-links ~= 0.4", + "pymdown-extensions ~= 10.14.3", + "mike ~= 2.1.3", + "mkdocstrings-shell ~= 1.0.2" +] [project.optional-dependencies] dev = [ "pytest", "codespell", - "ruff ~= 0.11.4", - "flake8", - "mypy", - "isort", - "pre-commit" ] From 5ae7bd0c005f680d8403f27262e8b51897cd151a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Wed, 1 Oct 2025 17:12:35 +0200 Subject: [PATCH 03/11] :bug: fix tool script and add pre-commit conf --- pre-commit-config.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pre-commit-config.yaml diff --git a/pre-commit-config.yaml b/pre-commit-config.yaml new file mode 100644 index 0000000..64834a6 --- /dev/null +++ b/pre-commit-config.yaml @@ -0,0 +1,27 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: no-commit-to-branch + args: [ '--pattern', '^(?!((release|enhancement|feature|bugfix|documentation|tests|local|chore)\/[a-zA-Z0-9\-_]+)$).*' ] + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli + + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.13.2 + hooks: + # Run the linter. + - id: ruff + # Run the formatter. + # - id: ruff-format From 28a73b0d9eab0f2c92ebe8f8b487e8880cfd79f2 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Mon, 22 Dec 2025 13:02:34 +0200 Subject: [PATCH 04/11] Update MkDocs setup --- .github/workflows/deploy_mkdocs.yml | 18 ++++++++++++++++++ mkdocs_requirements.txt | 9 +++++++++ pyproject.toml | 11 +---------- 3 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/deploy_mkdocs.yml create mode 100644 mkdocs_requirements.txt diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml new file mode 100644 index 0000000..deafc7b --- /dev/null +++ b/.github/workflows/deploy_mkdocs.yml @@ -0,0 +1,18 @@ +name: Deploy MkDocs + +on: + push: + tags: + - "*" + workflow_dispatch: + +jobs: + build-mk-docs: + # FIXME: Update @develop to @main after `ops-repo-automation` release. + uses: ynput/ops-repo-automation/.github/workflows/deploy_mkdocs.yml@develop + with: + repo: ${{ github.repository }} + secrets: + YNPUT_BOT_TOKEN: ${{ secrets.YNPUT_BOT_TOKEN }} + CI_USER: ${{ secrets.CI_USER }} + CI_EMAIL: ${{ secrets.CI_EMAIL }} diff --git a/mkdocs_requirements.txt b/mkdocs_requirements.txt new file mode 100644 index 0000000..829d029 --- /dev/null +++ b/mkdocs_requirements.txt @@ -0,0 +1,9 @@ +mkdocs-material >= 9.6.7 +mkdocs-autoapi >= 0.4.0 +mkdocstrings-python >= 1.16.2 +mkdocs-minify-plugin >= 0.8.0 +markdown-checklist >= 0.4.4 +mdx-gh-links >= 0.4 +pymdown-extensions >= 10.14.3 +mike >= 2.1.3 +mkdocstrings-shell >= 1.0.2 diff --git a/pyproject.toml b/pyproject.toml index c192749..c0e5809 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,16 +14,7 @@ requires-python = ">=3.9.6" dependencies = [ "pre-commit", "ruff ~= 0.11.4", - "mypy", - "mkdocs-material ~= 9.6.7", - "mkdocs-autoapi ~= 0.4.0", - "mkdocstrings-python ~= 1.16.2", - "mkdocs-minify-plugin ~= 0.8.0", - "markdown-checklist ~= 0.4.4", - "mdx-gh-links ~= 0.4", - "pymdown-extensions ~= 10.14.3", - "mike ~= 2.1.3", - "mkdocstrings-shell ~= 1.0.2" + "mypy" ] [project.optional-dependencies] From dafee8978ea89db04db24eba67e4968f5b73a32a Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Mon, 22 Dec 2025 13:12:24 +0200 Subject: [PATCH 05/11] MK docs CI: Add push on current branch for testing. --- .github/workflows/deploy_mkdocs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index deafc7b..db96b50 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -4,6 +4,8 @@ on: push: tags: - "*" + branches: + - "enhancement/add-docs-infrastructure" workflow_dispatch: jobs: From 84adf1fd296a76f1388627ad655f0460526c0017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Mon, 9 Feb 2026 14:44:49 +0100 Subject: [PATCH 06/11] :recycle: update ruff and add docs commands --- .github/workflows/pr_linting.yml | 8 ++- pre-commit-config.yaml | 2 +- pyproject.toml | 2 +- tools/manage.ps1 | 90 ++++++++++++++++++++++++-------- 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pr_linting.yml b/.github/workflows/pr_linting.yml index d41596f..32e5ce5 100644 --- a/.github/workflows/pr_linting.yml +++ b/.github/workflows/pr_linting.yml @@ -21,7 +21,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v46 + with: + files: | + **.py - uses: astral-sh/ruff-action@v3 with: - changed-files: "true" version-file: "pyproject.toml" + src: ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/pre-commit-config.yaml b/pre-commit-config.yaml index 64834a6..be90fb2 100644 --- a/pre-commit-config.yaml +++ b/pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.13.2 + rev: v0.15.0 hooks: # Run the linter. - id: ruff diff --git a/pyproject.toml b/pyproject.toml index c0e5809..5c7c45c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ readme = "README.md" requires-python = ">=3.9.6" dependencies = [ "pre-commit", - "ruff ~= 0.11.4", + "ruff ~= 0.15.0", "mypy" ] diff --git a/tools/manage.ps1 b/tools/manage.ps1 index 3006c9e..15801e9 100644 --- a/tools/manage.ps1 +++ b/tools/manage.ps1 @@ -80,7 +80,26 @@ function Write-Info { [switch] $NoNewLine ) if (Test-CommandExists "Write-Color") { - Write-Color -Text $Text -Color $Color -BackGroundColor $BackGroundColor -StartTab $StartTab -LinesBefore $LinesBefore -LinesAfter $LinesAfter -StartSpaces $StartSpaces -LogFile $LogFile -DateTimeFormat $DateTimeFormat -LogTime $LogTime -LogRetry $LogRetry -Encoding $Encoding -ShowTime $ShowTime -NoNewLine $NoNewLine + $params = @{ + Text = $Text + Color = $Color + BackGroundColor = $BackGroundColor + StartTab = $StartTab + LinesBefore = $LinesBefore + LinesAfter = $LinesAfter + StartSpaces = $StartSpaces + LogFile = $LogFile + DateTimeFormat = $DateTimeFormat + LogTime = $LogTime + LogRetry = $LogRetry + Encoding = $Encoding + NoNewLine = $NoNewLine + } + if ($NoNewLine) { + $params.NoNewLine = $true + } + + Write-Color @params } else { $message = $Text -join ' ' if ($NoNewLine) @@ -136,34 +155,49 @@ function Restore-Cwd() { } } -function Create-UvEnv { - Change-Cwd +function Deploy-UvEnv { + Set-Cwd Write-Color -Text ">>> ", "Test if UV is installed ... " -Color Green, Gray -NoNewline if (Get-Command "uv" -ErrorAction SilentlyContinue) { Write-Color -Text "OK" -Color Green - } else { - if (Test-Path -PathType Leaf -Path "$($USERPROFILE)/.cargo/bin/uv") { - $env:PATH += ";$($env:USERPROFILE)/.cargo/bin" + } else + { + if (Test-Path -PathType Leaf -Path "$( $USERPROFILE )/.cargo/bin/uv") + { + $env:PATH += ";$( $env:USERPROFILE )/.cargo/bin" Write-Color -Text "OK" -Color Green - } else { + } + else + { Write-Color -Text "NOT FOUND" -Color Yellow Install-Uv Write-Color -Text "INSTALLED" -Color Cyan } } - $python_arg = "" $startTime = [int][double]::Parse((Get-Date -UFormat %s)) # note that uv venv can use .python-version marker file to determine what python version to use # so you can safely use pyenv to manage python versions Write-Color -Text ">>> ", "Creating and activating venv ... " -Color Green, Gray uv venv --allow-existing .venv - Write-Color -Text ">>> ", "Compiling dependencies ... " -Color Green, Gray - uv pip compile pyproject.toml windows-requirements.in -o requirements.txt - Write-Color -Text ">>> ", "Installing dependencies ... " -Color Green, Gray - uv pip install -r requirements.txt - Install-PrecommitHook + if (Test-Path -PathType Leaf -Path "$($RepoRoot)/requirements.txt") { + Write-Color -Text ">>> ", "Syncing dependencies ... " -Color Green, Gray + & uv sync + } else { + Write-Color -Text ">>> ", "Compiling dependencies ... " -Color Green, Gray + $compile_args = @("pip", "compile", "pyproject.toml") + # add windows specific dependencies inly if .in file exists + if (Test-Path -PathType Leaf -Path "$($RepoRoot)/windows-requirements.in") { + $compile_args += @("windows-requirements.in") + } + # output to requirements.txt + $compile_args += @("-o", "requirements.txt") + & uv @compile_args + Write-Color -Text ">>> ", "Installing dependencies ... " -Color Green, Gray + uv pip install -r requirements.txt + } + & uv run pre-commit install $endTime = [int][double]::Parse((Get-Date -UFormat %s)) Restore-Cwd try @@ -195,13 +229,13 @@ function Invoke-Codespell { & uv $CodespellArgs } -function Run-Tests { +function Start-Tests { $RunArgs = @( "run", "pytest", "$($RepoRoot)/tests") & uv $RunArgs @arguments } -function Clean-Cache { +function Clear-Cache { Write-Info -Text ">>> ", "Cleaning cache files ... " -Color Green, Gray -NoNewline Get-ChildItem $repo_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force Get-ChildItem $repo_root -Filter "*.pyo" -Force -Recurse | Remove-Item -Force @@ -210,14 +244,14 @@ function Clean-Cache { } function Build-Docs { - Clean-Cache + Clear-Cache $RunArgs = @( "run", "mkdocs", "build") & uv $RunArgs @arguments } -function Serve-Docs { - Clean-Cache +function Start-ServingDocs { + Clear-Cache $RunArgs = @( "run", "mkdocs", "serve") & uv $RunArgs @arguments @@ -231,13 +265,18 @@ function Write-Help { Write-Host "" Write-Host "AYON Addon management script" Write-Host "" + Write-Info -Text "Repository: ", "$($RepoRoot)" -Color Gray, Cyan Write-Info -Text "Usage: ", "./manage.ps1 ", "[command]" -Color Gray, White, Cyan Write-Host "" Write-Host "Commands:" + Write-Info -Text " create-env ", "Install uv and update venv by lock file" -Color White, Cyan Write-Info -Text " ruff-check ", "Run Ruff check for the repository" -Color White, Cyan Write-Info -Text " ruff-fix ", "Run Ruff fix for the repository" -Color White, Cyan Write-Info -Text " codespell ", "Run codespell check for the repository" -Color White, Cyan + Write-Info -Text " build-docs ", "Build documentation" -Color White, Cyan + Write-Info -Text " serve-docs ", "Serve documentation locally" -Color White, Cyan + Write-Info -Text " clear-cache ", "Clear Python cache" -Color White, Cyan Write-Host "" } @@ -249,7 +288,7 @@ function Resolve-Function { $FunctionName = $FunctionName.ToLower() -replace "\W" if ($FunctionName -eq "createenv") { Set-Cwd - Initialize-Environment + Deploy-UvEnv } elseif ($FunctionName -eq "ruffcheck") { Set-Cwd Invoke-Ruff @@ -261,10 +300,19 @@ function Resolve-Function { Invoke-CodeSpell } elseif ($FunctionName -eq "run") { Set-Cwd - Run-From-Code + & uv run python start.py @arguments } elseif ($FunctionName -eq "runtests") { Set-Cwd - Run-Tests + Start-Tests + } elseif ($FunctionName -eq "builddocs") { + Set-Cwd + Build-Docs + } elseif ($FunctionName -eq "servedocs") { + Set-Cwd + Start-ServingDocs + } elseif ($FunctionName -eq "clearcache") { + Set-Cwd + Clear-Cache } else { Write-Host "Unknown function ""$FunctionName""" Write-Help From 6d19f3d29ac95e311709b3ca8bc0c773c8fc503a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Mon, 9 Feb 2026 14:49:13 +0100 Subject: [PATCH 07/11] :recycle: update linux script with docs --- tools/manage.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/manage.sh b/tools/manage.sh index 9571969..33521ba 100755 --- a/tools/manage.sh +++ b/tools/manage.sh @@ -159,6 +159,16 @@ run_codespell () { uv run codespell } +build_docs () { + echo -e "${BIGreen}>>>${RST} Building documentation ..." + uv run mkdocs build +} + +serve_docs () { + echo -e "${BIGreen}>>>${RST} Serving documentation ..." + uv run mkdocs serve +} + main () { detect_python || return 1 @@ -195,6 +205,19 @@ main () { run_tests "$@" || return_code=$? exit $return_code ;; + "builddocs") + build_docs || return_code=$? + exit $return_code + ;; + + "servedocs") + serve_docs || return_code=$? + exit $return_code + ;; + "clearcache") + clean_pyc || return_code=$? + exit $return_code + ;; esac if [ "$function_name" != "" ]; then From a2444fca43552913d5b67745959da057f00bddcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Tue, 10 Feb 2026 14:14:30 +0100 Subject: [PATCH 08/11] :recycle: add commands to help --- tools/manage.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/manage.sh b/tools/manage.sh index 33521ba..09a7e63 100755 --- a/tools/manage.sh +++ b/tools/manage.sh @@ -141,6 +141,11 @@ default_help() { echo -e " ${BWhite}ruff-check${RST} ${BCyan}Run Ruff check for the repository${RST}" echo -e " ${BWhite}ruff-fix${RST} ${BCyan}Run Ruff fix for the repository${RST}" echo -e " ${BWhite}codespell${RST} ${BCyan}Run codespell check for the repository${RST}" + echo -e " ${BWhite}build-docs${RST} ${BCyan}Build documentation using mkdocs${RST}" + echo -e " ${BWhite}serve-docs${RST} ${BCyan}Serve documentation using mkdocs${RST}" + echo -e " ${BWhite}clear-cache${RST} ${BCyan}Clear Python cache files${RST}" + echo -e " ${BWhite}run${RST} ${BCyan}Run a command in the virtual environment${RST}" + echo -e " ${BWhite}run-tests${RST} ${BCyan}Run tests in the virtual environment${RST}" echo "" } From 9c5bd93a7f522487844f75b567e59acd297d26cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Tue, 10 Feb 2026 14:14:46 +0100 Subject: [PATCH 09/11] =?UTF-8?q?=E2=9E=96=20remove=20dev=20branches?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy_mkdocs.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index db96b50..deafc7b 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -4,8 +4,6 @@ on: push: tags: - "*" - branches: - - "enhancement/add-docs-infrastructure" workflow_dispatch: jobs: From 1e9c6ea59eb84d2468e8cb5cbc77a38ef9280808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Tue, 10 Feb 2026 14:22:24 +0100 Subject: [PATCH 10/11] :bug: add missing function --- tools/manage.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/manage.sh b/tools/manage.sh index 09a7e63..2ab323e 100755 --- a/tools/manage.sh +++ b/tools/manage.sh @@ -65,6 +65,24 @@ detect_python () { fi } +############################################################################## +# Clean pyc files in specified directory +# Globals: +# None +# Arguments: +# Optional path to clean +# Returns: +# None +############################################################################### +clean_pyc () { + local path + path=$repo_root + echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c" + find "$path" -path ./build -o -regex '^.*\(__pycache__\|\.py[co]\)$' -delete + + echo -e "${BIGreen}DONE${RST}" +} + install_uv () { echo -e "${BIGreen}>>>${RST} Installing uv ..." command -v curl >/dev/null 2>&1 || { echo -e "${BIRed}!!!${RST}${BIYellow} Missing ${RST}${BIBlue}curl${BIYellow} command.${RST}"; return 1; } @@ -143,7 +161,7 @@ default_help() { echo -e " ${BWhite}codespell${RST} ${BCyan}Run codespell check for the repository${RST}" echo -e " ${BWhite}build-docs${RST} ${BCyan}Build documentation using mkdocs${RST}" echo -e " ${BWhite}serve-docs${RST} ${BCyan}Serve documentation using mkdocs${RST}" - echo -e " ${BWhite}clear-cache${RST} ${BCyan}Clear Python cache files${RST}" + echo -e " ${BWhite}clear-cache${RST} ${BCyan}Clear Python cache files${RST}" echo -e " ${BWhite}run${RST} ${BCyan}Run a command in the virtual environment${RST}" echo -e " ${BWhite}run-tests${RST} ${BCyan}Run tests in the virtual environment${RST}" echo "" From 3c9e5c329555f7731cb2cf1c1456be8d63094c76 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Mon, 30 Mar 2026 19:54:30 +0200 Subject: [PATCH 11/11] MK Docs: Test CI --- .github/workflows/deploy_mkdocs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index deafc7b..db96b50 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -4,6 +4,8 @@ on: push: tags: - "*" + branches: + - "enhancement/add-docs-infrastructure" workflow_dispatch: jobs: