Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uniformize HACF docs & move theme to Furo #1006

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
version: 2

formats: all
python:
install:
- requirements: docs/requirements.txt
- path: .
build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: docs/conf.py

formats: all

python:
install:
- requirements: docs/requirements.txt
5 changes: 2 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@


project = "Renault API"
author = "epenet"
author = "HACF (created and maintained by @epenet)"
copyright = f"{datetime.now().year}, {author}"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_click",
"sphinx_rtd_theme",
]
autodoc_typehints = "description"
html_theme = "sphinx_rtd_theme"
html_theme = "furo"
5 changes: 1 addition & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
sphinx==7.2.6
sphinx-click==5.0.1
sphinx-rtd-theme==1.3.0
click==8.1.7
tabulate==0.9.0
dateparser==1.1.8
furo==2023.9.10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove click/tabulate/dateparser?

36 changes: 14 additions & 22 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
Args:
session: The Session object.
"""
if session.bin is None:
return

virtualenv = session.env.get("VIRTUAL_ENV")
if virtualenv is None:
return
Expand Down Expand Up @@ -86,10 +89,10 @@ def precommit(session: Session) -> None:
"""Lint using pre-commit."""
args = session.posargs or ["run", "--all-files", "--show-diff-on-failure"]
session.install(
"bandit",
"black",
"darglint",
"flake8",
"flake8-bandit",
"flake8-bugbear",
"flake8-docstrings",
"flake8-rst-docstrings",
Expand All @@ -115,16 +118,8 @@ def safety(session: Session) -> None:
def mypy(session: Session) -> None:
"""Type-check using mypy."""
args = session.posargs or ["src", "tests", "docs/conf.py"]
session.install(".[cli]")
session.install(
"mypy",
"pytest",
"types-dateparser",
"types-tabulate",
"types-tzlocal",
"pytest-asyncio",
"aioresponses",
)
session.install(".")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to keep ".[cli]" to have the cli dependencies included

session.install("mypy", "pytest", "types-requests", "types-pytz", "pytest-asyncio")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should change the dependencies here.

session.run("mypy", *args)
if not session.posargs:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")
Expand All @@ -133,10 +128,8 @@ def mypy(session: Session) -> None:
@session(python=python_versions)
def tests(session: Session) -> None:
"""Run the test suite."""
session.install(".[cli]")
session.install(
"coverage[toml]", "pytest", "pygments", "pytest-asyncio", "aioresponses"
)
session.install(".")
session.install("coverage[toml]", "pytest", "pygments", "requests_mock")
Comment on lines +131 to +132
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

try:
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
finally:
Expand All @@ -160,8 +153,8 @@ def coverage(session: Session) -> None:
@session(python=python_versions)
def typeguard(session: Session) -> None:
"""Runtime type checking using Typeguard."""
session.install(".[cli]")
session.install("pytest", "typeguard", "pygments", "pytest-asyncio", "aioresponses")
session.install(".")
session.install("pytest", "typeguard", "pygments", "requests_mock")
Comment on lines +156 to +157
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

session.run("pytest", f"--typeguard-packages={package}", *session.posargs)


Expand All @@ -178,8 +171,8 @@ def xdoctest(session: Session) -> None:
def docs_build(session: Session) -> None:
"""Build the documentation."""
args = session.posargs or ["docs", "docs/_build"]
session.run("python", "-m", "pip", "install", "-r", "docs/requirements.txt")
session.install(".[cli]")
session.install(".")
session.install("sphinx", "sphinx-click", "furo")

build_dir = Path("docs", "_build")
if build_dir.exists():
Expand All @@ -192,9 +185,8 @@ def docs_build(session: Session) -> None:
def docs(session: Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""
args = session.posargs or ["--open-browser", "docs", "docs/_build"]
session.run("python", "-m", "pip", "install", "-r", "docs/requirements.txt")
session.install(".[cli]")
session.install("sphinx-autobuild")
session.install(".")
session.install("sphinx", "sphinx-autobuild", "sphinx-click", "furo")

build_dir = Path("docs", "_build")
if build_dir.exists():
Expand Down
Loading
Loading