Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#171)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.6.8](astral-sh/ruff-pre-commit@v0.4.7...v0.6.8)
- [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.11.2](pre-commit/mirrors-mypy@v1.10.0...v1.11.2)

* fix: use uv minimums feature

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: use uv and nox

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
pre-commit-ci[bot] and henryiii authored Oct 7, 2024
1 parent 44e754f commit 64ccee3
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 64 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 16 additions & 17 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
"""
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
19 changes: 8 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -160,7 +158,6 @@ ignore = [
"PLR",
"ISC001", # Conflicts with formatter
]
typing-modules = ["uproot_browser._compat.typing"]
unfixable = [
"SIM118", # Dict .keys() removal (uproot)
]
Expand Down
11 changes: 0 additions & 11 deletions src/uproot_browser/_compat/typing.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/uproot_browser/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 1 addition & 3 deletions src/uproot_browser/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,8 +16,6 @@
from rich.text import Text
from rich.tree import Tree

from ._compat.typing import TypedDict

console = Console()

__all__ = (
Expand Down
8 changes: 0 additions & 8 deletions tests/constraints.txt

This file was deleted.

0 comments on commit 64ccee3

Please sign in to comment.