From 42dd615a6b088a7745403d9343e7abc8e156ef83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Mon, 6 Feb 2023 07:13:07 -0800 Subject: [PATCH] Use furo docs theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- docs/changelog/2481.bugfix.rst | 2 +- docs/changelog/24900.docs.rst | 1 + docs/conf.py | 43 ++++++++++------------------------ pyproject.toml | 13 ++++++++-- tox.ini | 1 - 5 files changed, 25 insertions(+), 35 deletions(-) create mode 100644 docs/changelog/24900.docs.rst diff --git a/docs/changelog/2481.bugfix.rst b/docs/changelog/2481.bugfix.rst index d8487b20e..8a6d47178 100644 --- a/docs/changelog/2481.bugfix.rst +++ b/docs/changelog/2481.bugfix.rst @@ -1 +1 @@ -Fix broken prompt in Nushell when activating virtual environment. +Fix broken prompt in Nushell when activating virtual environment - by :user:`kubouc`. diff --git a/docs/changelog/24900.docs.rst b/docs/changelog/24900.docs.rst new file mode 100644 index 000000000..a624e570c --- /dev/null +++ b/docs/changelog/24900.docs.rst @@ -0,0 +1 @@ +Use ``furo`` theme - by :user:`gaborbernat`. diff --git a/docs/conf.py b/docs/conf.py index 26fef794f..d7d624b3f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,8 +3,6 @@ from datetime import date, datetime from pathlib import Path -import sphinx_rtd_theme - from virtualenv.version import __version__ company = "PyPA" @@ -30,21 +28,11 @@ project = name today_fmt = "%B %d, %Y" -html_theme = "sphinx_rtd_theme" -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] -html_theme_options = { - "canonical_url": "https://virtualenv.pypa.io/", - "logo_only": False, - "display_version": True, - "prev_next_buttons_location": "bottom", - "collapse_navigation": False, - "sticky_navigation": True, - "navigation_depth": 6, - "includehidden": True, -} -html_static_path = ["_static"] -html_last_updated_fmt = datetime.now().isoformat() -htmlhelp_basename = "Pastedoc" +html_theme = "furo" +html_title, html_last_updated_fmt = "tox", datetime.now().isoformat() +pygments_style, pygments_dark_style = "sphinx", "monokai" +html_static_path, html_css_files = ["_static"], ["custom.css"] + autoclass_content = "both" # Include __init__ in class documentation autodoc_member_order = "bysource" autosectionlabel_prefix_document = True @@ -57,21 +45,14 @@ } -def generate_draft_news(): - root = Path(__file__).parents[1] - new = subprocess.check_output( - [sys.executable, "-m", "towncrier", "--draft", "--version", "NEXT"], - cwd=root, - text=True, - ) - dest = root / "docs" / "_draft.rst" - dest.write_text("" if "No significant changes" in new else new) - - -generate_draft_news() - - def setup(app): + here = Path(__file__).parent + root, exe = here.parent, Path(sys.executable) + towncrier = exe.with_name(f"towncrier{exe.suffix}") + cmd = [str(towncrier), "build", "--draft", "--version", "NEXT"] + new = subprocess.check_output(cmd, cwd=root, text=True, stderr=subprocess.DEVNULL) + (root / "docs" / "_draft.rst").write_text("" if "No significant changes" in new else new) + # the CLI arguments are dynamically generated doc_tree = Path(app.doctreedir) cli_interface_doctree = doc_tree / "cli_interface.doctree" diff --git a/pyproject.toml b/pyproject.toml index 1b56d6a93..2c8d26287 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,10 +42,11 @@ dependencies = [ "platformdirs<3,>=2.4", ] optional-dependencies.docs = [ + "furo>=2022.12.7", "proselint>=0.13", - "sphinx>=5.3", + "sphinx>=6.1.3", "sphinx-argparse>=0.4", - "sphinx-rtd-theme>=1.1.1", + "sphinxcontrib-towncrier>=0.2.1a0", "towncrier>=22.12", ] optional-dependencies.test = [ @@ -147,3 +148,11 @@ markers = ["slow"] timeout = 600 addopts = "--tb=auto -ra --showlocals --no-success-flaky-report" env = ["PYTHONIOENCODING=utf-8"] + +[tool.towncrier] +name = "tox" +filename = "docs/changelog.rst" +directory = "docs/changelog" +title_format = false +issue_format = ":issue:`{issue}`" +template = "docs/changelog/template.jinja2" diff --git a/tox.ini b/tox.ini index b7ff7783a..357b4b7ce 100644 --- a/tox.ini +++ b/tox.ini @@ -60,7 +60,6 @@ description = build documentation extras = docs commands = - python -c 'import glob; import subprocess; subprocess.call(["proselint"] + glob.glob("docs/*.rst") + glob.glob("docs/**/*.rst"))' sphinx-build -d "{envtmpdir}/doctree" docs "{toxworkdir}/docs_out" --color -b html {posargs:-W} python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'