From 64ccee32dcbbb42b4dbb2c824080f078ea2d01b7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 01:54:36 -0400 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.6.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.6.8) - [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.11.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.11.2) * fix: use uv minimums feature Signed-off-by: Henry Schreiner * ci: use uv and nox Signed-off-by: Henry Schreiner --------- Signed-off-by: Henry Schreiner Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner --- .github/workflows/ci.yml | 19 ++++++++-------- .pre-commit-config.yaml | 4 ++-- noxfile.py | 33 ++++++++++++++-------------- pyproject.toml | 19 +++++++--------- src/uproot_browser/_compat/typing.py | 11 ---------- src/uproot_browser/plot.py | 4 ++-- src/uproot_browser/tree.py | 4 +--- tests/constraints.txt | 8 ------- 8 files changed, 38 insertions(+), 64 deletions(-) delete mode 100644 src/uproot_browser/_compat/typing.py delete mode 100644 tests/constraints.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db38189..62ecb45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,11 +33,11 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.11"] + python-version: ["3.8", "3.11"] runs-on: [ubuntu-latest, macos-13, windows-latest] include: - - python-version: pypy-3.8 + - python-version: pypy-3.10 runs-on: ubuntu-latest @@ -48,17 +48,17 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install package - run: python -m pip install ".[test]" + - uses: astral-sh/setup-uv@v3 - - name: Test package - run: python -m pytest + - name: Install nox + run: uv tool install nox - - name: Install minimum versions - run: python -m pip install ".[test]" -c tests/constraints.txt + - name: Test package + run: nox -s tests - name: Test minimum versions - run: python -m pytest + if: matrix.python-version != 'pypy-3.10' + run: nox -s minimums pass: if: always() @@ -86,7 +86,6 @@ jobs: permissions: id-token: write attestations: write - contents: read needs: [dist] if: github.event_name == 'release' && github.event.action == 'published' runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4db933..7913b93 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,14 +14,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.7" + rev: "v0.6.8" hooks: - id: ruff args: ["--fix", "--show-fixes"] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.11.2 hooks: - id: mypy files: src diff --git a/noxfile.py b/noxfile.py index 602d4eb..d1398b7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -2,9 +2,8 @@ import nox -nox.needs_version = ">=2024.3.2" +nox.needs_version = ">=2024.4.15" nox.options.default_venv_backend = "uv|virtualenv" -nox.options.sessions = ["lint", "pylint", "tests"] @nox.session(reuse_venv=True) @@ -16,6 +15,16 @@ def lint(session: nox.Session) -> None: session.run("pre-commit", "run", "--all-files", *session.posargs) +@nox.session +def pylint(session: nox.Session) -> None: + """ + Run pylint. + """ + + session.install("-e.", "pylint", "matplotlib") + session.run("pylint", "src", *session.posargs) + + @nox.session def tests(session: nox.Session) -> None: """ @@ -25,16 +34,16 @@ def tests(session: nox.Session) -> None: session.run("pytest", *session.posargs) -@nox.session(reuse_venv=True) +@nox.session(venv_backend="uv") def minimums(session: nox.Session) -> None: """ Run the unit and regular tests. """ - session.install("-e.[test]", "-ctests/constraints.txt") + session.install("-e.[test]", "--resolution=lowest-direct", "--only-binary=:all:") session.run("pytest", *session.posargs) -@nox.session() +@nox.session(default=False) def run(session: nox.Session) -> None: """ Install and run. @@ -43,17 +52,7 @@ def run(session: nox.Session) -> None: session.run("uproot-browser", *session.posargs) -@nox.session -def pylint(session: nox.Session) -> None: - """ - Run pylint. - """ - - session.install("-e.", "pylint", "matplotlib") - session.run("pylint", "src", *session.posargs) - - -@nox.session(reuse_venv=True) +@nox.session(reuse_venv=True, default=False) def build(session: nox.Session) -> None: """ Build an SDist and wheel. @@ -63,7 +62,7 @@ def build(session: nox.Session) -> None: session.run("python", "-m", "build") -@nox.session +@nox.session(default=False) def make_logo(session: nox.Session) -> None: """ Rerender the logo. diff --git a/pyproject.toml b/pyproject.toml index 9c2098a..6bcf368 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ license = { file = "LICENSE" } description = "Tools to inspect ROOT files with uproot" readme = "README.md" -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "License :: OSI Approved :: BSD License", @@ -26,7 +26,6 @@ classifiers = [ "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -43,20 +42,19 @@ dependencies = [ 'click-default-group >=1.2', 'hist >=2.4', 'importlib_resources; python_version<"3.9"', - 'lz4', + 'lz4>=2', 'numpy >=1.13.3', - 'plotext >=5.2.7', + 'plotext >=5.2.8', 'rich >=13.3.3', 'textual >=0.18.0', - 'typing_extensions; python_version<"3.8"', - 'uproot >=4.2.1', + 'uproot >=5', ] [project.optional-dependencies] test = [ - "pytest >=6", - "pytest-asyncio", - "scikit-hep-testdata", + "pytest >=8", + "pytest-asyncio >=0.22", + "scikit-hep-testdata>=0.4.10", ] iterm = [ "matplotlib", @@ -109,7 +107,7 @@ ignore_missing_imports = true [tool.pylint] -master.py-version = "3.7" +master.py-version = "3.8" master.jobs = "0" reports.output-format = "colorized" similarities.ignore-imports = "yes" @@ -160,7 +158,6 @@ ignore = [ "PLR", "ISC001", # Conflicts with formatter ] -typing-modules = ["uproot_browser._compat.typing"] unfixable = [ "SIM118", # Dict .keys() removal (uproot) ] diff --git a/src/uproot_browser/_compat/typing.py b/src/uproot_browser/_compat/typing.py deleted file mode 100644 index 187511a..0000000 --- a/src/uproot_browser/_compat/typing.py +++ /dev/null @@ -1,11 +0,0 @@ -from __future__ import annotations - -import sys - -if sys.version_info < (3, 8): - from typing_extensions import TypedDict -else: - from typing import TypedDict - - -__all__ = ["TypedDict"] diff --git a/src/uproot_browser/plot.py b/src/uproot_browser/plot.py index cf71a1b..a2cc0c1 100644 --- a/src/uproot_browser/plot.py +++ b/src/uproot_browser/plot.py @@ -32,8 +32,8 @@ def show() -> None: def make_hist_title(item: Any, histogram: hist.Hist) -> str: - inner_sum = np.sum(histogram.values()) - full_sum = np.sum(histogram.values(flow=True)) + inner_sum: float = np.sum(histogram.values()) + full_sum: float = np.sum(histogram.values(flow=True)) if math.isclose(inner_sum, full_sum): return f"{item.name} -- Entries: {inner_sum:g}" diff --git a/src/uproot_browser/tree.py b/src/uproot_browser/tree.py index c9330c2..22bd1ba 100644 --- a/src/uproot_browser/tree.py +++ b/src/uproot_browser/tree.py @@ -7,7 +7,7 @@ import dataclasses import functools from pathlib import Path -from typing import Any +from typing import Any, TypedDict import uproot import uproot.reading @@ -16,8 +16,6 @@ from rich.text import Text from rich.tree import Tree -from ._compat.typing import TypedDict - console = Console() __all__ = ( diff --git a/tests/constraints.txt b/tests/constraints.txt deleted file mode 100644 index 1af2104..0000000 --- a/tests/constraints.txt +++ /dev/null @@ -1,8 +0,0 @@ -awkward<2 -click ==8.0.0 -hist ==2.4.0; python_version<"3.11" -hist ==2.6.0; python_version=="3.11" -plotext ==5.2.7 -rich ==13.3.3 -textual ==0.18.0 -uproot ==4.2.1