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

ci: update jobs and noxfile #929

Merged
merged 3 commits into from
May 10, 2024
Merged
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
8 changes: 4 additions & 4 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Skip dependabot and pre-commit-ci PRs
needs changelog:
- all:
- changed-files:
- all-globs-to-all-files: "!docs/CHANGELOG.md"
- base-branch: "^(?!dependabot).*"
- base-branch: "^(?!pre-commit-ci).*"
- changed-files:
- all-globs-to-all-files: "!docs/CHANGELOG.md"
- base-branch: "^(?!dependabot).*"
- base-branch: "^(?!pre-commit-ci).*"
12 changes: 2 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Run PyLint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
pipx run nox[uv] -s pylint

cmake:
name: CMake 🐍 ${{ matrix.python-version }}
Expand Down Expand Up @@ -115,10 +115,6 @@ jobs:
submodules: true
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: pypa/cibuildwheel@v2.17
env:
CIBW_BUILD: "${{ matrix.build }}"
Expand All @@ -129,12 +125,8 @@ jobs:
path: wheelhouse/*
name: test-wheels-${{ strategy.job-index }}

# Pipx is either missing or broken on macos-14 runners ATM
- name: Install twine
run: pip install twine

- name: Check wheels
run: twine check wheelhouse/*
run: pipx run twine check wheelhouse/*
shell: bash

pass:
Expand Down
41 changes: 15 additions & 26 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,41 +48,31 @@ def hist(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. Pass --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)
serve = args.builder == "html" and session.interactive

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 []

session.chdir("docs")
session.install("-r", "requirements.txt", *extra_installs)

if args.builder == "linkcheck":
session.run(
"sphinx-build", "-b", "linkcheck", ".", "_build/linkcheck", *posargs
)
return
extra_installs = ["sphinx-autobuild"] if serve else []
session.install("-r", "docs/requirements.txt", *extra_installs)

shared_args = (
"-n", # nitpicky mode
"-T", # full tracebacks
f"-b={args.builder}",
".",
f"_build/{args.builder}",
*posargs,
"docs",
*(posargs or [f"docs/_build/{args.builder}"]),
)

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

Expand All @@ -94,22 +84,21 @@ def build_api_docs(session: nox.Session) -> None:
"""

session.install(".", "-r", "docs/requirements.txt")
session.chdir("docs")
session.run(
"sphinx-apidoc",
"-o",
"api/",
"docs/api/",
"--no-toc",
"--template",
"template/",
"docs/template/",
"--force",
"--module-first",
"../src/boost_histogram",
"src/boost_histogram",
)

# add API docs of boost_histogram._internal.hist.Histogram after
# the generation step
with Path("api/boost_histogram.rst").open("r+") as f:
with Path("docs/api/boost_histogram.rst").open("r+") as f:
lines = f.readlines()
for i in range(len(lines)):
if lines[i] == ".. automodule:: boost_histogram\n":
Expand Down Expand Up @@ -137,7 +126,7 @@ def pylint(session: nox.Session) -> None:
Run pylint.
"""

session.install("pylint==2.17.*")
session.install("pylint==3.1.*")
session.install(".")
session.run("pylint", "src", *session.posargs)

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ environment.PIP_PREFER_BINARY = "1"

[tool.pylint]
py-version = "3.7"
ignore-patterns = ['.*\.pyi']
extension-pkg-allow-list = ["boost_histogram._core"]
reports.output-format = "colorized"
similarities.ignore-imports = "yes"
Expand Down