From 469197fbe17934a14e2d369255b2c845ae709724 Mon Sep 17 00:00:00 2001 From: Mark Koch Date: Tue, 1 Oct 2024 15:43:14 +0100 Subject: [PATCH 1/3] docs: Use new Quantinuum docs theme --- .gitmodules | 4 +++ docs/_static/custom.css | 38 ---------------------- docs/_static/nav-config.js | 13 ++++++++ docs/api-docs/conf.py | 19 +++-------- docs/quantinuum-sphinx | 1 + pyproject.toml | 2 +- uv.lock | 65 +++++++++++++++----------------------- 7 files changed, 49 insertions(+), 93 deletions(-) create mode 100644 .gitmodules delete mode 100644 docs/_static/custom.css create mode 100644 docs/_static/nav-config.js create mode 160000 docs/quantinuum-sphinx diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..cce7cbd1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "docs/quantinuum-sphinx"] + path = docs/quantinuum-sphinx + url = https://github.com/CQCL/quantinuum-sphinx.git + branch = dist diff --git a/docs/_static/custom.css b/docs/_static/custom.css deleted file mode 100644 index ce78012b..00000000 --- a/docs/_static/custom.css +++ /dev/null @@ -1,38 +0,0 @@ -.wy-side-nav-search, -.wy-nav-top { - background: #5A46BE; -} - -.wy-grid-for-nav, -.wy-body-for-nav, -.wy-nav-side, -.wy-side-scroll, -.wy-menu, -.wy-menu-vertical { - background-color: #FFFFFF; -} - -.wy-menu-vertical a:hover { - background-color: #d9d9d9; -} - -.btn-link:visited, -.btn-link, -a:visited, -.a.reference.external, -.a.reference.internal, -.wy-menu-vertical a, -.wy-menu-vertical li, -.wy-menu-vertical ul, -.span.pre, -.sig-param, -.std.std-ref, - - -html[data-theme=light] { - --pst-color-inline-code: rgb(199, 37, 78) !important; -} - -.sig-name { - font-size: 1.25rem; -} diff --git a/docs/_static/nav-config.js b/docs/_static/nav-config.js new file mode 100644 index 00000000..d41270ed --- /dev/null +++ b/docs/_static/nav-config.js @@ -0,0 +1,13 @@ +const navConfig = { + "navTextLinks": [ + + ], + "navProductName": 'Guppy', + "navIconLinks": [ + { + "title": 'Github', + "href": "https://github.com/CQCL/guppylang/", + "iconImageURL": "/_static/assets/github.svg", + }, + ], +} diff --git a/docs/api-docs/conf.py b/docs/api-docs/conf.py index 3bacce41..05b93c48 100644 --- a/docs/api-docs/conf.py +++ b/docs/api-docs/conf.py @@ -19,26 +19,15 @@ "sphinx.ext.intersphinx", ] -html_theme = "sphinx_book_theme" - +html_theme = "furo" html_title = "Guppy compiler development docs" +html_theme_options = {} -html_theme_options = { - "repository_url": "https://github.com/CQCL/guppylang", - "use_repository_button": True, - "navigation_with_keys": True, - "logo": { - "image_light": "_static/Quantinuum_logo_black.png", - "image_dark": "_static/Quantinuum_logo_white.png", - }, -} - -html_static_path = ["../_static"] -html_css_files = ["custom.css"] +templates_path = ["_templates", "../quantinuum-sphinx/_templates"] +html_static_path = ["../_static", "../quantinuum-sphinx/_static"] autosummary_generate = True -templates_path = ["_templates"] exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] intersphinx_mapping = { diff --git a/docs/quantinuum-sphinx b/docs/quantinuum-sphinx new file mode 160000 index 00000000..a8ac27e0 --- /dev/null +++ b/docs/quantinuum-sphinx @@ -0,0 +1 @@ +Subproject commit a8ac27e089824099708da2cea9cef262e4df3ad2 diff --git a/pyproject.toml b/pyproject.toml index 716095a2..57ed6ec1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dependencies = [ [project.optional-dependencies] pytket = ["pytket >=1.30.0,<2", "tket2 >=0.3.0,<0.4"] -docs = ["sphinx >=7.2.6,<9", "sphinx-book-theme >=1.1.2,<2"] +docs = ["sphinx >=7.2.6,<9", "furo >=2024.5.6"] execution = ["execute-llvm"] [project.urls] diff --git a/uv.lock b/uv.lock index 845ea84b..b35beb32 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,9 @@ version = 1 requires-python = ">=3.10, <3.13" +resolution-markers = [ + "python_full_version < '3.13'", + "python_full_version >= '3.13'", +] [manifest] members = [ @@ -7,18 +11,6 @@ members = [ "guppylang", ] -[[package]] -name = "accessible-pygments" -version = "0.0.5" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "pygments" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/bc/c1/bbac6a50d02774f91572938964c582fff4270eee73ab822a4aeea4d8b11b/accessible_pygments-0.0.5.tar.gz", hash = "sha256:40918d3e6a2b619ad424cb91e556bd3bd8865443d9f22f1dcdf79e33c8046872", size = 1377899 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/8d/3f/95338030883d8c8b91223b4e21744b04d11b161a3ef117295d8241f50ab4/accessible_pygments-0.0.5-py3-none-any.whl", hash = "sha256:88ae3211e68a1d0b011504b2ffc1691feafce124b845bd072ab6f9f66f34d4b7", size = 1395903 }, -] - [[package]] name = "alabaster" version = "1.0.0" @@ -483,6 +475,21 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cf/58/8acf1b3e91c58313ce5cb67df61001fc9dcd21be4fadb76c1a2d540e09ed/fqdn-1.5.1-py3-none-any.whl", hash = "sha256:3a179af3761e4df6eb2e026ff9e1a3033d3587bf980a0b1b2e1e5d08d7358014", size = 9121 }, ] +[[package]] +name = "furo" +version = "2024.8.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "beautifulsoup4" }, + { name = "pygments" }, + { name = "sphinx" }, + { name = "sphinx-basic-ng" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a0/e2/d351d69a9a9e4badb4a5be062c2d0e87bd9e6c23b5e57337fef14bef34c8/furo-2024.8.6.tar.gz", hash = "sha256:b63e4cee8abfc3136d3bc03a3d45a76a850bada4d6374d24c1716b0e01394a01", size = 1661506 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/27/48/e791a7ed487dbb9729ef32bb5d1af16693d8925f4366befef54119b2e576/furo-2024.8.6-py3-none-any.whl", hash = "sha256:6cd97c58b47813d3619e63e9081169880fbe331f0ca883c871ff1f3f11814f5c", size = 341333 }, +] + [[package]] name = "gitdb" version = "4.0.11" @@ -518,7 +525,7 @@ wheels = [ [[package]] name = "guppylang" -version = "0.10.0" +version = "0.12.1" source = { editable = "." } dependencies = [ { name = "graphviz" }, @@ -530,8 +537,8 @@ dependencies = [ [package.optional-dependencies] docs = [ + { name = "furo" }, { name = "sphinx" }, - { name = "sphinx-book-theme" }, ] execution = [ { name = "execute-llvm" }, @@ -558,13 +565,13 @@ dev = [ [package.metadata] requires-dist = [ { name = "execute-llvm", marker = "extra == 'execution'", editable = "execute_llvm" }, + { name = "furo", marker = "extra == 'docs'", specifier = ">=2024.5.6" }, { name = "graphviz", specifier = ">=0.20.1,<0.21" }, { name = "hugr", specifier = ">=0.8.1,<0.9" }, { name = "networkx", specifier = ">=3.2.1,<4" }, { name = "pydantic", specifier = ">=2.7.0b1,<3" }, { name = "pytket", marker = "extra == 'pytket'", specifier = ">=1.30.0,<2" }, { name = "sphinx", marker = "extra == 'docs'", specifier = ">=7.2.6,<9" }, - { name = "sphinx-book-theme", marker = "extra == 'docs'", specifier = ">=1.1.2,<2" }, { name = "tket2", marker = "extra == 'pytket'", specifier = ">=0.3.0,<0.4" }, { name = "typing-extensions", specifier = ">=4.9.0,<5" }, ] @@ -1426,25 +1433,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/37/2f/efc4877d1a1536ec76ca0114c3e9dee7d0a10a262c53d384d50163f5684c/pydantic_extra_types-2.9.0-py3-none-any.whl", hash = "sha256:f0bb975508572ba7bf3390b7337807588463b7248587e69f43b1ad7c797530d0", size = 30544 }, ] -[[package]] -name = "pydata-sphinx-theme" -version = "0.15.4" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "accessible-pygments" }, - { name = "babel" }, - { name = "beautifulsoup4" }, - { name = "docutils" }, - { name = "packaging" }, - { name = "pygments" }, - { name = "sphinx" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/67/ea/3ab478cccacc2e8ef69892c42c44ae547bae089f356c4b47caf61730958d/pydata_sphinx_theme-0.15.4.tar.gz", hash = "sha256:7762ec0ac59df3acecf49fd2f889e1b4565dbce8b88b2e29ee06fdd90645a06d", size = 2400673 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e7/d3/c622950d87a2ffd1654208733b5bd1c5645930014abed8f4c0d74863988b/pydata_sphinx_theme-0.15.4-py3-none-any.whl", hash = "sha256:2136ad0e9500d0949f96167e63f3e298620040aea8f9c74621959eda5d4cf8e6", size = 4640157 }, -] - [[package]] name = "pygments" version = "2.18.0" @@ -2000,16 +1988,15 @@ wheels = [ ] [[package]] -name = "sphinx-book-theme" -version = "1.1.3" +name = "sphinx-basic-ng" +version = "1.0.0b2" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "pydata-sphinx-theme" }, { name = "sphinx" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/89/69/61dfa3b3851610b5f45960737bd99f8c5b2d70ba73f9ac84a527e0c564ae/sphinx_book_theme-1.1.3.tar.gz", hash = "sha256:1f25483b1846cb3d353a6bc61b3b45b031f4acf845665d7da90e01ae0aef5b4d", size = 434230 } +sdist = { url = "https://files.pythonhosted.org/packages/98/0b/a866924ded68efec7a1759587a4e478aec7559d8165fac8b2ad1c0e774d6/sphinx_basic_ng-1.0.0b2.tar.gz", hash = "sha256:9ec55a47c90c8c002b5960c57492ec3021f5193cb26cebc2dc4ea226848651c9", size = 20736 } wheels = [ - { url = "https://files.pythonhosted.org/packages/2b/80/90574e2e82c955b9c6f6b77f7badb2cf2ef4ef77599e4343cced2d098681/sphinx_book_theme-1.1.3-py3-none-any.whl", hash = "sha256:a554a9a7ac3881979a87a2b10f633aa2a5706e72218a10f71be38b3c9e831ae9", size = 430129 }, + { url = "https://files.pythonhosted.org/packages/3c/dd/018ce05c532a22007ac58d4f45232514cd9d6dd0ee1dc374e309db830983/sphinx_basic_ng-1.0.0b2-py3-none-any.whl", hash = "sha256:eb09aedbabfb650607e9b4b68c9d240b90b1e1be221d6ad71d61c52e29f7932b", size = 22496 }, ] [[package]] From e5e4958778cc19f5062bf5d1dc02f51f5dfc65cb Mon Sep 17 00:00:00 2001 From: Mark Koch Date: Tue, 5 Nov 2024 14:57:15 +0000 Subject: [PATCH 2/3] Swap templates_path with html_static_path --- docs/api-docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-docs/conf.py b/docs/api-docs/conf.py index 05b93c48..ad26d78b 100644 --- a/docs/api-docs/conf.py +++ b/docs/api-docs/conf.py @@ -23,8 +23,8 @@ html_title = "Guppy compiler development docs" html_theme_options = {} -templates_path = ["_templates", "../quantinuum-sphinx/_templates"] html_static_path = ["../_static", "../quantinuum-sphinx/_static"] +templates_path = ["_templates", "../quantinuum-sphinx/_templates"] autosummary_generate = True From 6c3b03e2ff50d556105dc36c60c05f748f56f7aa Mon Sep 17 00:00:00 2001 From: Mark Koch Date: Tue, 5 Nov 2024 15:00:48 +0000 Subject: [PATCH 3/3] Add favicon --- docs/api-docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/api-docs/conf.py b/docs/api-docs/conf.py index ad26d78b..36c2ccb8 100644 --- a/docs/api-docs/conf.py +++ b/docs/api-docs/conf.py @@ -25,6 +25,7 @@ html_static_path = ["../_static", "../quantinuum-sphinx/_static"] templates_path = ["_templates", "../quantinuum-sphinx/_templates"] +html_favicon = "../quantinuum-sphinx/_static/assets/quantinuum_favicon.svg" autosummary_generate = True