diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8735f08..5f1d7f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.11"] + python-version: ["3.9", "3.11"] runs-on: [ubuntu-latest, macos-13, windows-latest] include: - python-version: "3.13" diff --git a/pyproject.toml b/pyproject.toml index cb5e637..98026e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,12 +10,11 @@ authors = [ maintainers = [ { name = "The Scikit-HEP admins", email = "scikit-hep-admins@googlegroups.com" }, ] -license = { file = "LICENSE" } description = "Tools to inspect ROOT files with uproot" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" classifiers = [ "License :: OSI Approved :: BSD License", @@ -26,7 +25,6 @@ classifiers = [ "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -38,16 +36,15 @@ classifiers = [ dynamic = ["version"] dependencies = [ - 'awkward >=1', + 'awkward >=2', 'click >=8', 'click-default-group >=1.2', 'hist >=2.4', - 'importlib_resources; python_version<"3.9"', 'lz4>=2', - 'numpy >=1.13.3', + 'numpy >=1.18', 'plotext >=5.2.8', 'rich >=13.3.3', - 'textual >=0.18.0', + 'textual >=0.86.0', 'uproot >=5', ] @@ -81,20 +78,13 @@ dev = [ version.source = "vcs" build.hooks.vcs.version-file = "src/uproot_browser/_version.py" -[tool.uv] -environments = [ - "python_version >= '3.11'", -] - [tool.pytest.ini_options] -minversion = "6.0" +minversion = "8.0" addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] xfail_strict = true filterwarnings = [ "error", "ignore:can't resolve package from __spec__ or __package__, falling back on __name__ and __path__:ImportWarning", # PyPy NumPy - "ignore:module 'sre_.*' is deprecated:DeprecationWarning:awkward", # Awkward 1 - "ignore: pkg_resources is deprecated as an API:DeprecationWarning:uproot", # Uproot 4 ] log_cli_level = "info" testpaths = ["tests"] @@ -104,7 +94,7 @@ asyncio_default_fixture_loop_scope = "function" [tool.mypy] files = "src" -python_version = "3.8" +python_version = "3.9" warn_unused_configs = true strict = true @@ -114,7 +104,7 @@ ignore_missing_imports = true [tool.pylint] -master.py-version = "3.8" +master.py-version = "3.9" master.jobs = "0" reports.output-format = "colorized" similarities.ignore-imports = "yes" diff --git a/src/uproot_browser/_compat/__init__.py b/src/uproot_browser/_compat/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/uproot_browser/_compat/importlib/__init__.py b/src/uproot_browser/_compat/importlib/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/uproot_browser/_compat/importlib/resources.py b/src/uproot_browser/_compat/importlib/resources.py deleted file mode 100644 index 37bf326..0000000 --- a/src/uproot_browser/_compat/importlib/resources.py +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import annotations - -import sys - -if sys.version_info < (3, 9): - from importlib_resources import files -else: - from importlib.resources import files - -__all__ = ["files"] diff --git a/src/uproot_browser/plot_mpl.py b/src/uproot_browser/plot_mpl.py index 4087822..b7fc232 100644 --- a/src/uproot_browser/plot_mpl.py +++ b/src/uproot_browser/plot_mpl.py @@ -11,6 +11,7 @@ import hist import matplotlib.pyplot as plt import uproot +import uproot.behaviors.TH1 import uproot_browser.plot diff --git a/src/uproot_browser/tui/browser.py b/src/uproot_browser/tui/browser.py index 2faf7a1..27500d3 100644 --- a/src/uproot_browser/tui/browser.py +++ b/src/uproot_browser/tui/browser.py @@ -122,7 +122,7 @@ def action_quit_with_dump(self) -> None: assert err_widget.exc items = [err_widget.exc] - dark = self.dark if hasattr(self, "dark") else self.theme != "textual-light" # type: ignore[has-type] + dark = self.theme != "textual-light" theme = "ansi_dark" if dark else "ansi_light" @@ -135,20 +135,12 @@ def action_quit_with_dump(self) -> None: def action_toggle_theme(self) -> None: """An action to toggle dark mode.""" - if hasattr(self, "dark"): - # pylint: disable-next=access-member-before-definition - dark = not self.dark # type: ignore[has-type] - if self.plot_widget.item: - self.plot_widget.item.theme = "dark" if dark else "default" - # pylint: disable-next=attribute-defined-outside-init - self.dark = dark - else: - dark = self.theme != "textual-light" - theme = "textual-light" if dark else "textual-dark" + dark = self.theme != "textual-light" + theme = "textual-light" if dark else "textual-dark" - if self.plot_widget.item: - self.plot_widget.item.theme = "dark" if dark else "default" - self.theme = theme + if self.plot_widget.item: + self.plot_widget.item.theme = "dark" if dark else "default" + self.theme = theme def on_uproot_selected(self, message: UprootSelected) -> None: """A message sent by the tree when a file is clicked.""" @@ -156,7 +148,7 @@ def on_uproot_selected(self, message: UprootSelected) -> None: content_switcher = self.query_one("#main-view", textual.widgets.ContentSwitcher) try: - dark = self.dark if hasattr(self, "dark") else self.theme != "textual-light" + dark = self.theme != "textual-light" theme = "dark" if dark else "default" make_plot(message.upfile[message.path], theme, 20) self.plot_widget.item = Plotext(message.upfile, message.path, theme) diff --git a/src/uproot_browser/tui/help.py b/src/uproot_browser/tui/help.py index 1f970c0..5c5a875 100644 --- a/src/uproot_browser/tui/help.py +++ b/src/uproot_browser/tui/help.py @@ -1,6 +1,7 @@ from __future__ import annotations import typing +from importlib.resources import files from typing import ClassVar import textual.app @@ -12,15 +13,8 @@ if typing.TYPE_CHECKING: from .browser import Browser - # 0.18's ModalScreen is not subscriptable. Later versions are. - ModalScreen = textual.screen.ModalScreen[None] -else: - ModalScreen = textual.screen.ModalScreen -from .._compat.importlib.resources import files - - -class HelpScreen(ModalScreen): +class HelpScreen(textual.screen.ModalScreen[None]): BINDINGS: ClassVar[ list[textual.binding.Binding | tuple[str, str] | tuple[str, str, str]] ] = [