Skip to content

Commit a04514e

Browse files
committed
chore: enable pixi; depracete uproot4
1 parent ae77540 commit a04514e

File tree

2 files changed

+37
-25
lines changed

2 files changed

+37
-25
lines changed

pyproject.toml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ test = [
6262
"pytest>=6.0",
6363
"scikit-hep-testdata",
6464
"scipy>=1.1.0",
65-
"uproot",
66-
"uproot4",
65+
"uproot>=5.0",
6766
"seaborn",
6867
]
6968
all = [
@@ -99,6 +98,39 @@ environments = [
9998
"python_version >= '3.10'",
10099
]
101100

101+
[tool.pixi.workspace]
102+
name = "mplhep"
103+
authors = ["andrzejnovak <[email protected]>"]
104+
description = "Matplotlib styles for HEP"
105+
channels = ["conda-forge"]
106+
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
107+
108+
[tool.pixi.pypi-dependencies]
109+
mplhep = { path = ".", editable = true, extras = ["dev", "test"] }
110+
111+
[tool.pixi.environments]
112+
default = { solve-group = "default" }
113+
test = { solve-group = "default" }
114+
115+
[tool.pixi.tasks]
116+
# Testing
117+
test = "python -m pytest -r sa --mpl --mpl-results-path=pytest_results -n auto"
118+
test-benchmark = "python -m pytest --benchmark-only --benchmark-sort=mean --benchmark-warmup=on"
119+
test-baseline = "python -m pytest -r sa --mpl -n auto --mpl-generate-path=tests/baseline"
120+
121+
# Linting & formatting (via pre-commit hooks)
122+
precommit = "prek run --all-files"
123+
prek = "prek run --all-files"
124+
125+
# Documentation
126+
docs-build = { cmd = "mkdocs build --clean", cwd = "new_docs" }
127+
docs-build-fast = { cmd = "mkdocs build -f mkdocs_norender.yml", cwd = "new_docs" }
128+
docs-serve = { cmd = "mkdocs serve --dev-addr 127.0.0.1:8000", cwd = "new_docs" }
129+
docs-serve-fast = { cmd = "mkdocs serve -f mkdocs_norender.yml --dev-addr 127.0.0.1:8000", cwd = "new_docs" }
130+
131+
# Cleanup
132+
clean = "rm -rf pytest_results __pycache__ .pytest_cache .coverage .mypy_cache htmlcov dist build *.egg-info"
133+
102134

103135
[tool.mypy]
104136
files = ["src"]
@@ -133,6 +165,8 @@ filterwarnings = [
133165
"error",
134166
"default:urllib3 v2 only supports OpenSSL",
135167
"default:invalid value encountered in _fmt:RuntimeWarning",
168+
"ignore::pytest_benchmark.logger.PytestBenchmarkWarning",
169+
"ignore:In the future `np.object` will be defined:FutureWarning",
136170
]
137171
log_level = "INFO"
138172
python_files = "test*.py"

tests/test_inputs.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
import matplotlib.pyplot as plt
66
import numpy as np
77
import pytest
8-
from matplotlib.testing.decorators import check_figures_equal
98

109
os.environ["RUNNING_PYTEST"] = "true"
1110

1211
import boost_histogram as bh
1312
import uproot
14-
import uproot4
1513
from skhep_testdata import data_path
1614

1715
import mplhep as mh
@@ -45,7 +43,7 @@ def test_inputs_basic():
4543
@pytest.mark.mpl_image_compare(style="default", remove_text=True)
4644
def test_inputs_uproot():
4745
fname = data_path("uproot-hepdata-example.root")
48-
f = uproot4.open(fname)
46+
f = uproot.open(fname)
4947

5048
fig, axs = plt.subplots(1, 2, figsize=(14, 5))
5149
TH1, TH2 = f["hpx"], f["hpxpy"]
@@ -55,26 +53,6 @@ def test_inputs_uproot():
5553
return fig
5654

5755

58-
@check_figures_equal(extensions=("png", "pdf"))
59-
def test_uproot_versions(fig_test, fig_ref):
60-
fname = data_path("uproot-hepdata-example.root")
61-
f4 = uproot4.open(fname)
62-
f3 = uproot.open(fname)
63-
64-
fig_test.set_size_inches(14, 5)
65-
fig_ref.set_size_inches(14, 5)
66-
67-
test_axs = fig_test.subplots(1, 2)
68-
TH1u4, TH2u4 = f4["hpx"], f4["hpxpy"]
69-
mh.histplot(TH1u4, ax=test_axs[0])
70-
mh.hist2dplot(TH2u4, ax=test_axs[1], cbar=False)
71-
72-
ref_axs = fig_ref.subplots(1, 2)
73-
TH1u3, TH2u3 = f3["hpx"], f3["hpxpy"]
74-
mh.histplot(TH1u3, ax=ref_axs[0])
75-
mh.hist2dplot(TH2u3, ax=ref_axs[1], cbar=False)
76-
77-
7856
@pytest.mark.mpl_image_compare(style="default", remove_text=True)
7957
def test_inputs_bh():
8058
np.random.seed(0)

0 commit comments

Comments
 (0)