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

feat: py, textual, awkward bump #188

Merged
merged 1 commit into from
Dec 21, 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 7 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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',
]

Expand Down Expand Up @@ -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"]
Expand All @@ -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

Expand All @@ -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"
Expand Down
Empty file.
Empty file.
10 changes: 0 additions & 10 deletions src/uproot_browser/_compat/importlib/resources.py

This file was deleted.

1 change: 1 addition & 0 deletions src/uproot_browser/plot_mpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import hist
import matplotlib.pyplot as plt
import uproot
import uproot.behaviors.TH1

import uproot_browser.plot

Expand Down
22 changes: 7 additions & 15 deletions src/uproot_browser/tui/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -135,28 +135,20 @@ 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."""

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)
Expand Down
10 changes: 2 additions & 8 deletions src/uproot_browser/tui/help.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import typing
from importlib.resources import files
from typing import ClassVar

import textual.app
Expand All @@ -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]]
] = [
Expand Down
Loading