Skip to content

Commit 9cad1e2

Browse files
Merge pull request #2 from jim-easterbrook/devel
Devel
2 parents 35154f3 + 7037700 commit 9cad1e2

File tree

10 files changed

+295
-185
lines changed

10 files changed

+295
-185
lines changed

CHANGELOG.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pyctools - a picture processing algorithm development kit.
2-
http://github.com/jim-easterbrook/pyctools
3-
Copyright (C) 2012-19 Jim Easterbrook jim@jim-easterbrook.me.uk
2+
https://github.com/jim-easterbrook/pyctools
3+
Copyright (C) 2012-25 Pyctools contributors
44

55
This program is free software: you can redistribute it and/or
66
modify it under the terms of the GNU General Public License as
@@ -16,6 +16,12 @@ You should have received a copy of the GNU General Public License
1616
along with this program. If not, see
1717
<http://www.gnu.org/licenses/>.
1818

19+
Changes in v0.7.0:
20+
1/ Python 2 is no longer supported.
21+
2/ Some components are deprecated in favour of better replacements.
22+
3/ Documentation build is much improved.
23+
4/ Many smaller changes.
24+
1925
Changes in v0.5.0:
2026
1/ Rethought use of range, black level, and white level. Now almost every
2127
component will assume 0..255 and if conversion to/from 16..235 is needed it

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
include *.txt
2-
recursive-include src/doc *
3-
prune src/doc/api
2+
recursive-exclude src/doc *

pyproject.toml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Pyctools - a picture processing algorithm development kit.
22
# http://github.com/jim-easterbrook/pyctools
3-
# Copyright (C) 2023-24 Pyctools contributors
3+
# Copyright (C) 2023-25 Pyctools contributors
44
#
55
# This file is part of Pyctools.
66
#
@@ -45,13 +45,56 @@ classifiers = [
4545
"Topic :: Scientific/Engineering :: Image Recognition",
4646
"Topic :: Scientific/Engineering :: Visualization",
4747
]
48+
requires-python = ">= 3.6"
49+
dynamic = ["scripts"]
4850
dependencies = [
4951
"docutils",
5052
"exiv2 >= 0.11",
51-
"numpy",
53+
"numpy < 2",
5254
"pillow",
5355
]
5456

57+
[project.optional-dependencies]
58+
# Qt options - only one required
59+
PyQt5 = ["PyQt5 >= 5.9"]
60+
PyQt6 = [
61+
"pyctools-core[PyQt6-linux]; platform_system == 'Linux'",
62+
"pyctools-core[PyQt6-darwin]; platform_system == 'Darwin'",
63+
]
64+
PySide2 = [
65+
"PySide2 >= 5.11.1; python_version < '3.8'",
66+
"PySide2 >= 5.14; python_version >= '3.8'",
67+
]
68+
PySide6 = [
69+
"pyctools-core[PySide6-linux]; platform_system == 'Linux'",
70+
"pyctools-core[PySide6-darwin]; platform_system == 'Darwin'",
71+
]
72+
PyQt6-linux = [
73+
"PyQt6 >= 6.2; python_version != '3.6.*'",
74+
"PyQt6 >= 6.2, < 6.3; python_version == '3.6.*'",
75+
"PyQt6-Qt6 < 6.3; python_version == '3.6.*'",
76+
]
77+
PyQt6-darwin = [
78+
"PyQt6 >= 6.2",
79+
"PyQt6-Qt6 >= 6.2, != 6.6.1",
80+
]
81+
PySide6-linux = ["PySide6 >= 6.2"]
82+
PySide6-darwin = ["PySide6 >= 6.2, != 6.6.1"]
83+
# other packages
84+
cv2 = ["pyctools-core[OpenCV]"]
85+
matplotlib = ["matplotlib"]
86+
OpenCV = [
87+
"opencv-python-headless; python_version != '3.6.*'",
88+
"opencv-python-headless < 4.7; python_version == '3.6.*'",
89+
]
90+
OpenGL = ["pyctools-core[PyOpenGL]"]
91+
PyOpenGL = ["PyOpenGL", "PyOpenGL-accelerate"]
92+
rawkit = ["rawkit"]
93+
rawpy = ["rawpy"]
94+
SciPy = ["scipy"]
95+
# install everything except a Qt package
96+
all = ["pyctools-core[matplotlib,OpenCV,PyOpenGL,rawkit,rawpy,SciPy]"]
97+
5598
[project.urls]
5699
homepage = "https://github.com/jim-easterbrook/pyctools"
57100
documentation = "https://pyctools.readthedocs.io/"

src/doc/conf.py

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Pyctools - a picture processing algorithm development kit.
22
# http://github.com/jim-easterbrook/pyctools
3-
# Copyright (C) 2014-24 Pyctools contributors
3+
# Copyright (C) 2014-25 Pyctools contributors
44
#
55
# This file is part of Pyctools.
66
#
@@ -17,47 +17,20 @@
1717
# You should have received a copy of the GNU General Public License
1818
# along with Pyctools. If not, see <http://www.gnu.org/licenses/>.
1919

20-
from collections import defaultdict
2120
import os
22-
import pkgutil
2321
import site
2422
import sys
25-
import types
26-
from unittest.mock import Mock
2723

2824
# If extensions (or modules to document with autodoc) are in another directory,
2925
# add these directories to sys.path here. If the directory is relative to the
3026
# documentation root, use os.path.abspath to make it absolute, like shown here.
3127
#sys.path.insert(0, os.path.abspath('.'))
3228
site.addsitedir(os.path.abspath('..'))
33-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
34-
35-
# cludge to allow documentation to be compiled without installing some
36-
# dependencies
37-
for mod_name in ('cv2', 'OpenGL', 'matplotlib', 'matplotlib.pyplot',
38-
'scipy', 'scipy.optimize', 'scipy.signal', 'scipy.special',
39-
'sip'):
40-
sys.modules[mod_name] = Mock()
41-
42-
# Qt stuff needs a bit more work as it's used as base classes
43-
class QtMock(Mock):
44-
QT_VERSION_STR = '0.0.0'
45-
QObject = object
46-
QWidget = object
47-
QGraphicsRectItem = object
48-
QGraphicsPolygonItem = object
49-
QGLWidget = object
50-
QOpenGLWidget = object
51-
52-
for mod_name in ('PyQt5', 'PyQt5.QtCore', 'PyQt5.QtGui',
53-
'PyQt5.QtOpenGL', 'PyQt5.QtWidgets'):
54-
sys.modules[mod_name] = QtMock()
5529

5630
# -- General configuration -----------------------------------------------------
5731

5832
# If your documentation needs a minimal Sphinx version, state it here.
5933
#needs_sphinx = '1.0'
60-
needs_sphinx = '2.0'
6134

6235
# Add any Sphinx extension module names here, as strings. They can be extensions
6336
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -75,9 +48,9 @@ class QtMock(Mock):
7548

7649
intersphinx_mapping = {
7750
'python': ('https://docs.python.org/3', None),
78-
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
79-
'PIL': ('http://pillow.readthedocs.io/en/latest/', None),
80-
'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None),
51+
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
52+
'PIL': ('https://pillow.readthedocs.io/en/latest/', None),
53+
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
8154
}
8255

8356
keep_warnings = True
@@ -102,7 +75,7 @@ class QtMock(Mock):
10275

10376
# General information about the project.
10477
project = u'Pyctools'
105-
copyright = u'2014-20, Pyctools contributors'
78+
copyright = u'2014-25, Pyctools contributors'
10679

10780
# The version info for the project you're documenting, acts as replacement for
10881
# |version| and |release|, also used in various other places throughout the
@@ -127,9 +100,9 @@ class QtMock(Mock):
127100
# pkgutil.walk_packages doesn't work with namespace packages, so we do
128101
# a simple file search instead
129102
for path in pyctools.__path__:
130-
depth = len(path.split('/')) - 1
103+
depth = len(path.split(os.path.sep)) - 1
131104
for root, dirs, files in os.walk(path):
132-
parts = root.split('/')
105+
parts = root.split(os.path.sep)
133106
if parts[-1] == '__pycache__':
134107
continue
135108
parts = parts[depth:]
@@ -190,7 +163,8 @@ def submodules(parent):
190163
# import module
191164
try:
192165
mod = __import__(module['name'], globals(), locals(), ['*'])
193-
except ImportError:
166+
except ImportError as ex:
167+
print(str(ex))
194168
continue
195169
module['mod'] = mod
196170
if getattr(mod, '__doc__'):

src/doc/requirements.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
Sphinx==7.2.4
2-
sphinx-rtd-theme==1.3.0
3-
rawkit
4-
rawpy
1+
Sphinx==8.1.3
2+
toml==0.10.2
3+
sphinx-rtd-theme==3.0.2
4+
PyQt5==5.15.11
5+
rawkit==0.6.0
6+
rawpy==0.24.0
7+
opencv-python-headless==4.10.0.84
8+
scipy==1.15.0
9+
matplotlib==3.10.0

src/pyctools/components/io/imagefilecv.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Pyctools - a picture processing algorithm development kit.
22
# http://github.com/jim-easterbrook/pyctools
3-
# Copyright (C) 2016-20 Pyctools contributors
3+
# Copyright (C) 2016-25 Pyctools contributors
44
#
55
# This program is free software: you can redistribute it and/or
66
# modify it under the terms of the GNU General Public License as
@@ -16,8 +16,6 @@
1616
# along with this program. If not, see
1717
# <http://www.gnu.org/licenses/>.
1818

19-
from __future__ import print_function
20-
2119
__all__ = ['ImageFileReaderCV', 'ImageFileWriterCV']
2220
__docformat__ = 'restructuredtext en'
2321

@@ -110,26 +108,31 @@ class ImageFileWriterCV(Transformer):
110108
:py:class:`~pyctools.components.io.imagefilepil.ImageFileWriterPIL`
111109
component instead.
112110
113-
============================== ==== ====
111+
================== ==== ====
114112
Config
115-
============================== ==== ====
116-
``path`` str Path name of file to be written.
117-
``16bit`` bool Write a 16-bit depth file, if the format supports it.
118-
{}
119-
============================== ==== ====
113+
================== ==== ====
114+
``path`` str Path name of file to be read.
115+
``16bit`` bool Write a 16-bit depth file, if the format supports it.
116+
``{a}``{sa} int
117+
...
118+
``{b}``{sb} int
119+
================== ==== ====
120+
121+
The config items from ``{a}`` to ``{b}`` are format-specific
122+
parameters to the :py:func:`cv2.imwrite` function with the
123+
``CV_IMWRITE_`` prefix removed.
120124
121125
.. _OpenCV documentation:
122-
http://docs.opencv.org/2.4.11/modules/highgui/doc/reading_and_writing_images_and_video.html#imwrite
126+
https://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imwrite
123127
124128
"""
125129

126130
cv2_params = [x[8:] for x in cv2.__dict__ if x.startswith('IMWRITE_')]
127131
cv2_params.sort()
128132

129-
__doc__ = __doc__.format(
130-
'\n '.join([
131-
'``{x}``{s} int OpenCV CV_IMWRITE_{x} parameter.'.format(
132-
x=x, s=' '*(26-len(x))) for x in cv2_params]))
133+
__doc__ = __doc__.format(a=cv2_params[0], b=cv2_params[-1],
134+
sa=' '*(12-len(cv2_params[0])),
135+
sb=' '*(12-len(cv2_params[-1])))
133136

134137
def initialise(self):
135138
self.done = False

src/pyctools/components/qt/qtdisplay.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Pyctools - a picture processing algorithm development kit.
22
# http://github.com/jim-easterbrook/pyctools
3-
# Copyright (C) 2014-24 Pyctools contributors
3+
# Copyright (C) 2014-25 Pyctools contributors
44
#
55
# This program is free software: you can redistribute it and/or
66
# modify it under the terms of the GNU General Public License as
@@ -20,10 +20,14 @@
2020
__docformat__ = 'restructuredtext en'
2121

2222
from collections import deque
23+
import sys
2324
import time
2425

2526
import numpy
26-
from OpenGL import GL
27+
if 'sphinx' in sys.modules:
28+
GL = None
29+
else:
30+
from OpenGL import GL
2731

2832
from pyctools.core.config import ConfigBool, ConfigInt, ConfigStr
2933
from pyctools.core.base import Transformer
@@ -225,6 +229,9 @@ def __init__(self, **config):
225229
super(QtDisplay, self).__init__(**config)
226230
self.setWindowFlags(QtCore.Qt.WindowType.Window |
227231
QtCore.Qt.WindowType.WindowStaysOnTopHint)
232+
dpr = self.window().devicePixelRatio()
233+
if int(dpr) != dpr:
234+
self.logger.warning('Non-integer screen pixel ratio %g', dpr)
228235
self.setLayout(QtWidgets.QGridLayout())
229236
fmt = QtGui.QSurfaceFormat()
230237
fmt.setProfile(

0 commit comments

Comments
 (0)