Skip to content

Commit 161a6cb

Browse files
authored
Merge pull request #75 from mfisher87/pin-minimum-dep-versions
Drop support for Python 3.8, Qt5, matplotlib 3.4, scipy 1.7, numpy 1.21
2 parents 6735c7e + 0f36651 commit 161a6cb

File tree

9 files changed

+119
-99
lines changed

9 files changed

+119
-99
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ jobs:
1313
- "3.11"
1414
- "3.10"
1515
- "3.9"
16-
- "3.8"
1716
pyqt-dependency:
18-
- "PyQt5"
19-
# - "PyQt6"
17+
- "PyQt6"
18+
- "PySide6"
2019

2120
steps:
2221
- uses: "actions/checkout@v3"
@@ -37,8 +36,9 @@ jobs:
3736
# pytest-qt CI dependencies: https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions
3837
sudo apt update
3938
sudo apt install -y \
40-
xvfb \
41-
libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
39+
xvfb libegl1 \
40+
libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils \
41+
libxcb-cursor0
4242
4343
- name: "Run tests"
4444
run: "make test"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: test
22
test:
33
python -m pytest --version
4-
python -m pytest -v test/
4+
python -m pytest -sv test/
55

66

77
.PHONY: lint

README.rst

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ viscm
33

44
This is a little tool for analyzing colormaps and creating new colormaps.
55

6-
Try::
7-
8-
$ pip install viscm
9-
$ python -m viscm view jet
10-
$ python -m viscm edit
11-
12-
There is some information available about how to interpret the
13-
resulting visualizations and use the editor tool `on this website
14-
<https://bids.github.io/colormap/>`_.
15-
166
Downloads:
177
* https://pypi.python.org/pypi/viscm/
188
* https://anaconda.org/conda-forge/viscm/
@@ -24,23 +14,50 @@ Contact:
2414
Nathaniel J. Smith <njs@pobox.com> and Stéfan van der Walt <stefanv@berkeley.edu>
2515

2616
Dependencies:
27-
* Python 3.8+
28-
* `colorspacious <https://pypi.python.org/pypi/colorspacious>`_
29-
* Matplotlib
30-
* NumPy
17+
* Python 3.9+
18+
* `colorspacious <https://pypi.python.org/pypi/colorspacious>`_ 1.1+
19+
* Matplotlib 3.5+
20+
* NumPy 1.22+
21+
* SciPy 1.8+
22+
* one of PyQt6, PySide6
3123

3224
License:
3325
MIT, see `LICENSE <LICENSE>`__ for details.
3426

27+
28+
Installation
29+
------------
30+
31+
This is a GUI application, and requires Qt Python bindings.
32+
They can be provided by PyQt (GPL) or PySide (LGPL)::
33+
34+
$ pip install viscm[PySide]
35+
36+
...or::
37+
38+
$ pip install viscm[PyQt]
39+
40+
41+
Usage
42+
-----
43+
44+
::
45+
46+
$ viscm view jet
47+
$ viscm edit
48+
49+
There is some information available about how to interpret the
50+
resulting visualizations and use the editor tool `on this website
51+
<https://bids.github.io/colormap/>`_.
52+
53+
3554
Reproducing viridis
36-
-------------------
55+
^^^^^^^^^^^^^^^^^^^
3756

38-
Load [viridis AKA option_d.py](https://github.com/BIDS/colormap/) using:
57+
Load `viridis AKA option_d.py <https://github.com/BIDS/colormap/>`__ using::
3958

40-
```
41-
python -m viscm --uniform-space buggy-CAM02-UCS -m Bezier edit /tmp/option_d.py
42-
```
59+
viscm --uniform-space buggy-CAM02-UCS -m Bezier edit /tmp/option_d.py
4360

4461
Note that there was a small bug in the assumed sRGB viewing conditions
4562
while designing viridis. It does not affect the outcome by much. Also
46-
see `python -m viscm --help`.
63+
see :code:`viscm --help`.

doc/contributing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ python -m build
2222
pip install dist/*.whl # or `dist/*.tar.gz`
2323
```
2424

25+
To automatically install a Qt dependency, try `pip install dist/<wheel_filename>[PyQt]`.
26+
2527

2628
## Tests
2729

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- "matplotlib ~=3.7"
1010
- "colorspacious ~=1.1"
1111
- "scipy ~=1.10"
12+
- "PySide6"
1213

1314
# Development
1415
- "mypy ~=1.3.0"

pyproject.toml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@ classifiers = [
1515
"Programming Language :: Python :: 3",
1616
]
1717

18-
requires-python = "~=3.8"
18+
requires-python = "~=3.9"
1919
dependencies = [
20-
"numpy",
21-
"matplotlib",
22-
"colorspacious",
23-
"scipy",
20+
"numpy ~=1.22",
21+
"matplotlib ~=3.5",
22+
"colorspacious ~=1.1",
23+
"scipy ~=1.8",
2424
]
2525

26+
[project.optional-dependencies]
27+
# Qt6 was released 2020.08.12
28+
PySide = ["PySide6"]
29+
PyQt = ["PyQt6"]
30+
2631
[project.urls]
2732
repository = "https://github.com/matplotlib/viscm"
2833
# documentation = "https://viscm.readthedocs.io"
@@ -46,7 +51,7 @@ package-data = {viscm = ["examples/*"]}
4651

4752

4853
[tool.mypy]
49-
python_version = "3.8"
54+
python_version = "3.9"
5055

5156
# These libraries don't have type stubs. Mypy will see them as `Any` and not
5257
# throw an [import] error.
@@ -62,10 +67,10 @@ ignore_missing_imports = true
6267

6368

6469
[tool.black]
65-
target-version = ["py38", "py39", "py310", "py311"]
70+
target-version = ["py39", "py310", "py311"]
6671

6772
[tool.ruff]
68-
target-version = "py38"
73+
target-version = "py39"
6974
select = [
7075
"F",
7176
"E",

viscm/bezierbuilder/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
from viscm.bezierbuilder.curve import curve_method
3333
from viscm.minimvc import Trigger
3434

35+
Qt = QtCore.Qt
36+
3537

3638
class ControlPointModel:
3739
def __init__(self, xp, yp, fixed=None):
@@ -104,12 +106,14 @@ def on_button_press(self, event):
104106
if event.inaxes != self.ax:
105107
return
106108
res, ind = self.control_polygon.contains(event)
107-
if res and modkey == QtCore.Qt.NoModifier:
109+
if res and modkey == Qt.KeyboardModifier.NoModifier:
108110
self._index = ind["ind"][0]
109-
if res and (modkey == QtCore.Qt.ControlModifier or self.mode == "remove"):
111+
if res and (
112+
modkey == Qt.KeyboardModifier.ControlModifier or self.mode == "remove"
113+
):
110114
# Control-click deletes
111115
self.control_point_model.remove_point(ind["ind"][0])
112-
if modkey == QtCore.Qt.ShiftModifier or self.mode == "add":
116+
if modkey == Qt.KeyboardModifier.ShiftModifier or self.mode == "add":
113117
# Adding a new point. Find the two closest points and insert it in
114118
# between them.
115119
total_squared_dists = []

viscm/cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def cli():
111111

112112
signal.signal(signal.SIGINT, signal.SIG_DFL)
113113

114-
app.exec_()
114+
app.exec()
115115

116116

117117
def _make_window(
@@ -145,7 +145,7 @@ def _make_window(
145145
v.figure.savefig(str(save))
146146
elif action == "edit":
147147
if not cm.can_edit:
148-
sys.exit("Sorry, I don't know how to edit the specified colormap")
148+
raise RuntimeError("Sorry, I don't know how to edit the specified colormap")
149149

150150
v = gui.viscm_editor(
151151
figure=fig,
@@ -164,7 +164,8 @@ def _make_window(
164164
sys.exit()
165165

166166
figure_canvas.setSizePolicy(
167-
gui.QtWidgets.QSizePolicy.Expanding, gui.QtWidgets.QSizePolicy.Expanding
167+
gui.QtWidgets.QSizePolicy.Policy.Expanding,
168+
gui.QtWidgets.QSizePolicy.Policy.Expanding,
168169
)
169170
figure_canvas.updateGeometry()
170171

0 commit comments

Comments
 (0)