diff --git a/docs/.readthedocs.yaml b/docs/.readthedocs.yaml index a1b6ed1..6dee65e 100644 --- a/docs/.readthedocs.yaml +++ b/docs/.readthedocs.yaml @@ -20,4 +20,7 @@ sphinx: # Optionally declare the Python requirements required to build your docs python: install: - - requirements: docs/.sphinx/requirements.txt + - requirements: docs/requirements.txt + - method: pip + path: . + diff --git a/docs/.sphinx/_static/custom.css b/docs/.sphinx/_static/custom.css deleted file mode 100644 index cad94b7..0000000 --- a/docs/.sphinx/_static/custom.css +++ /dev/null @@ -1,189 +0,0 @@ -/** Fix the font weight (300 for normal, 400 for slightly bold) **/ - -div.page, h1, h2, h3, h4, h5, h6, .sidebar-tree .current-page>.reference, button, input, optgroup, select, textarea, th.head { - font-weight: 300 -} - -.toc-tree li.scroll-current>.reference, dl.glossary dt, dl.simple dt, dl:not([class]) dt { - font-weight: 400; -} - -/** Table styling **/ - -th.head { - text-transform: uppercase; - font-size: var(--font-size--small); -} - -table.docutils { - border: 0; - box-shadow: none; - width:100%; -} - -table.docutils td, table.docutils th, table.docutils td:last-child, table.docutils th:last-child, table.docutils td:first-child, table.docutils th:first-child { - border-right: none; - border-left: none; -} - -/* Allow to centre text horizontally in table data cells */ -table.align-center { - text-align: center !important; -} - -/** No rounded corners **/ - -.admonition, code.literal, .sphinx-tabs-tab, .sphinx-tabs-panel, .highlight { - border-radius: 0; -} - -/** Admonition styling **/ - -.admonition { - border-top: 1px solid #d9d9d9; - border-right: 1px solid #d9d9d9; - border-bottom: 1px solid #d9d9d9; -} - -/** Color for the "copy link" symbol next to headings **/ - -a.headerlink { - color: var(--color-brand-primary); -} - -/** Line to the left of the current navigation entry **/ - -.sidebar-tree li.current-page { - border-left: 2px solid var(--color-brand-primary); -} - -/** Some tweaks for issue #16 **/ - -[role="tablist"] { - border-bottom: 1px solid var(--color-sidebar-item-background--hover); -} - -.sphinx-tabs-tab[aria-selected="true"] { - border: 0; - border-bottom: 2px solid var(--color-brand-primary); - background-color: var(--color-sidebar-item-background--current); - font-weight:300; -} - -.sphinx-tabs-tab{ - color: var(--color-brand-primary); - font-weight:300; -} - -.sphinx-tabs-panel { - border: 0; - border-bottom: 1px solid var(--color-sidebar-item-background--hover); - background: var(--color-background-primary); -} - -button.sphinx-tabs-tab:hover { - background-color: var(--color-sidebar-item-background--hover); -} - -/** Custom classes to fix scrolling in tables by decreasing the - font size or breaking certain columns. - Specify the classes in the Markdown file with, for example: - ```{rst-class} break-col-4 min-width-4-8 - ``` -**/ - -table.dec-font-size { - font-size: smaller; -} -table.break-col-1 td.text-left:first-child { - word-break: break-word; -} -table.break-col-4 td.text-left:nth-child(4) { - word-break: break-word; -} -table.min-width-1-15 td.text-left:first-child { - min-width: 15em; -} -table.min-width-4-8 td.text-left:nth-child(4) { - min-width: 8em; -} - -/** Underline for abbreviations **/ - -abbr[title] { - text-decoration: underline solid #cdcdcd; -} - -/** Use the same style for right-details as for left-details **/ -.bottom-of-page .right-details { - font-size: var(--font-size--small); - display: block; -} - -/** Version switcher */ -button.version_select { - color: var(--color-foreground-primary); - background-color: var(--color-toc-background); - padding: 5px 10px; - border: none; -} - -.version_select:hover, .version_select:focus { - background-color: var(--color-sidebar-item-background--hover); -} - -.version_dropdown { - position: relative; - display: inline-block; - text-align: right; - font-size: var(--sidebar-item-font-size); -} - -.available_versions { - display: none; - position: absolute; - right: 0px; - background-color: var(--color-toc-background); - box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); - z-index: 11; -} - -.available_versions a { - color: var(--color-foreground-primary); - padding: 12px 16px; - text-decoration: none; - display: block; -} - -.available_versions a:hover {background-color: var(--color-sidebar-item-background--current)} - -.show {display:block;} - -/** Fix for nested numbered list - the nested list is lettered **/ -ol.arabic ol.arabic { - list-style: lower-alpha; -} - -/** Make expandable sections look like links **/ -details summary { - color: var(--color-link); -} - -/** Fix the styling of the version box for readthedocs **/ - -#furo-readthedocs-versions .rst-versions, #furo-readthedocs-versions .rst-current-version, #furo-readthedocs-versions:focus-within .rst-current-version, #furo-readthedocs-versions:hover .rst-current-version { - background: var(--color-sidebar-item-background--hover); -} - -.rst-versions .rst-other-versions dd a { - color: var(--color-link); -} - -#furo-readthedocs-versions:focus-within .rst-current-version .fa-book, #furo-readthedocs-versions:hover .rst-current-version .fa-book, .rst-versions .rst-other-versions { - color: var(--color-sidebar-link-text); -} - -.rst-versions .rst-current-version { - color: var(--color-version-popup); - font-weight: bolder; -} diff --git a/docs/.sphinx/_static/favicon.png b/docs/.sphinx/_static/favicon.png deleted file mode 100644 index c710990..0000000 Binary files a/docs/.sphinx/_static/favicon.png and /dev/null differ diff --git a/docs/.sphinx/_static/furo_colors.css b/docs/.sphinx/_static/furo_colors.css deleted file mode 100644 index ffc36cb..0000000 --- a/docs/.sphinx/_static/furo_colors.css +++ /dev/null @@ -1,88 +0,0 @@ -body { - --color-code-background: #f8f8f8; - --color-code-foreground: black; - --font-stack: Ubuntu, -apple-system, Segoe UI, Roboto, Oxygen, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - --font-stack--monospace: Ubuntu Mono, Consolas, Monaco, Courier, monospace; - --color-foreground-primary: #111; - --color-foreground-secondary: var(--color-foreground-primary); - --color-foreground-muted: #333; - --color-background-secondary: #FFF; - --color-background-hover: #f2f2f2; - --color-brand-primary: #111; - --color-brand-content: #06C; - --color-api-background: #cdcdcd; - --color-inline-code-background: rgba(0,0,0,.03); - --color-sidebar-link-text: #111; - --color-sidebar-item-background--current: #ebebeb; - --color-sidebar-item-background--hover: #f2f2f2; - --toc-font-size: var(--font-size--small); - --color-admonition-title-background--note: var(--color-background-primary); - --color-admonition-title-background--tip: var(--color-background-primary); - --color-admonition-title-background--important: var(--color-background-primary); - --color-admonition-title-background--caution: var(--color-background-primary); - --color-admonition-title--note: #24598F; - --color-admonition-title--tip: #24598F; - --color-admonition-title--important: #C7162B; - --color-admonition-title--caution: #F99B11; - --color-highlighted-background: #EbEbEb; - --color-link-underline: var(--color-background-primary); - --color-link-underline--hover: var(--color-background-primary); - --color-version-popup: #772953; -} - -@media not print { - body[data-theme="dark"] { - --color-code-background: #202020; - --color-code-foreground: #d0d0d0; - --color-foreground-secondary: var(--color-foreground-primary); - --color-foreground-muted: #CDCDCD; - --color-background-secondary: var(--color-background-primary); - --color-background-hover: #666; - --color-brand-primary: #fff; - --color-brand-content: #06C; - --color-sidebar-link-text: #f7f7f7; - --color-sidebar-item-background--current: #666; - --color-sidebar-item-background--hover: #333; - --color-admonition-background: transparent; - --color-admonition-title-background--note: var(--color-background-primary); - --color-admonition-title-background--tip: var(--color-background-primary); - --color-admonition-title-background--important: var(--color-background-primary); - --color-admonition-title-background--caution: var(--color-background-primary); - --color-admonition-title--note: #24598F; - --color-admonition-title--tip: #24598F; - --color-admonition-title--important: #C7162B; - --color-admonition-title--caution: #F99B11; - --color-highlighted-background: #666; - --color-link-underline: var(--color-background-primary); - --color-link-underline--hover: var(--color-background-primary); - --color-version-popup: #F29879; - } - @media (prefers-color-scheme: dark) { - body:not([data-theme="light"]) { - --color-code-background: #202020; - --color-code-foreground: #d0d0d0; - --color-foreground-secondary: var(--color-foreground-primary); - --color-foreground-muted: #CDCDCD; - --color-background-secondary: var(--color-background-primary); - --color-background-hover: #666; - --color-brand-primary: #fff; - --color-brand-content: #06C; - --color-sidebar-link-text: #f7f7f7; - --color-sidebar-item-background--current: #666; - --color-sidebar-item-background--hover: #333; - --color-admonition-background: transparent; - --color-admonition-title-background--note: var(--color-background-primary); - --color-admonition-title-background--tip: var(--color-background-primary); - --color-admonition-title-background--important: var(--color-background-primary); - --color-admonition-title-background--caution: var(--color-background-primary); - --color-admonition-title--note: #24598F; - --color-admonition-title--tip: #24598F; - --color-admonition-title--important: #C7162B; - --color-admonition-title--caution: #F99B11; - --color-highlighted-background: #666; - --color-link-underline: var(--color-background-primary); - --color-link-underline--hover: var(--color-background-primary); - --color-version-popup: #F29879; - } - } -} diff --git a/docs/.sphinx/_static/github_issue_links.css b/docs/.sphinx/_static/github_issue_links.css deleted file mode 100644 index af4be86..0000000 --- a/docs/.sphinx/_static/github_issue_links.css +++ /dev/null @@ -1,24 +0,0 @@ -.github-issue-link-container { - padding-right: 0.5rem; -} -.github-issue-link { - font-size: var(--font-size--small); - font-weight: bold; - background-color: #DD4814; - padding: 13px 23px; - text-decoration: none; -} -.github-issue-link:link { - color: #FFFFFF; -} -.github-issue-link:visited { - color: #FFFFFF -} -.muted-link.github-issue-link:hover { - color: #FFFFFF; - text-decoration: underline; -} -.github-issue-link:active { - color: #FFFFFF; - text-decoration: underline; -} diff --git a/docs/.sphinx/_static/github_issue_links.js b/docs/.sphinx/_static/github_issue_links.js deleted file mode 100644 index f070603..0000000 --- a/docs/.sphinx/_static/github_issue_links.js +++ /dev/null @@ -1,34 +0,0 @@ -// if we already have an onload function, save that one -var prev_handler = window.onload; - -window.onload = function() { - // call the previous onload function - if (prev_handler) { - prev_handler(); - } - - const link = document.createElement("a"); - link.classList.add("muted-link"); - link.classList.add("github-issue-link"); - link.text = "Give feedback"; - link.href = ( - github_url - + "/issues/new?" - + "title=docs%3A+TYPE+YOUR+QUESTION+HERE" - + "&body=*Please describe the question or issue you're facing with " - + `"${document.title}"` - + ".*" - + "%0A%0A%0A%0A%0A" - + "---" - + "%0A" - + `*Reported+from%3A+${location.href}*` - ); - link.target = "_blank"; - - const div = document.createElement("div"); - div.classList.add("github-issue-link-container"); - div.append(link) - - const container = document.querySelector(".article-container > .content-icon-container"); - container.prepend(div); -}; diff --git a/docs/.sphinx/_static/header-nav.js b/docs/.sphinx/_static/header-nav.js deleted file mode 100644 index 3608576..0000000 --- a/docs/.sphinx/_static/header-nav.js +++ /dev/null @@ -1,10 +0,0 @@ -$(document).ready(function() { - $(document).on("click", function () { - $(".more-links-dropdown").hide(); - }); - - $('.nav-more-links').click(function(event) { - $('.more-links-dropdown').toggle(); - event.stopPropagation(); - }); -}) diff --git a/docs/.sphinx/_static/header.css b/docs/.sphinx/_static/header.css deleted file mode 100644 index 0b94409..0000000 --- a/docs/.sphinx/_static/header.css +++ /dev/null @@ -1,167 +0,0 @@ -.p-navigation { - border-bottom: 1px solid var(--color-sidebar-background-border); -} - -.p-navigation__nav { - background: #333333; - display: flex; -} - -.p-logo { - display: flex !important; - padding-top: 0 !important; - text-decoration: none; -} - -.p-logo-image { - height: 44px; - padding-right: 10px; -} - -.p-logo-text { - margin-top: 18px; - color: white; - text-decoration: none; -} - -ul.p-navigation__links { - display: flex; - list-style: none; - margin-left: 0; - margin-top: auto; - margin-bottom: auto; - max-width: 800px; - width: 100%; -} - -ul.p-navigation__links li { - margin: 0 auto; - text-align: center; - width: 100%; -} - -ul.p-navigation__links li a { - background-color: rgba(0, 0, 0, 0); - border: none; - border-radius: 0; - color: var(--color-sidebar-link-text); - display: block; - font-weight: 400; - line-height: 1.5rem; - margin: 0; - overflow: hidden; - padding: 1rem 0; - position: relative; - text-align: left; - text-overflow: ellipsis; - transition-duration: .1s; - transition-property: background-color, color, opacity; - transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - white-space: nowrap; - width: 100%; -} - -ul.p-navigation__links .p-navigation__link { - color: #ffffff; - font-weight: 300; - text-align: center; - text-decoration: none; -} - -ul.p-navigation__links .p-navigation__link:hover { - background-color: #2b2b2b; -} - -ul.p-navigation__links .p-dropdown__link:hover { - background-color: var(--color-sidebar-item-background--hover); -} - -ul.p-navigation__links .p-navigation__sub-link { - background: var(--color-background-primary); - padding: .5rem 0 .5rem .5rem; - font-weight: 300; -} - -ul.p-navigation__links .more-links-dropdown li a { - border-left: 1px solid var(--color-sidebar-background-border); - border-right: 1px solid var(--color-sidebar-background-border); -} - -ul.p-navigation__links .more-links-dropdown li:first-child a { - border-top: 1px solid var(--color-sidebar-background-border); -} - -ul.p-navigation__links .more-links-dropdown li:last-child a { - border-bottom: 1px solid var(--color-sidebar-background-border); -} - -ul.p-navigation__links .p-navigation__logo { - padding: 0.5rem; -} - -ul.p-navigation__links .p-navigation__logo img { - width: 40px; -} - -ul.more-links-dropdown { - display: none; - overflow-x: visible; - height: 0; - z-index: 55; - padding: 0; - position: relative; - list-style: none; - margin-bottom: 0; - margin-top: 0; -} - -.nav-more-links::after { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath fill='%23111' d='M8.187 11.748l6.187-6.187-1.06-1.061-5.127 5.127L3.061 4.5 2 5.561z'/%3E%3C/svg%3E"); - background-position: center; - background-repeat: no-repeat; - background-size: contain; - content: ""; - display: block; - filter: invert(100%); - height: 1rem; - pointer-events: none; - position: absolute; - right: 1rem; - text-indent: calc(100% + 10rem); - top: calc(1rem + 0.25rem); - width: 1rem; -} - -.nav-ubuntu-com { - display: none; -} - -@media only screen and (min-width: 480px) { - ul.p-navigation__links li { - width: 100%; - } - - .nav-ubuntu-com { - display: inherit; - } -} - -@media only screen and (max-width: 800px) { - .nav-more-links { - margin-left: auto !important; - padding-right: 2rem !important; - width: 8rem !important; - } -} - -@media only screen and (min-width: 800px) { - ul.p-navigation__links li { - width: 100% !important; - } -} - -@media only screen and (min-width: 1310px) { - ul.p-navigation__links { - margin-left: calc(50% - 41em); - } -} diff --git a/docs/.sphinx/_static/tag.png b/docs/.sphinx/_static/tag.png deleted file mode 100644 index f6f6e5a..0000000 Binary files a/docs/.sphinx/_static/tag.png and /dev/null differ diff --git a/docs/.sphinx/_templates/base.html b/docs/.sphinx/_templates/base.html deleted file mode 100644 index 3308154..0000000 --- a/docs/.sphinx/_templates/base.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "furo/base.html" %} - -{% block theme_scripts %} - -{% endblock theme_scripts %} - -{# ru-fu: don't include the color variables from the conf.py file, but use a - separate CSS file to save space #} -{% block theme_styles %} -{% endblock theme_styles %} diff --git a/docs/.sphinx/_templates/footer.html b/docs/.sphinx/_templates/footer.html deleted file mode 100644 index f13cb63..0000000 --- a/docs/.sphinx/_templates/footer.html +++ /dev/null @@ -1,99 +0,0 @@ -{# ru-fu: copied from Furo, with modifications as stated below. Modifications are marked 'mod:'. #} - - -
-
- {%- if show_copyright %} - - {%- endif %} - - {# mod: removed "Made with" #} - - {%- if last_updated -%} -
- {% trans last_updated=last_updated|e -%} - Last updated on {{ last_updated }} - {%- endtrans -%} -
- {%- endif %} - - {%- if show_source and has_source and sourcename %} - - {%- endif %} -
-
- - {# mod: replaced RTD icons with our links #} - - {% if discourse %} - - {% endif %} - - {% if github_url and github_version and github_folder %} - - {% if github_issues %} - - {% endif %} - - - {% endif %} - - -
-
- diff --git a/docs/.sphinx/_templates/header.html b/docs/.sphinx/_templates/header.html deleted file mode 100644 index 1a128b6..0000000 --- a/docs/.sphinx/_templates/header.html +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/docs/.sphinx/_templates/page.html b/docs/.sphinx/_templates/page.html deleted file mode 100644 index bda3061..0000000 --- a/docs/.sphinx/_templates/page.html +++ /dev/null @@ -1,49 +0,0 @@ -{% extends "furo/page.html" %} - -{% block footer %} - {% include "footer.html" %} -{% endblock footer %} - -{% block body -%} - {% include "header.html" %} - {{ super() }} -{%- endblock body %} - -{% if meta and ((meta.discourse and discourse_prefix) or meta.relatedlinks) %} - {% set furo_hide_toc_orig = furo_hide_toc %} - {% set furo_hide_toc=false %} -{% endif %} - -{% block right_sidebar %} -
- {% if not furo_hide_toc_orig %} -
- - {{ _("Contents") }} - -
-
-
- {{ toc }} -
-
- {% endif %} - {% if meta and ((meta.discourse and discourse_prefix) or meta.relatedlinks) %} - - - {% endif %} -
-{% endblock right_sidebar %} diff --git a/docs/_static/.gitempty b/docs/_static/.gitempty deleted file mode 100644 index e69de29..0000000 diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css deleted file mode 100644 index ef7e97f..0000000 --- a/docs/_static/css/custom.css +++ /dev/null @@ -1,28 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital@0;1&display=swap'); - -body { - font-family: Ubuntu, "times new roman", times, roman, serif; -} - -div .toctree-wrapper { - column-count: 2; -} - -div .toctree-wrapper>ul { - margin: 0; -} - -ul .toctree-l1 { - margin: 0; - -webkit-column-break-inside: avoid; - page-break-inside: avoid; - break-inside: avoid-column; -} - -.wy-nav-content { - max-width: none; -} - -.log-snippets { - color: rgb(141, 141, 141); -} diff --git a/docs/conf.py b/docs/conf.py index 3292d81..d0d5e4c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,139 +1,213 @@ +import os import sys -sys.path.append('./') -from custom_conf import * +import datetime -# Configuration file for the Sphinx documentation builder. -# You should not do any modifications to this file. Put your custom -# configuration into the custom_conf.py file. -# If you need to change this file, contribute the changes upstream. +# Custom configuration for the Sphinx documentation builder. +# All configuration specific to your project should be done in this file. +# +# The file is included in the common conf.py configuration file. +# You can modify any of the settings below or add any configuration that +# is not covered by the common conf.py file. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +# +# If you're not familiar with Sphinx and don't want to use advanced +# features, it is sufficient to update the settings in the "Project +# information" section. ############################################################ -### Extensions +### Project information ############################################################ -extensions = [ - 'sphinx_design', - 'sphinx_tabs.tabs', - 'sphinx_reredirects', - 'youtube-links', - 'related-links', - 'custom-rst-roles', - 'terminal-output', - 'sphinx_copybutton', - 'sphinxext.opengraph', - 'myst_parser', - 'sphinxcontrib.jquery', - 'notfound.extension' -] -extensions.extend(custom_extensions) +# Product name +project = "Craft CLI" +author = "Canonical Group Ltd" -### Configuration for extensions +# The title you want to display for the documentation in the sidebar. +# You might want to include a version number here. +# To not display any title, set this option to an empty string. +html_title = project + " documentation" -# Additional MyST syntax -myst_enable_extensions = [ - 'substitution', - 'deflist', - 'linkify' -] -myst_enable_extensions.extend(custom_myst_extensions) +# The default value uses the current year as the copyright year. +# +# For static works, it is common to provide the year of first publication. +# Another option is to give the first year and the current year +# for documentation that is often changed, e.g. 2022–2023 (note the en-dash). +# +# A way to check a GitHub repo's creation date is to obtain a classic GitHub +# token with 'repo' permissions here: https://github.com/settings/tokens +# Next, use 'curl' and 'jq' to extract the date from the GitHub API's output: +# +# curl -H 'Authorization: token ' \ +# -H 'Accept: application/vnd.github.v3.raw' \ +# https://api.github.com/repos/canonical/ | jq '.created_at' + +copyright = "%s, %s" % (datetime.date.today().year, author) + +## Open Graph configuration - defines what is displayed as a link preview +## when linking to the documentation from another website (see https://ogp.me/) +# The URL where the documentation will be hosted (leave empty if you +# don't know yet) +ogp_site_url = "https://canonical-craft-cli.readthedocs-hosted.com/" +# The documentation website name (usually the same as the product name) +ogp_site_name = project +# The URL of an image or logo that is used in the preview +ogp_image = "https://assets.ubuntu.com/v1/253da317-image-document-ubuntudocs.svg" + +# (Some settings must be part of the html_context dictionary, while others +# are on root level. Don't move the settings.) +html_context = { + # Change to the link to the website of your product (without "https://") + # For example: "ubuntu.com/lxd" or "microcloud.is" + # If there is no product website, edit the header template to remove the + # link (see the readme for instructions). + "product_page": "github.com/canonical/craft-cli", + # Add your product tag (the orange part of your logo, will be used in the + # header) to ".sphinx/_static" and change the path here (start with "_static") + # (default is the circle of friends) + "product_tag": "_static/tag.png", + # Change to the discourse instance you want to be able to link to + # using the :discourse: metadata at the top of a file + # (use an empty value if you don't want to link) + "discourse": "https://discourse.ubuntu.com", + # Change to the GitHub URL for your project + "github_url": "https://github.com/canonical/craft-cli", + # Change to the branch for this version of the documentation + "github_version": "main", + # Change to the folder that contains the documentation + # (usually "/" or "/docs/") + "github_folder": "/docs/", + # Change to an empty value if your GitHub repo doesn't have issues enabled. + # This will disable the feedback button and the issue link in the footer. + "github_issues": "enabled", + # Controls the existence of Previous / Next buttons at the bottom of pages + # Valid options: none, prev, next, both + "sequential_nav": "none", +} -# Used for related links -if not 'discourse_prefix' in html_context and 'discourse' in html_context: - html_context['discourse_prefix'] = html_context['discourse'] + '/t/' +# If your project is on documentation.ubuntu.com, specify the project +# slug (for example, "lxd") here. +slug = "craft_cli" -# The default for notfound_urls_prefix usually works, but not for -# documentation on documentation.ubuntu.com -if slug: - notfound_urls_prefix = '/' + slug + '/en/latest/' +############################################################ +### Redirects +############################################################ -notfound_context = { - 'title': 'Page not found', - 'body': '

Page not found

\n\n

Sorry, but the documentation page that you are looking for was not found.

\n

Documentation changes over time, and pages are moved around. We try to redirect you to the updated content where possible, but unfortunately, that didn\'t work this time (maybe because the content you were looking for does not exist in this version of the documentation).

\n

You can try to use the navigation to locate the content you\'re looking for, or search for a similar page.

\n', -} +# Set up redirects (https://documatt.gitlab.io/sphinx-reredirects/usage.html) +# For example: 'explanation/old-name.html': '../how-to/prettify.html', + +redirects = {} + +############################################################ +### Link checker exceptions +############################################################ + +# Links to ignore when checking links + +linkcheck_ignore = ["http://127.0.0.1:8000"] -# Default image for OGP (to prevent font errors, see -# https://github.com/canonical/sphinx-docs-starter-pack/pull/54 ) -if not 'ogp_image' in locals(): - ogp_image = 'https://assets.ubuntu.com/v1/253da317-image-document-ubuntudocs.svg' +# Pages on which to ignore anchors +# (This list will be appended to linkcheck_anchors_ignore_for_url) + +custom_linkcheck_anchors_ignore_for_url = [] ############################################################ -### General configuration +### Additions to default configuration ############################################################ +## The following settings are appended to the default configuration. +## Use them to extend the default functionality. + +# Add extensions +extensions = [ + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", + "sphinx.ext.coverage", + "sphinx.ext.doctest", + "sphinx_design", + "sphinx_copybutton", + "sphinx-pydantic", + "sphinx.ext.autodoc", + "sphinx_toolbox", + "sphinx_starter_pack", +] + +# Add MyST extensions +myst_extensions = [] + +# Add files or directories that should be excluded from processing. exclude_patterns = [ - '_build', - 'Thumbs.db', - '.DS_Store', - '.sphinx', + "doc-cheat-sheet*", ] -exclude_patterns.extend(custom_excludes) -rst_epilog = ''' -.. include:: /reuse/links.txt -''' -if 'custom_rst_epilog' in locals(): - rst_epilog = custom_rst_epilog +# Add CSS files (located in .sphinx/_static/) +html_css_files = [] -source_suffix = { - '.rst': 'restructuredtext', - '.md': 'markdown', -} +# Add JavaScript files (located in .sphinx/_static/) +html_js_files = [] -if not 'conf_py_path' in html_context and 'github_folder' in html_context: - html_context['conf_py_path'] = html_context['github_folder'] +## The following settings override the default configuration. -# For ignoring specific links -linkcheck_anchors_ignore_for_url = [ - r'https://github\.com/.*' -] -linkcheck_anchors_ignore_for_url.extend(custom_linkcheck_anchors_ignore_for_url) +# Specify a reST string that is included at the end of each file. +# If commented out, use the default (which pulls the reuse/links.txt +# file into each reST file). +# custom_rst_epilog = '' + +# By default, the documentation includes a feedback button at the top. +# You can disable it by setting the following configuration to True. +disable_feedback_button = False -# Tags cannot be added directly in custom_conf.py, so add them here -for tag in custom_tags: - tags.add(tag) +# Add tags that you want to use for conditional inclusion of text +# (https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#tags) +tags = [] ############################################################ -### Styling +### Additional configuration ############################################################ -# Find the current builder -builder = 'dirhtml' -if '-b' in sys.argv: - builder = sys.argv[sys.argv.index('-b')+1] +## Add any configuration that is not covered by the common conf.py file. -# Setting templates_path for epub makes the build fail -if builder == 'dirhtml' or builder == 'html': - templates_path = ['.sphinx/_templates'] +linkcheck_ignore += [r"craft_cli.dispatcher.html#craft_cli.dispatcher.CommandGroup"] -# Theme configuration -html_theme = 'furo' -html_last_updated_fmt = '' -html_permalinks_icon = '¶' +# Type hints configuration +set_type_checking_flag = True +typehints_fully_qualified = False +always_document_param_types = True +typehints_document_rtype = True -if html_title == '': - html_theme_options = { - 'sidebar_hide_name': True - } +# Github config +github_username = "canonical" +github_repository = "craft-cli" +# endregion -############################################################ -### Additional files -############################################################ +# Document class properties before public methods +autodoc_member_order = "bysource" -html_static_path = ['.sphinx/_static'] -html_css_files = [ - 'custom.css', - 'header.css', - 'github_issue_links.css', - 'furo_colors.css' -] -html_css_files.extend(custom_html_css_files) +# region Setup reference generation +def run_apidoc(_): + from sphinx.ext.apidoc import main + import os + import sys + + sys.path.append(os.path.join(os.path.dirname(__file__), "..")) + cur_dir = os.path.abspath(os.path.dirname(__file__)) + module = os.path.join(cur_dir, "..", "craft_cli") + exclude_patterns = ["*pytest_plugin*"] + main(["-e", "--no-toc", "--force", "-o", cur_dir, module, *exclude_patterns]) + + +def no_namedtuple_attrib_docstring(app, what, name, obj, options, lines): + """Strips out silly "Alias for field number" lines in namedtuples reference.""" + if len(lines) == 1 and lines[0].startswith("Alias for field number"): + del lines[:] + + +def setup(app): + app.connect("builder-inited", run_apidoc) + app.connect("autodoc-process-docstring", no_namedtuple_attrib_docstring) + -html_js_files = ['header-nav.js'] -if 'github_issues' in html_context and html_context['github_issues'] and not disable_feedback_button: - html_js_files.append('github_issue_links.js') -html_js_files.extend(custom_html_js_files) +# endregion diff --git a/docs/custom_conf.py b/docs/custom_conf.py deleted file mode 100644 index c0b144d..0000000 --- a/docs/custom_conf.py +++ /dev/null @@ -1,213 +0,0 @@ -import datetime - -# Custom configuration for the Sphinx documentation builder. -# All configuration specific to your project should be done in this file. -# -# The file is included in the common conf.py configuration file. -# You can modify any of the settings below or add any configuration that -# is not covered by the common conf.py file. -# -# For the full list of built-in configuration values, see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html -# -# If you're not familiar with Sphinx and don't want to use advanced -# features, it is sufficient to update the settings in the "Project -# information" section. - -############################################################ -### Project information -############################################################ - -# Product name -project = "Craft CLI" -author = "Canonical Group Ltd" - -# The title you want to display for the documentation in the sidebar. -# You might want to include a version number here. -# To not display any title, set this option to an empty string. -html_title = project + " documentation" - -# The default value uses the current year as the copyright year. -# -# For static works, it is common to provide the year of first publication. -# Another option is to give the first year and the current year -# for documentation that is often changed, e.g. 2022–2023 (note the en-dash). -# -# A way to check a GitHub repo's creation date is to obtain a classic GitHub -# token with 'repo' permissions here: https://github.com/settings/tokens -# Next, use 'curl' and 'jq' to extract the date from the GitHub API's output: -# -# curl -H 'Authorization: token ' \ -# -H 'Accept: application/vnd.github.v3.raw' \ -# https://api.github.com/repos/canonical/ | jq '.created_at' - -copyright = "%s, %s" % (datetime.date.today().year, author) - -## Open Graph configuration - defines what is displayed as a link preview -## when linking to the documentation from another website (see https://ogp.me/) -# The URL where the documentation will be hosted (leave empty if you -# don't know yet) -ogp_site_url = "https://canonical-craft-cli.readthedocs-hosted.com/" -# The documentation website name (usually the same as the product name) -ogp_site_name = project -# The URL of an image or logo that is used in the preview -ogp_image = "https://assets.ubuntu.com/v1/253da317-image-document-ubuntudocs.svg" - -# Update with the local path to the favicon for your product -# (default is the circle of friends) -html_favicon = ".sphinx/_static/favicon.png" - -# (Some settings must be part of the html_context dictionary, while others -# are on root level. Don't move the settings.) -html_context = { - # Change to the link to the website of your product (without "https://") - # For example: "ubuntu.com/lxd" or "microcloud.is" - # If there is no product website, edit the header template to remove the - # link (see the readme for instructions). - "product_page": "github.com/canonical/craft-cli", - # Add your product tag (the orange part of your logo, will be used in the - # header) to ".sphinx/_static" and change the path here (start with "_static") - # (default is the circle of friends) - "product_tag": "_static/tag.png", - # Change to the discourse instance you want to be able to link to - # using the :discourse: metadata at the top of a file - # (use an empty value if you don't want to link) - "discourse": "https://discourse.ubuntu.com", - # Change to the GitHub URL for your project - "github_url": "https://github.com/canonical/craft-cli", - # Change to the branch for this version of the documentation - "github_version": "main", - # Change to the folder that contains the documentation - # (usually "/" or "/docs/") - "github_folder": "/docs/", - # Change to an empty value if your GitHub repo doesn't have issues enabled. - # This will disable the feedback button and the issue link in the footer. - "github_issues": "enabled", - # Controls the existence of Previous / Next buttons at the bottom of pages - # Valid options: none, prev, next, both - "sequential_nav": "none", -} - -# If your project is on documentation.ubuntu.com, specify the project -# slug (for example, "lxd") here. -slug = "" - -############################################################ -### Redirects -############################################################ - -# Set up redirects (https://documatt.gitlab.io/sphinx-reredirects/usage.html) -# For example: 'explanation/old-name.html': '../how-to/prettify.html', - -redirects = {} - -############################################################ -### Link checker exceptions -############################################################ - -# Links to ignore when checking links - -linkcheck_ignore = ["http://127.0.0.1:8000"] - -# Pages on which to ignore anchors -# (This list will be appended to linkcheck_anchors_ignore_for_url) - -custom_linkcheck_anchors_ignore_for_url = [] - -############################################################ -### Additions to default configuration -############################################################ - -## The following settings are appended to the default configuration. -## Use them to extend the default functionality. - -# Add extensions -custom_extensions = [ - "sphinx.ext.intersphinx", - "sphinx.ext.viewcode", - "sphinx.ext.coverage", - "sphinx.ext.doctest", - "sphinx_design", - "sphinx_copybutton", - "sphinx-pydantic", - "sphinx.ext.autodoc", - "sphinx_toolbox", -] - -# Add MyST extensions -custom_myst_extensions = [] - -# Add files or directories that should be excluded from processing. -custom_excludes = [ - "doc-cheat-sheet*", -] - -# Add CSS files (located in .sphinx/_static/) -custom_html_css_files = [] - -# Add JavaScript files (located in .sphinx/_static/) -custom_html_js_files = [] - -## The following settings override the default configuration. - -# Specify a reST string that is included at the end of each file. -# If commented out, use the default (which pulls the reuse/links.txt -# file into each reST file). -# custom_rst_epilog = '' - -# By default, the documentation includes a feedback button at the top. -# You can disable it by setting the following configuration to True. -disable_feedback_button = False - -# Add tags that you want to use for conditional inclusion of text -# (https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#tags) -custom_tags = [] - -############################################################ -### Additional configuration -############################################################ - -## Add any configuration that is not covered by the common conf.py file. - -linkcheck_ignore += [r"craft_cli.dispatcher.html#craft_cli.dispatcher.CommandGroup"] - -# Type hints configuration -set_type_checking_flag = True -typehints_fully_qualified = False -always_document_param_types = True -typehints_document_rtype = True - -# Github config -github_username = "canonical" -github_repository = "craft-cli" -# endregion - -# Document class properties before public methods -autodoc_member_order = "bysource" - - -# region Setup reference generation -def run_apidoc(_): - from sphinx.ext.apidoc import main - import os - import sys - - sys.path.append(os.path.join(os.path.dirname(__file__), "..")) - cur_dir = os.path.abspath(os.path.dirname(__file__)) - module = os.path.join(cur_dir, "..", "craft_cli") - exclude_patterns = ["*pytest_plugin*"] - main(["-e", "--no-toc", "--force", "-o", cur_dir, module, *exclude_patterns]) - - -def no_namedtuple_attrib_docstring(app, what, name, obj, options, lines): - """Strips out silly "Alias for field number" lines in namedtuples reference.""" - if len(lines) == 1 and lines[0].startswith("Alias for field number"): - del lines[:] - - -def setup(app): - app.connect("builder-inited", run_apidoc) - app.connect("autodoc-process-docstring", no_namedtuple_attrib_docstring) - - -# endregion diff --git a/docs/.sphinx/requirements.txt b/docs/requirements.txt similarity index 84% rename from docs/.sphinx/requirements.txt rename to docs/requirements.txt index 09fd492..70f9225 100644 --- a/docs/.sphinx/requirements.txt +++ b/docs/requirements.txt @@ -17,3 +17,4 @@ sphinx-pydantic==0.1.1 sphinx-toolbox==3.5.0 sphinx-lint==0.8.1 pytest>=7.0.0 # This is just because this is imported by the code +sphinx-starter-pack@git+https://github.com/tigarmo/sphinx-starter-pack diff --git a/tox.ini b/tox.ini index da7b4a2..feb5fd1 100644 --- a/tox.ini +++ b/tox.ini @@ -106,7 +106,7 @@ commands = [docs] # Sphinx documentation configuration deps = - -r{tox_root}/docs/.sphinx/requirements.txt + -r{tox_root}/docs/requirements.txt package = editable no_package = true env_dir = {work_dir}/docs