Skip to content

Commit

Permalink
chore: some cleanup from uv branch (#686)
Browse files Browse the repository at this point in the history
Pulling out a bit of cleanup, especially the better minimums.

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored Apr 5, 2024
1 parent 32a1c5d commit 289383f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
22 changes: 6 additions & 16 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,20 @@ def minimums(session: nox.Session) -> None:
@nox.session(reuse_venv=True)
def docs(session: nox.Session) -> None:
"""
Build the docs. Pass "--serve" to serve. Pass "-b linkcheck" to check links.
Build the docs. Use "--non-interactive" to avoid serving. Pass "-b linkcheck" to check links.
"""

parser = argparse.ArgumentParser()
parser.add_argument("--serve", action="store_true", help="Serve after building")
parser.add_argument(
"-b", dest="builder", default="html", help="Build target (default: html)"
)
args, posargs = parser.parse_known_args(session.posargs)

if args.builder != "html" and args.serve:
session.error("Must not specify non-HTML builder with --serve")

extra_installs = ["sphinx-autobuild"] if args.serve else []

serve = args.builder == "html" and session.interactive
extra_installs = ["sphinx-autobuild"] if serve else []
session.install("-e.[docs,pyproject]", *extra_installs)
session.run("pip", "list")
session.chdir("docs")

if args.builder == "linkcheck":
session.run(
"sphinx-build", "-b", "linkcheck", ".", "_build/linkcheck", *posargs
)
return
session.chdir("docs")

shared_args = (
"-n", # nitpicky mode
Expand All @@ -154,8 +144,8 @@ def docs(session: nox.Session) -> None:
*posargs,
)

if args.serve:
session.run("sphinx-autobuild", *shared_args)
if serve:
session.run("sphinx-autobuild", "--open-browser", *shared_args)
else:
session.run("sphinx-build", "--keep-going", *shared_args)

Expand Down
22 changes: 13 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ classifiers = [
dynamic = ["version"]

dependencies = [
"exceptiongroup; python_version<'3.11'",
"importlib-metadata; python_version<'3.8'",
"exceptiongroup >=1.0; python_version<'3.11'",
"importlib-metadata >=1.0; python_version<'3.8'",
"importlib-resources >=1.3; python_version<'3.9'",
"packaging >=20.9",
"tomli >=1.1; python_version<'3.11'",
Expand All @@ -50,17 +50,20 @@ pyproject = [
"pyproject-metadata >=0.5",
]
test = [
"build[virtualenv]",
"build >=0.8",
"cattrs >=22.2.0",
"pathspec >=0.10.1",
"pip",
"pybind11",
"pip >=22",
"pybind11 >=2.12",
"pyproject-metadata >=0.5",
"pytest >=7.0", # 7.2+ recommended for better tracebacks with ExceptionGroup
"pytest-subprocess >=1.5",
"setuptools",
"virtualenv",
"wheel",
'setuptools >=43; python_version<"3.9"',
'setuptools >=45; python_version=="3.9"',
'setuptools >=49; python_version>="3.10" and python_version<"3.12"',
'setuptools >=66.1; python_version>="3.12"',
"virtualenv >=20.0.28",
"wheel >=0.40",
]
test-meta = [
"hatch-fancy-pypi-readme>=22.3",
Expand Down Expand Up @@ -91,7 +94,8 @@ docs = [
"myst-parser >=0.13",
"pathspec >=0.10.1",
"pyproject-metadata >=0.5",
"sphinx >=7.0,<=7.1.2", # workaround bug in setuptools, fix in pypa/setuptools#4023
"setuptools",
"sphinx",
"sphinx-copybutton",
"sphinx-inline-tabs",
"sphinx-jsonschema",
Expand Down

0 comments on commit 289383f

Please sign in to comment.