From 6928c7b02dfd66176b71a7bada53cefd5661d720 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 12 Nov 2026 02:58:51 +0000 Subject: [PATCH] Use zensical for docs invoke tasks --- .github/workflows/release.yaml | 2 +- docs/.gitignore | 1 - docs/docs/api/schema.md | 2 +- docs/mkdocs.zensical.yml | 5 +- docs/requirements.in | 1 + docs/requirements.txt | 92 +++++++++++++++++++++++- src/backend/InvenTree/InvenTree/ready.py | 2 + tasks.py | 36 +++++++--- 8 files changed, 127 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c7dab33edf..a8b153c4ca 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -129,7 +129,7 @@ jobs: pip install --require-hashes --only-binary :all: -r docs/requirements.txt - name: Build documentation run: | - invoke build-docs --mkdocs + invoke build-docs --build - name: Zip build docs run: | cd docs/site diff --git a/docs/.gitignore b/docs/.gitignore index 35d9dc5745..e894e39bb5 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -28,4 +28,3 @@ inventree_tags.yml .vscode/ generated/ -site_zensical/ diff --git a/docs/docs/api/schema.md b/docs/docs/api/schema.md index c8a9bc1a7e..eddf80281b 100644 --- a/docs/docs/api/schema.md +++ b/docs/docs/api/schema.md @@ -7,7 +7,7 @@ The API schema as documented below is generated using the [drf-spectactular](htt ## API Version -This documentation is for API version: `568` +This documentation is for API version: `576` !!! tip "API Schema History" We track API schema changes, and provide a snapshot of each API schema version in the [API schema repository](https://github.com/inventree/schema/). diff --git a/docs/mkdocs.zensical.yml b/docs/mkdocs.zensical.yml index 67c381ab89..815e710539 100644 --- a/docs/mkdocs.zensical.yml +++ b/docs/mkdocs.zensical.yml @@ -1,8 +1,9 @@ # Zensical evaluation config - derived from mkdocs.yml. Build from repo root with: # zensical build -f docs/mkdocs.zensical.yml # Differences: theme.variant classic, include_dir relative to this file, native mermaid, -# macros on_error_fail, separate site_dir. mermaid2 / simple-hooks / git-revision-date / +# macros on_error_fail. The mermaid2, simple-hooks and git-revision-date # plugins are not supported by Zensical (silently ignored). +# Post-build checks (hooks.on_post_build) are run separately by "invoke build-docs". # Project site_url: https://inventree.readthedocs.io @@ -413,4 +414,4 @@ extra: use_directory_urls: true strict: true -site_dir: site_zensical +site_dir: site diff --git a/docs/requirements.in b/docs/requirements.in index 98f622aea4..86da02c977 100644 --- a/docs/requirements.in +++ b/docs/requirements.in @@ -8,3 +8,4 @@ mkdocs-simple-hooks mkdocs-include-markdown-plugin mkdocstrings[python] mkdocs-mermaid2-plugin +zensical diff --git a/docs/requirements.txt b/docs/requirements.txt index fe8c0efef6..2a23d2ccae 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -212,6 +212,7 @@ click==8.5.0 \ # via # mkdocs # properdocs + # zensical colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 @@ -260,6 +261,7 @@ jinja2==3.1.6 \ # mkdocs-material # mkdocstrings # properdocs + # zensical jsbeautifier==2.0.3 \ --hash=sha256:9579d4e9dbaa00383f3efdff4c98c8140bb85ba319398e8b97cdaba27abd6ba3 \ --hash=sha256:f0190e279a2cdb827556ada63f41c9c63c11f8116ee06e264b24aa50311cbee3 @@ -275,6 +277,7 @@ markdown==3.11.2 \ # mkdocstrings # properdocs # pymdown-extensions + # zensical markupsafe==3.0.4 \ --hash=sha256:007e1ffd9bf65bb6ee96df7b258fc632a4868dd5566037986c64781f35a36e98 \ --hash=sha256:02fa4acbc6a3fc5c693c34d4dd8c1130b7fe99cc915181b0ddd6f72aeb296002 \ @@ -526,6 +529,7 @@ pathspec==1.1.1 \ # mkdocs # mkdocs-macros-plugin # properdocs + # zensical platformdirs==4.14.5 \ --hash=sha256:32e9921db7385aa8169bee4fe9501923e5715ba9fb7ea3b9c69b0d8e0639f7a1 \ --hash=sha256:8e778c6fa421516f4d3369449f8df3b0e1b72c0e0005fe88e3ec772d0a14e750 @@ -542,7 +546,9 @@ properdocs==1.6.7 \ pygments==2.21.0 \ --hash=sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9 \ --hash=sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c - # via mkdocs-material + # via + # mkdocs-material + # zensical pymdown-extensions==12.3 \ --hash=sha256:345493a8e3497e24382902903a1c43a28e34a52f2b7571a1c9641429b820ca74 \ --hash=sha256:a7f2a4e0bc60c6e6babfa7922cfb3b01cd640eb00fb208f3c582e12bae00ea67 @@ -550,6 +556,7 @@ pymdown-extensions==12.3 \ # mkdocs-material # mkdocs-mermaid2-plugin # mkdocstrings + # zensical python-dateutil==2.9.0.post0 \ --hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \ --hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427 @@ -639,6 +646,7 @@ pyyaml==6.0.3 \ # properdocs # pymdown-extensions # pyyaml-env-tag + # zensical pyyaml-env-tag==1.1 \ --hash=sha256:17109e1a528561e32f026364712fee1264bc2ea6715120891174ed1b980d2e04 \ --hash=sha256:2eb38b75a2d21ee0475d6d97ec19c63287a7e140231e4214969d0eac923cd7ff @@ -681,6 +689,73 @@ termcolor==3.3.0 \ --hash=sha256:348871ca648ec6a9a983a13ab626c0acce02f515b9e1983332b17af7979521c5 \ --hash=sha256:cf642efadaf0a8ebbbf4bc7a31cec2f9b5f21a9f726f4ccbb08192c9c26f43a5 # via mkdocs-macros-plugin +tomli==2.5.0 \ + --hash=sha256:069435bd5480429b98c5e5afb02ab21c219b6f0064680671c6dc0d46817346ea \ + --hash=sha256:0dc598040da8d42cf20f0be588ed7004f46db12a0ac6c32e03a59dccedaaadcd \ + --hash=sha256:1245a6638fc4bb0a60af38a7d45413db34a13842027c77597c712c998c62fdf0 \ + --hash=sha256:19b0dd8749f4ea2f112c5fcfb3c5248390c899d7e2e173f1d91abee1fa0ff391 \ + --hash=sha256:1f4a40d03fb9f63424f0979855bdeaf44dd7696b8d59501822c10ed30ba532df \ + --hash=sha256:20aa36de8f2cf87237143bc1fa1aae8d6612c09118f4da21c6a684db5dd1f6f9 \ + --hash=sha256:21e4cae4114aba25aa0d4f85cdf486d290fb35c0954d7bba536248da64d43066 \ + --hash=sha256:22185fad8a1e622f064e78008018a0dd3323550dcb479cb7a1d296888d74024f \ + --hash=sha256:2419c2a189551987b59d80e63ec355671283336f41c6b9b89462df679c7d0c57 \ + --hash=sha256:264507556cd8b8c8e7c6ee037cdf443a463f03f4c958e57195e3d369711b8ff6 \ + --hash=sha256:32a7b79ac57a2e83670ce329ccf675798bc5a2094783a63676866b70503f2e2b \ + --hash=sha256:3f89d10c1ff6a38d992c27fc8a4816af71a909e08a40ec66934240b1e74347c3 \ + --hash=sha256:463b16086865b97facd8d0b3fb4cb7c544e3f58d2a69dc3113d6db9653fdb043 \ + --hash=sha256:49096930c8d886c9bbdab62d2d0d17ce823ddeea522309a190b36245d5b49e01 \ + --hash=sha256:521345fd1f19d45b8df87657aaa38b6f2ca3800059fadf428e7ebf479a383646 \ + --hash=sha256:57b1c3b01fab802e2899bc3d168dca320e14165e2fd9fd584760fb4ca5826859 \ + --hash=sha256:5d8bac3d603c97e6854424e5b2b5b741bdbde387e09f162fb0446812b4a8362b \ + --hash=sha256:610b27d99f28ec5f191c7064a48f3ddb179a1fe6ca73d571483ae859f57b605e \ + --hash=sha256:61ea1ebe1e55a34ea8199cc8dbff398d35027b82271c8ac4802fd3a1fd5b1bcc \ + --hash=sha256:62fc1bc8eb03e3a9cadfca713d65614ed8e09d974a283295ffe3a831976b4dc5 \ + --hash=sha256:6664b7ae7af7294256c53960a6103077f4914cec8ff98479c352f622c6f6b2f0 \ + --hash=sha256:667e521b37a6c5ccaa044202c235b530f90177ffe2cd4a64ecc213c7dd535feb \ + --hash=sha256:69491c143d2fe063046e0301e62a810bed338fa4d1ce0fd870c27dc1e09b0d84 \ + --hash=sha256:6cf74416bdc94ae458b14e37286c1073081850ac8459a00d0c5efef5d44294c6 \ + --hash=sha256:6e95c7614e705bfe2b04b27aa124adec59752d15813df37e2156747cab3a006b \ + --hash=sha256:6f041843c4d3a37245c0c056fd955b186bf8b1fb85690cbe40b81230891dc34b \ + --hash=sha256:752e8b1aa6a4367ef8bf6a1a1e005540f7ed055ba36d7193796812ca5404eb52 \ + --hash=sha256:75dbcde8751b0a960aa3de173aa5e894d590755c6d7758b7e774c06f1dc3cbdd \ + --hash=sha256:7ac2027d37c3afbdf4bdd377f2676f6f1d2122a5be1f1137b49dced590b37e75 \ + --hash=sha256:7ad1ea345759240d6463efa0ed1c704402752e49aa21476620738d74d72d8aa1 \ + --hash=sha256:86665cee9c4835b7a7f1e8ec2c719b5258d4dc782887aded5a8ae7352a96843b \ + --hash=sha256:8ff3a2ca028c7eee0c777f9a092038d0a594a9fa04e215f929a22c329e2cb142 \ + --hash=sha256:91294a9fb94a75542f6e46e4a2ae709bd8d9b51134098cae5cf3bea5478b6d03 \ + --hash=sha256:943276cf269e0071948d9ff697159c1735e623c1151d88abb09b74659ef0cbea \ + --hash=sha256:96243987194634bd411066ce40c952e108f86af04db533ecd8ac3ff2a85b1885 \ + --hash=sha256:984012f71908165449a951de2050d52f276bfe3aa5d5f570f63ddad814370374 \ + --hash=sha256:9b03d7dc168353b4132965bde20feceabaa470e570c6f59660dfae59b1f9eeb3 \ + --hash=sha256:9dbb18c1cfb2f6517942fc9314437f66aa06d94436ffb1f06102ef3572f35276 \ + --hash=sha256:9ebf8d19b17bd0daeb7b7dec81a946a439b753942fd0210d6e96c532249eea6b \ + --hash=sha256:a525685c2f97da40762b8695eb7aa0af4c8344ca1905c73e4e29cb04d34607dc \ + --hash=sha256:abdbf6313b8d9efe157edeb7ab6eae4de064b1300ad31abf73755154b30abe68 \ + --hash=sha256:b69564772b5c8f22ea5f498dff08cfa825045b4d4c4400529000bdf818aa3b2a \ + --hash=sha256:b8ade5023067f99fe72b88accd30d0ea05a158e9e32a11f124e731ea9695313f \ + --hash=sha256:bbaefc84548d754be821bba7c4141c4787dda182f9e77f2f87b71213529efa7b \ + --hash=sha256:bd05de8c1698f8413dd7d869492693a0bf2211543b787ac78cd5e7536af1a6d7 \ + --hash=sha256:bf0b5e8e0f68ebb494356e577c06c139161efd8d3b9050f93b39b7c26cc54ff0 \ + --hash=sha256:c414be4ed9d3cac80c42e348fa5a956117d1a48227f48026e31f59cb4a7671eb \ + --hash=sha256:c47300f9bf791808f77d82747691c4bb09cb14bdf3060cca99b42cdc4361d5a7 \ + --hash=sha256:c4dc1c1781f2f716de763d1e9a7b34c6a894e167e291c7c5d16c72f7a9538545 \ + --hash=sha256:c804ae44fe7b4bab5da295e4f980a1ff04670bca9d23fe0a4e887e08ebd741a8 \ + --hash=sha256:cfac177ebd6236003846ea339981f71457cb6eb748f23381eb257e45092e3980 \ + --hash=sha256:d2ba24db8a9376921b5e87b4762b9adb0f3f1deaea68f2b8b0bb2c11efb9c3e7 \ + --hash=sha256:d3182ee2d887e507bd67319a0a61105d1dd33facc111329559a233b772c1a105 \ + --hash=sha256:d747252933c8a65ef6bd8da0fbb7ce28a90eb6119d8cd00772cd528aa07b68d5 \ + --hash=sha256:d7e369fd63331746182360977b1892bfc215476a30d61612d732425311639f56 \ + --hash=sha256:e12bbcd32897272fb05929110362ae9ff4c1b9bb26bd9e971e71dcd3275b4c3d \ + --hash=sha256:e7ad033e27a516a233bea839cdb77b80146facb3b4f40bf02cd0cac165cdd5c2 \ + --hash=sha256:e9e15b4a6c7dd6b85b5fbab29488a73f1f70de516942308daa266bf0e0aeb0d4 \ + --hash=sha256:ed53f7e89bb04f6d9e8e7799112360b0c4d5cbff067de0814c98c37c39b920f7 \ + --hash=sha256:eff8babca5a7999bc137acbc7482a8b7e17ffca5075ab41f5d770ab408c7bfef \ + --hash=sha256:f15e3e0b835a6d68b10c86bf80a3149780498d6911c93c3ffd1861d19f9200f1 \ + --hash=sha256:f3fcbc57b1791fa6cbe5d8434179d51de12be1a4811469529f47f6e7487a2571 \ + --hash=sha256:f4b653094e18f9031102d3a1da5c729c8f222d85225b18037dac621695e46e1a \ + --hash=sha256:f79203b3965b4000e91808aaa7c040206093f2b8bf86f455982f2274c9ccf442 \ + --hash=sha256:fd4dc129784e0c5335bd4e61dfcc4487499a013419e655cf2da1d091b7e0efdc + # via zensical typing-extensions==4.16.0 \ --hash=sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8 \ --hash=sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5 @@ -741,3 +816,18 @@ wcmatch==11.2 \ --hash=sha256:1605bde546fbde4c063628c7d89eda486909fd4337e51d73a873987fbcb2554c \ --hash=sha256:952bab83c75c233836007a69550a3a8753cf06964c1eb3b84ff11ad5bff1c272 # via mkdocs-include-markdown-plugin +zensical==0.1.1 \ + --hash=sha256:0405d2891dca76a6fb42fae8141dba93a95f31905148940a9f13883bf1ccfe43 \ + --hash=sha256:1316ba8c5e18b9e46823b0a10105585a582a6e85d2df764b3b65f3de4d1a711f \ + --hash=sha256:267a8f038ca2c720414c0c5810e29962999fbf799369c06a9530b8c702a28f92 \ + --hash=sha256:332e74e3fe91cd8476369217e28ab5d4692486da32d0177c8bcb93c972f0cc8b \ + --hash=sha256:39f40e800f89ce9253839dcba1a06fdd160ff00ac600ab79ae6f18e6a42ee8f7 \ + --hash=sha256:547d2c5c68db7db1faa4394d99ab81f5e9eed6eefe528eb139ff4ea196b2a4fb \ + --hash=sha256:d5cff293282dd27bd511f7bd33db8088fd450de4c1611db842a411466140f637 \ + --hash=sha256:dd4082e317ac5784c50e21cbe209fd1881a351da6ae4e81cc700d6673d5312f3 \ + --hash=sha256:e11abaf2669c5ee780a145d114e8c3db4cd81cd3fdfc8a4513a324301fefd113 + # via -r docs/requirements.in +zensical-ui==0.0.42 \ + --hash=sha256:db4f532b45d7f8200d08d5fb8e7945c69dd738eed49417008b847572a8e3ac8d \ + --hash=sha256:eb824d9c971debc2031837e8d287adf81f5d9ce06304cfbd33fc88ff833abbf3 + # via zensical diff --git a/src/backend/InvenTree/InvenTree/ready.py b/src/backend/InvenTree/InvenTree/ready.py index 82779167d4..47440d2bdb 100644 --- a/src/backend/InvenTree/InvenTree/ready.py +++ b/src/backend/InvenTree/InvenTree/ready.py @@ -111,6 +111,8 @@ ARGV_COMMANDS: dict[str, tuple[str, ...]] = { 'schema', 'spectactular', # schema adjacent calls + 'export_status_codes', + 'export_roles', 'export_settings_definitions', 'export_tags', 'export_filters', diff --git a/tasks.py b/tasks.py index 750c00d004..ba771b30b6 100644 --- a/tasks.py +++ b/tasks.py @@ -2617,6 +2617,22 @@ def doc_schema(c): run(c, 'python docs/extract_schema.py docs/generated/schema.yml') +# Configuration file for building the documentation with zensical +DOCS_CONFIG = 'docs/mkdocs.zensical.yml' + + +def doc_checks(c): + """Check that all settings and status codes are documented. + + Zensical does not support mkdocs hooks, so the 'on_post_build' hook + is run separately, after the documentation has been built. + """ + run( + c, + 'python -c "import sys; sys.path.insert(0, \'docs/docs\'); import hooks; hooks.on_post_build()"', + ) + + @task( help={ 'address': 'Host and port to run the server on (default: localhost:8080)', @@ -2630,7 +2646,7 @@ def docs_server( compile_schema: bool = False, export_settings: bool = True, ): - """Start a local properdocs server to view the documentation.""" + """Start a local zensical server to view the documentation.""" # Extract settings definitions if export_settings: export_definitions(c, basedir='docs') @@ -2638,23 +2654,27 @@ def docs_server( if compile_schema: doc_schema(c) - run(c, f'properdocs serve -a {address} -f docs/mkdocs.yml') + run(c, f'zensical serve -a {address} -f {DOCS_CONFIG}') @task( - help={'mkdocs': 'Build the documentation using mkdocs at the end (default: False)'} + help={ + 'build': 'Build the documentation using zensical at the end (default: False)', + 'clean': 'Clear the zensical build cache first (default: False)', + } ) -def build_docs(c, mkdocs=False): - """Build the required documents for building the docs. Optionally build the documentation using mkdocs.""" +def build_docs(c, build=False, clean=False): + """Build the required documents for building the docs. Optionally build the documentation using zensical.""" migrate(c) export_definitions(c, basedir='docs') doc_schema(c) - if mkdocs: - run(c, 'properdocs build -f docs/mkdocs.yml') + if build: + run(c, f'zensical build {"--clean " if clean else ""}-f {DOCS_CONFIG}') + doc_checks(c) info('Documentation build complete') else: - info('Documentation build complete, but mkdocs not requested') + info('Documentation build complete, but zensical build not requested') @task