Glymur 0.13.6__tar.gz → 0.13.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. {glymur-0.13.6 → glymur-0.13.7}/CHANGES.txt +8 -0
  2. {glymur-0.13.6 → glymur-0.13.7}/Glymur.egg-info/PKG-INFO +4 -3
  3. {glymur-0.13.6 → glymur-0.13.7}/PKG-INFO +4 -3
  4. {glymur-0.13.6 → glymur-0.13.7}/glymur/jp2box.py +4 -4
  5. {glymur-0.13.6 → glymur-0.13.7}/glymur/jp2kr.py +3 -3
  6. {glymur-0.13.6 → glymur-0.13.7}/glymur/version.py +1 -1
  7. {glymur-0.13.6 → glymur-0.13.7}/setup.cfg +3 -2
  8. {glymur-0.13.6 → glymur-0.13.7}/tests/test_jp2box_xml.py +41 -30
  9. {glymur-0.13.6 → glymur-0.13.7}/tests/test_printing.py +2 -1
  10. {glymur-0.13.6 → glymur-0.13.7}/tests/test_tiff2jp2.py +27 -27
  11. {glymur-0.13.6 → glymur-0.13.7}/Glymur.egg-info/SOURCES.txt +0 -0
  12. {glymur-0.13.6 → glymur-0.13.7}/Glymur.egg-info/dependency_links.txt +0 -0
  13. {glymur-0.13.6 → glymur-0.13.7}/Glymur.egg-info/entry_points.txt +0 -0
  14. {glymur-0.13.6 → glymur-0.13.7}/Glymur.egg-info/not-zip-safe +0 -0
  15. {glymur-0.13.6 → glymur-0.13.7}/Glymur.egg-info/requires.txt +0 -0
  16. {glymur-0.13.6 → glymur-0.13.7}/Glymur.egg-info/top_level.txt +0 -0
  17. {glymur-0.13.6 → glymur-0.13.7}/LICENSE.txt +0 -0
  18. {glymur-0.13.6 → glymur-0.13.7}/MANIFEST.in +0 -0
  19. {glymur-0.13.6 → glymur-0.13.7}/README.md +0 -0
  20. {glymur-0.13.6 → glymur-0.13.7}/glymur/__init__.py +0 -0
  21. {glymur-0.13.6 → glymur-0.13.7}/glymur/_iccprofile.py +0 -0
  22. {glymur-0.13.6 → glymur-0.13.7}/glymur/codestream.py +0 -0
  23. {glymur-0.13.6 → glymur-0.13.7}/glymur/command_line.py +0 -0
  24. {glymur-0.13.6 → glymur-0.13.7}/glymur/config.py +0 -0
  25. {glymur-0.13.6 → glymur-0.13.7}/glymur/core.py +0 -0
  26. {glymur-0.13.6 → glymur-0.13.7}/glymur/data/__init__.py +0 -0
  27. {glymur-0.13.6 → glymur-0.13.7}/glymur/data/goodstuff.j2k +0 -0
  28. {glymur-0.13.6 → glymur-0.13.7}/glymur/data/heliov.jpx +0 -0
  29. {glymur-0.13.6 → glymur-0.13.7}/glymur/data/nemo.jp2 +0 -0
  30. {glymur-0.13.6 → glymur-0.13.7}/glymur/jp2k.py +0 -0
  31. {glymur-0.13.6 → glymur-0.13.7}/glymur/lib/__init__.py +0 -0
  32. {glymur-0.13.6 → glymur-0.13.7}/glymur/lib/openjp2.py +0 -0
  33. {glymur-0.13.6 → glymur-0.13.7}/glymur/lib/tiff.py +0 -0
  34. {glymur-0.13.6 → glymur-0.13.7}/glymur/options.py +0 -0
  35. {glymur-0.13.6 → glymur-0.13.7}/glymur/tiff.py +0 -0
  36. {glymur-0.13.6 → glymur-0.13.7}/pyproject.toml +0 -0
  37. {glymur-0.13.6 → glymur-0.13.7}/tests/test_callbacks.py +0 -0
  38. {glymur-0.13.6 → glymur-0.13.7}/tests/test_cinema.py +0 -0
  39. {glymur-0.13.6 → glymur-0.13.7}/tests/test_codestream.py +0 -0
  40. {glymur-0.13.6 → glymur-0.13.7}/tests/test_colour_specification_box.py +0 -0
  41. {glymur-0.13.6 → glymur-0.13.7}/tests/test_config.py +0 -0
  42. {glymur-0.13.6 → glymur-0.13.7}/tests/test_geo.py +0 -0
  43. {glymur-0.13.6 → glymur-0.13.7}/tests/test_jp2box.py +0 -0
  44. {glymur-0.13.6 → glymur-0.13.7}/tests/test_jp2box_jpx.py +0 -0
  45. {glymur-0.13.6 → glymur-0.13.7}/tests/test_jp2box_uuid.py +0 -0
  46. {glymur-0.13.6 → glymur-0.13.7}/tests/test_jp2k.py +0 -0
  47. {glymur-0.13.6 → glymur-0.13.7}/tests/test_jp2k_writes.py +0 -0
  48. {glymur-0.13.6 → glymur-0.13.7}/tests/test_jp2kr.py +0 -0
  49. {glymur-0.13.6 → glymur-0.13.7}/tests/test_libtiff.py +0 -0
  50. {glymur-0.13.6 → glymur-0.13.7}/tests/test_openjp2.py +0 -0
  51. {glymur-0.13.6 → glymur-0.13.7}/tests/test_set_decoded_components.py +0 -0
  52. {glymur-0.13.6 → glymur-0.13.7}/tests/test_slicing.py +0 -0
  53. {glymur-0.13.6 → glymur-0.13.7}/tests/test_threading.py +0 -0
  54. {glymur-0.13.6 → glymur-0.13.7}/tests/test_warnings.py +0 -0
@@ -1,3 +1,11 @@
1
+ Jan 15, 2025 - v0.13.7
2
+ Qualify on python 3.13
3
+ Fix test warnings due to scikit-image deprecation.
4
+ Update CI test matrix, tighten 3rd party library requirements.
5
+ Add ability to construct XML box from file-like object.
6
+ Add circle-ci CI.
7
+ Fix test suite for numpy 2.x printing (thanks to Arne Keller).
8
+
1
9
  Aug 19, 2024 - v0.13.6
2
10
  Fix tiff2jp2 when tile coverage not square.
3
11
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: Glymur
3
- Version: 0.13.6
3
+ Version: 0.13.7
4
4
  Home-page: https://github.com/quintusdias/glymur
5
5
  Author: 'John Evans'
6
6
  Author-email: "John Evans" <jevans667cc@proton.me>
@@ -9,12 +9,13 @@ Classifier: Programming Language :: Python
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
12
13
  Classifier: Programming Language :: Python :: Implementation :: CPython
13
14
  Classifier: License :: OSI Approved :: MIT License
14
15
  Classifier: Intended Audience :: Science/Research
15
16
  Classifier: Operating System :: OS Independent
16
17
  Classifier: Topic :: Scientific/Engineering
17
- Requires-Python: >=3.8
18
+ Requires-Python: >=3.9
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE.txt
20
21
  Requires-Dist: numpy
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: Glymur
3
- Version: 0.13.6
3
+ Version: 0.13.7
4
4
  Home-page: https://github.com/quintusdias/glymur
5
5
  Author: 'John Evans'
6
6
  Author-email: "John Evans" <jevans667cc@proton.me>
@@ -9,12 +9,13 @@ Classifier: Programming Language :: Python
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
12
13
  Classifier: Programming Language :: Python :: Implementation :: CPython
13
14
  Classifier: License :: OSI Approved :: MIT License
14
15
  Classifier: Intended Audience :: Science/Research
15
16
  Classifier: Operating System :: OS Independent
16
17
  Classifier: Topic :: Scientific/Engineering
17
- Requires-Python: >=3.8
18
+ Requires-Python: >=3.9
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE.txt
20
21
  Requires-Dist: numpy
@@ -2969,9 +2969,9 @@ class XMLBox(Jp2kBox):
2969
2969
  ----------
2970
2970
  xml : ElementTree
2971
2971
  An ElementTree object already existing in python.
2972
- filename : str or path
2973
- File from which to read XML. If filename is not None, then the xml
2974
- keyword argument must be None.
2972
+ filename : file, str, or pathlib.Path
2973
+ File to read. If filename is not None, then the xml keyword
2974
+ argument must be None.
2975
2975
  """
2976
2976
  super().__init__()
2977
2977
  if filename is not None and xml is not None:
@@ -2981,7 +2981,7 @@ class XMLBox(Jp2kBox):
2981
2981
  )
2982
2982
  raise RuntimeError(msg)
2983
2983
  if filename is not None:
2984
- self.xml = ET.parse(str(filename))
2984
+ self.xml = ET.parse(filename)
2985
2985
  else:
2986
2986
  self.xml = xml
2987
2987
  self.length = length
@@ -886,9 +886,9 @@ class Jp2kr(Jp2kBox):
886
886
  def get_codestream(self, header_only=True):
887
887
  """Retrieve codestream.
888
888
 
889
- This differs from the codestream property in that segment
890
- metadata that lies past the end of the codestream header
891
- can be retrieved.
889
+ This differs from the codestream property in that segment
890
+ metadata that lies past the end of the codestream header
891
+ can be retrieved.
892
892
 
893
893
  Parameters
894
894
  ----------
@@ -20,7 +20,7 @@ from .lib import tiff
20
20
 
21
21
  # Do not change the format of this next line! Doing so risks breaking
22
22
  # setup.py
23
- version = "0.13.6"
23
+ version = "0.13.7"
24
24
 
25
25
  version_tuple = parse(version).release
26
26
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = Glymur
3
- version = 0.13.6
3
+ version = 0.13.7
4
4
  author = 'John Evans'
5
5
  author_email = "John Evans" <jevans667cc@proton.me>
6
6
  license = 'MIT'
@@ -14,6 +14,7 @@ classifiers =
14
14
  Programming Language :: Python :: 3.10
15
15
  Programming Language :: Python :: 3.11
16
16
  Programming Language :: Python :: 3.12
17
+ Programming Language :: Python :: 3.13
17
18
  Programming Language :: Python :: Implementation :: CPython
18
19
  License :: OSI Approved :: MIT License
19
20
  Intended Audience :: Science/Research
@@ -26,7 +27,7 @@ install_requires =
26
27
  numpy
27
28
  lxml
28
29
  packaging
29
- python_requires = >=3.8
30
+ python_requires = >=3.9
30
31
  include_package_data = True
31
32
  zip_safe = False
32
33
 
@@ -4,8 +4,9 @@ Test suite specifically targeting the JP2 XML box layout.
4
4
  """
5
5
  # Standard library imports
6
6
  import importlib.resources as ir
7
- from io import BytesIO
7
+ from io import BytesIO, StringIO
8
8
  import pathlib
9
+ import shutil
9
10
  import struct
10
11
  import warnings
11
12
 
@@ -30,35 +31,11 @@ class TestXML(fixtures.TestCommon):
30
31
  def setUp(self):
31
32
  super().setUp()
32
33
 
33
- raw_xml = b"""<?xml version="1.0"?>
34
- <data>
35
- <country name="Liechtenstein">
36
- <rank>1</rank>
37
- <year>2008</year>
38
- <gdppc>141100</gdppc>
39
- <neighbor name="Austria" direction="E"/>
40
- <neighbor name="Switzerland" direction="W"/>
41
- </country>
42
- <country name="Singapore">
43
- <rank>4</rank>
44
- <year>2011</year>
45
- <gdppc>59900</gdppc>
46
- <neighbor name="Malaysia" direction="N"/>
47
- </country>
48
- <country name="Panama">
49
- <rank>68</rank>
50
- <year>2011</year>
51
- <gdppc>13600</gdppc>
52
- <neighbor name="Costa Rica" direction="W"/>
53
- <neighbor name="Colombia" direction="E"/>
54
- </country>
55
- </data>"""
56
- path = self.test_dir_path / 'data.xml'
57
- with path.open(mode='wb') as tfile:
58
- tfile.write(raw_xml)
59
- tfile.flush()
60
- self.xmlfile_path = path
61
- self.xmlfile = str(path)
34
+ p = ir.files('tests.data').joinpath('countries.xml')
35
+ dest_path = self.test_dir_path / 'data.xml'
36
+ shutil.copyfile(p, dest_path)
37
+ self.xmlfile_path = dest_path
38
+ self.xmlfile = str(dest_path)
62
39
 
63
40
  j2k = Jp2k(self.j2kfile)
64
41
  codestream = j2k.get_codestream()
@@ -134,6 +111,40 @@ class TestXML(fixtures.TestCommon):
134
111
  self.assertEqual(neighbor.attrib['name'], 'Malaysia')
135
112
  self.assertEqual(neighbor.attrib['direction'], 'N')
136
113
 
114
+ def test_xml_from_bytesio_object(self):
115
+ """
116
+ SCENARIO: Create an xml box by pointing at a file-like BytesIO object
117
+
118
+ EXPECTED RESULT: The xml box is validated.
119
+ """
120
+ btext = self.xmlfile_path.read_bytes()
121
+ b = BytesIO(btext)
122
+ box = glymur.jp2box.XMLBox(filename=b)
123
+
124
+ elts = box.xml.findall('country')
125
+ self.assertEqual(len(elts), 3)
126
+
127
+ neighbor = elts[1].find('neighbor')
128
+ self.assertEqual(neighbor.attrib['name'], 'Malaysia')
129
+ self.assertEqual(neighbor.attrib['direction'], 'N')
130
+
131
+ def test_xml_from_stringio_object(self):
132
+ """
133
+ SCENARIO: Create an xml box by pointing at a file-like StringIO object
134
+
135
+ EXPECTED RESULT: The xml box is validated.
136
+ """
137
+ text = self.xmlfile_path.read_text()
138
+ sio = StringIO(text)
139
+ box = glymur.jp2box.XMLBox(filename=sio)
140
+
141
+ elts = box.xml.findall('country')
142
+ self.assertEqual(len(elts), 3)
143
+
144
+ neighbor = elts[1].find('neighbor')
145
+ self.assertEqual(neighbor.attrib['name'], 'Malaysia')
146
+ self.assertEqual(neighbor.attrib['direction'], 'N')
147
+
137
148
  def test_utf8_xml_from_xml_file(self):
138
149
  """
139
150
  XMLBox from an XML file with encoding declaration.
@@ -1074,7 +1074,8 @@ class TestPrinting(fixtures.TestCommon):
1074
1074
  "array([ 0, 10, 20, ..., 70, 80, 90], dtype=uint32)),\n"
1075
1075
  " ('ExifTag', OrderedDict([('Make', 'HTC')]))])" # noqa : E501
1076
1076
  )
1077
- self.assertEqual(actual, expected)
1077
+ # Numpy 2.x adds shape to string representation
1078
+ self.assertEqual(actual.replace("shape=(10,), ", ""), expected)
1078
1079
 
1079
1080
  def test_crg(self):
1080
1081
  """verify printing of CRG segment"""
@@ -12,6 +12,7 @@ from uuid import UUID
12
12
  import warnings
13
13
 
14
14
  # 3rd party library imports
15
+ from PIL import Image
15
16
  import numpy as np
16
17
  import skimage
17
18
 
@@ -193,6 +194,17 @@ class TestSuite(fixtures.TestCommon):
193
194
 
194
195
  cls.exif = path
195
196
 
197
+ def _imread(self, path, mode=None):
198
+
199
+ with Image.open(path) as img:
200
+
201
+ if mode is not None:
202
+ img = img.convert(mode)
203
+
204
+ imagedata = np.array(img)
205
+
206
+ return imagedata
207
+
196
208
  def test_smoke(self):
197
209
  """
198
210
  SCENARIO: Convert TIFF file to JP2
@@ -355,7 +367,7 @@ class TestSuite(fixtures.TestCommon):
355
367
  j.layer = layer
356
368
  d[layer] = j[:]
357
369
 
358
- truth = skimage.io.imread(self.moon)
370
+ truth = self._imread(self.moon)
359
371
 
360
372
  with warnings.catch_warnings():
361
373
  # MSE is zero for that first image, resulting in a divide-by-zero
@@ -394,7 +406,7 @@ class TestSuite(fixtures.TestCommon):
394
406
  j.layer = layer
395
407
  d[layer] = j[:]
396
408
 
397
- truth = skimage.io.imread(self.moon)
409
+ truth = self._imread(self.moon)
398
410
 
399
411
  with warnings.catch_warnings():
400
412
  # MSE is zero for that first image, resulting in a divide-by-zero
@@ -632,9 +644,7 @@ class TestSuite(fixtures.TestCommon):
632
644
 
633
645
  jp2 = Jp2k(self.temp_jp2_filename)
634
646
  actual = jp2[:]
635
- expected = skimage.io.imread(
636
- self.moon3_partial_last_strip, plugin='pil'
637
- )
647
+ expected = self._imread(self.moon3_partial_last_strip)
638
648
  np.testing.assert_array_equal(actual, expected)
639
649
 
640
650
  c = jp2.get_codestream()
@@ -660,9 +670,8 @@ class TestSuite(fixtures.TestCommon):
660
670
  jp2 = Jp2k(self.temp_jp2_filename)
661
671
  actual = jp2[:]
662
672
 
663
- expected = skimage.io.imread(
664
- self.moon3_partial_last_strip, plugin='pil'
665
- )
673
+ expected = self._imread(self.moon3_partial_last_strip)
674
+
666
675
  np.testing.assert_array_equal(actual, expected)
667
676
 
668
677
  c = jp2.get_codestream()
@@ -813,7 +822,7 @@ class TestSuite(fixtures.TestCommon):
813
822
 
814
823
  jp2 = Jp2k(self.temp_jp2_filename)
815
824
  actual = jp2[:]
816
- expected = skimage.io.imread(self.ycbcr_stripped, plugin='pil')
825
+ expected = self._imread(self.ycbcr_stripped)
817
826
  np.testing.assert_array_equal(actual, expected)
818
827
 
819
828
  c = jp2.get_codestream()
@@ -836,7 +845,7 @@ class TestSuite(fixtures.TestCommon):
836
845
 
837
846
  jp2 = Jp2k(self.temp_jp2_filename)
838
847
  actual = jp2[:]
839
- expected = skimage.io.imread(self.ycbcr_bg, plugin='pil')
848
+ expected = self._imread(self.ycbcr_bg)
840
849
  np.testing.assert_array_equal(actual, expected)
841
850
 
842
851
  c = jp2.get_codestream()
@@ -883,9 +892,8 @@ class TestSuite(fixtures.TestCommon):
883
892
 
884
893
  jp2 = Jp2k(self.temp_jp2_filename)
885
894
  actual = jp2[:]
886
- expected = skimage.io.imread(
887
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
888
- )
895
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
896
+
889
897
  np.testing.assert_array_equal(actual, expected)
890
898
 
891
899
  c = jp2.get_codestream()
@@ -909,9 +917,7 @@ class TestSuite(fixtures.TestCommon):
909
917
 
910
918
  jp2 = Jp2k(self.temp_jp2_filename)
911
919
  actual = jp2[:]
912
- expected = skimage.io.imread(
913
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
914
- )
920
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
915
921
  np.testing.assert_array_equal(actual, expected)
916
922
 
917
923
  c = jp2.get_codestream()
@@ -934,9 +940,7 @@ class TestSuite(fixtures.TestCommon):
934
940
 
935
941
  jp2 = Jp2k(self.temp_jp2_filename)
936
942
  actual = jp2[:]
937
- expected = skimage.io.imread(
938
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
939
- )
943
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
940
944
  np.testing.assert_array_equal(actual, expected)
941
945
 
942
946
  c = jp2.get_codestream()
@@ -1836,9 +1840,7 @@ class TestSuite(fixtures.TestCommon):
1836
1840
  # Read in the image (as expected on little-endian), flip it
1837
1841
  # around, prepend an alpha layer, then get rid of the last layer
1838
1842
  # to simulate what would have happened on big-endian.
1839
- expected = skimage.io.imread(
1840
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
1841
- )
1843
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
1842
1844
  h, w, _ = expected.shape
1843
1845
  expected = np.flip(expected, axis=2)
1844
1846
  A = np.ones((h, w, 1), dtype=np.uint8) * 255
@@ -1874,9 +1876,7 @@ class TestSuite(fixtures.TestCommon):
1874
1876
  # Read in the image (as expected on little-endian), flip it
1875
1877
  # around, prepend an alpha layer, then get rid of the last layer
1876
1878
  # to simulate what would have happened on big-endian.
1877
- expected = skimage.io.imread(
1878
- self.astronaut_ycbcr_jpeg_tiled, plugin='pil'
1879
- )
1879
+ expected = self._imread(self.astronaut_ycbcr_jpeg_tiled)
1880
1880
  h, w, _ = expected.shape
1881
1881
  expected = np.flip(expected, axis=2)
1882
1882
  A = np.ones((h, w, 1), dtype=np.uint8) * 255
@@ -1912,7 +1912,7 @@ class TestSuite(fixtures.TestCommon):
1912
1912
  # Read in the image (as expected on little-endian), flip it
1913
1913
  # around, prepend an alpha layer, then get rid of the last layer
1914
1914
  # to simulate what would have happened on big-endian.
1915
- expected = skimage.io.imread(self.ycbcr_stripped, plugin='pil')
1915
+ expected = self._imread(self.ycbcr_stripped)
1916
1916
  h, w, _ = expected.shape
1917
1917
  expected = np.flip(expected, axis=2)
1918
1918
  A = np.ones((h, w, 1), dtype=np.uint8) * 255
@@ -1935,7 +1935,7 @@ class TestSuite(fixtures.TestCommon):
1935
1935
 
1936
1936
  jp2 = Jp2k(self.temp_jp2_filename)
1937
1937
  actual = jp2[:]
1938
- expected = skimage.io.imread(self.moon63)
1938
+ expected = self._imread(self.moon63)
1939
1939
  np.testing.assert_array_equal(actual, expected)
1940
1940
 
1941
1941
  c = jp2.get_codestream()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes