pyisyntax 0.1.2__tar.gz → 0.1.3__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 (75) hide show
  1. pyisyntax-0.1.3/CHANGELOG.md +57 -0
  2. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/MANIFEST.in +1 -0
  3. {pyisyntax-0.1.2/pyisyntax.egg-info → pyisyntax-0.1.3}/PKG-INFO +6 -1
  4. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax/wrapper.py +4 -0
  5. {pyisyntax-0.1.2 → pyisyntax-0.1.3/pyisyntax.egg-info}/PKG-INFO +6 -1
  6. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/pyisyntax.egg-info/SOURCES.txt +1 -0
  7. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/pyproject.toml +11 -1
  8. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/tests/test_wrapper.py +23 -0
  9. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/LICENSE +0 -0
  10. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/README.md +0 -0
  11. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax/__init__.py +0 -0
  12. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax/lowlevel/__init__.py +0 -0
  13. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax/lowlevel/io_management.py +0 -0
  14. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax/lowlevel/libisyntax.py +0 -0
  15. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/__init__.py +0 -0
  16. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/builder.py +0 -0
  17. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/pyisyntax.c +0 -0
  18. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/src/python_platform_utils.c +0 -0
  19. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/src/python_platform_utils.h +0 -0
  20. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/src/win32_utils.c +0 -0
  21. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/LICENSE.txt +0 -0
  22. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/README.md +0 -0
  23. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/examples/isyntax_example.c +0 -0
  24. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/examples/isyntax_to_tiff.c +0 -0
  25. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax.c +0 -0
  26. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax.h +0 -0
  27. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_dwt.c +0 -0
  28. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_reader.c +0 -0
  29. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_reader.h +0 -0
  30. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_streamer.c +0 -0
  31. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_streamer.h +0 -0
  32. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/libisyntax.c +0 -0
  33. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/libisyntax.h +0 -0
  34. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/arena.h +0 -0
  35. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/common.h +0 -0
  36. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/intrinsics.h +0 -0
  37. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/linux_platform.c +0 -0
  38. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/linux_utils.c +0 -0
  39. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/platform.c +0 -0
  40. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/platform.h +0 -0
  41. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/win32_utils.c +0 -0
  42. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/win32_utils.h +0 -0
  43. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/work_queue.c +0 -0
  44. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/platform/work_queue.h +0 -0
  45. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/ltalloc.cc +0 -0
  46. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/ltalloc.h +0 -0
  47. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/stb_ds.h +0 -0
  48. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/stb_image.h +0 -0
  49. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/stb_image_write.h +0 -0
  50. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/stb_sprintf.h +0 -0
  51. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/yxml.c +0 -0
  52. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/third_party/yxml.h +0 -0
  53. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/benaphore.c +0 -0
  54. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/benaphore.h +0 -0
  55. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/block_allocator.c +0 -0
  56. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/block_allocator.h +0 -0
  57. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/libtiff_api.h +0 -0
  58. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/mathutils.c +0 -0
  59. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/mathutils.h +0 -0
  60. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/memrw.c +0 -0
  61. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/memrw.h +0 -0
  62. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/stringutils.c +0 -0
  63. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/stringutils.h +0 -0
  64. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/timerutils.c +0 -0
  65. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/isyntax_build/vendor/libisyntax/src/utils/timerutils.h +0 -0
  66. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/pyisyntax.egg-info/dependency_links.txt +0 -0
  67. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/pyisyntax.egg-info/not-zip-safe +0 -0
  68. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/pyisyntax.egg-info/requires.txt +0 -0
  69. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/pyisyntax.egg-info/top_level.txt +0 -0
  70. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/setup.cfg +0 -0
  71. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/setup.py +0 -0
  72. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/tests/__init__.py +0 -0
  73. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/tests/conftest.py +0 -0
  74. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/tests/data/DOWNLOAD.txt +0 -0
  75. {pyisyntax-0.1.2 → pyisyntax-0.1.3}/tests/test_lowlevel.py +0 -0
@@ -0,0 +1,57 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.3] - 2024-03-28
11
+
12
+ ### Added
13
+
14
+ - This CHANGELOG file.
15
+
16
+ ### Fixed
17
+
18
+ - Gracefully exit the contextmanager when an ISyntax file fails to open
19
+ ([#8](https://github.com/anibali/pyisyntax/issues/8)).
20
+ - Release reference to the associated cache object when an ISyntax object is closed
21
+ so that it can be garbage collected and destroyed
22
+ ([#9](https://github.com/anibali/pyisyntax/issues/9)).
23
+
24
+ ## [0.1.2] - 2024-03-25
25
+
26
+ ### Added
27
+
28
+ - Configuration option to set the cache size
29
+ ([#5](https://github.com/anibali/pyisyntax/issues/5)).
30
+
31
+ ### Changed
32
+
33
+ - Nest the `_pyisyntax` binary library file under the `isyntax` top-level
34
+ namespace.
35
+ - Bump the `libisyntax` submodule commit and match their API changes
36
+ (thanks @erikogabrielsson).
37
+
38
+ ## [0.1.1] - 2024-03-02
39
+
40
+ ### Changed
41
+
42
+ - Return `None` when an associated image/colour profile is not present.
43
+ - Reduce the number of provided wheels by using `py_limited_api`.
44
+ Multiple Python versions will continue being tested during CI through
45
+ the use of `tox`.
46
+
47
+ ## [0.1.0] - 2024-02-26
48
+
49
+ ### Added
50
+
51
+ - This is the initial release.
52
+
53
+ [unreleased]: https://github.com/anibali/pyisyntax/compare/v0.1.3...HEAD
54
+ [0.1.3]: https://github.com/anibali/pyisyntax/compare/v0.1.2...v0.1.3
55
+ [0.1.2]: https://github.com/anibali/pyisyntax/compare/v0.1.1...v0.1.2
56
+ [0.1.1]: https://github.com/anibali/pyisyntax/compare/v0.1.0...v0.1.1
57
+ [0.1.0]: https://github.com/anibali/pyisyntax/releases/tag/v0.1.0
@@ -1,5 +1,6 @@
1
1
  include README.md
2
2
  include LICENSE
3
+ include CHANGELOG.md
3
4
 
4
5
  graft isyntax_build
5
6
  prune isyntax_build/vendor/libisyntax
@@ -1,9 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyisyntax
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Python bindings for libisyntax
5
5
  Author-email: Aiden Nibali <dismaldenizen@gmail.com>
6
6
  License: MIT
7
+ Project-URL: homepage, https://github.com/anibali/pyisyntax
8
+ Project-URL: source, https://github.com/anibali/pyisyntax
9
+ Project-URL: download, https://pypi.org/project/pyisyntax/#files
10
+ Project-URL: tracker, https://github.com/anibali/pyisyntax/issues
11
+ Project-URL: release notes, https://github.com/anibali/pyisyntax/blob/master/CHANGELOG.md
7
12
  Requires-Python: >=3.10
8
13
  Description-Content-Type: text/markdown
9
14
  License-File: LICENSE
@@ -79,6 +79,9 @@ class ISyntaxImage:
79
79
 
80
80
  class ISyntax:
81
81
  def __init__(self, f: RawIOBase | BufferedIOBase, n_bytes: int, cache_size: int = 2000) -> None:
82
+ # Start in the "closed" for a graceful contextmanager exit when the file
83
+ # fails to open.
84
+ self.closed = True
82
85
  self.io_handle = register_io(f, n_bytes)
83
86
  self.ptr = libisyntax.open_from_registered_handle(self.io_handle, is_init_allocators=False)
84
87
  self.closed = False
@@ -96,6 +99,7 @@ class ISyntax:
96
99
  if self.closed:
97
100
  return
98
101
  libisyntax.close(self.ptr)
102
+ self._cache = None
99
103
  self.closed = True
100
104
 
101
105
  @property
@@ -1,9 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyisyntax
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Python bindings for libisyntax
5
5
  Author-email: Aiden Nibali <dismaldenizen@gmail.com>
6
6
  License: MIT
7
+ Project-URL: homepage, https://github.com/anibali/pyisyntax
8
+ Project-URL: source, https://github.com/anibali/pyisyntax
9
+ Project-URL: download, https://pypi.org/project/pyisyntax/#files
10
+ Project-URL: tracker, https://github.com/anibali/pyisyntax/issues
11
+ Project-URL: release notes, https://github.com/anibali/pyisyntax/blob/master/CHANGELOG.md
7
12
  Requires-Python: >=3.10
8
13
  Description-Content-Type: text/markdown
9
14
  License-File: LICENSE
@@ -1,3 +1,4 @@
1
+ CHANGELOG.md
1
2
  LICENSE
2
3
  MANIFEST.in
3
4
  README.md
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyisyntax"
3
- version = "0.1.2"
3
+ version = "0.1.3"
4
4
  description = "Python bindings for libisyntax"
5
5
  readme = { content-type = "text/markdown", file = "README.md" }
6
6
  authors = [{ name = "Aiden Nibali", email = "dismaldenizen@gmail.com" }]
@@ -11,6 +11,13 @@ dependencies = [
11
11
  "numpy",
12
12
  ]
13
13
 
14
+ [project.urls]
15
+ homepage = "https://github.com/anibali/pyisyntax"
16
+ source = "https://github.com/anibali/pyisyntax"
17
+ download = "https://pypi.org/project/pyisyntax/#files"
18
+ tracker = "https://github.com/anibali/pyisyntax/issues"
19
+ "release notes" = "https://github.com/anibali/pyisyntax/blob/master/CHANGELOG.md"
20
+
14
21
  [project.optional-dependencies]
15
22
  dev = [
16
23
  "conda-lock",
@@ -62,6 +69,9 @@ pydocstyle.convention = "google"
62
69
  [tool.pyright]
63
70
  typeCheckingMode = "standard"
64
71
 
72
+ [tool.pytest.ini_options]
73
+ addopts = "-Werror"
74
+
65
75
  [tool.tox]
66
76
  legacy_tox_ini = """
67
77
  [tox]
@@ -1,3 +1,5 @@
1
+ import gc
2
+ import io
1
3
  from collections.abc import Iterator
2
4
  from pathlib import Path
3
5
 
@@ -85,6 +87,7 @@ class TestISyntax:
85
87
  def test_read_label_image_jpeg(self, isyntax: ISyntax, mocker: MockerFixture) -> None:
86
88
  free_spy = mocker.spy(libisyntax, "free")
87
89
  jpeg_data = isyntax.read_label_image_jpeg()
90
+ assert jpeg_data is not None
88
91
  jpeg_magic = b"\xff\xd8"
89
92
  assert jpeg_data[:2] == jpeg_magic
90
93
  expected_size = 60348
@@ -98,6 +101,7 @@ class TestISyntax:
98
101
  def test_read_macro_image_jpeg(self, isyntax: ISyntax, mocker: MockerFixture) -> None:
99
102
  free_spy = mocker.spy(libisyntax, "free")
100
103
  jpeg_data = isyntax.read_macro_image_jpeg()
104
+ assert jpeg_data is not None
101
105
  jpeg_magic = b"\xff\xd8"
102
106
  assert jpeg_data[:2] == jpeg_magic
103
107
  expected_size = 49625
@@ -107,3 +111,22 @@ class TestISyntax:
107
111
  free_spy.assert_not_called()
108
112
  del jpeg_data
109
113
  free_spy.assert_called_once()
114
+
115
+ def test_close_is_idempotent(self, isyntax: ISyntax) -> None:
116
+ isyntax.close()
117
+ isyntax.close()
118
+ assert isyntax.closed
119
+
120
+ def test_cache_is_destroyed_on_close(self, isyntax: ISyntax, mocker: MockerFixture) -> None:
121
+ destroy_spy = mocker.spy(libisyntax, "cache_destroy")
122
+ # Reading image data causes the cache to be created.
123
+ isyntax.read_region(500, 500, 1, 1, level=4)
124
+ destroy_spy.assert_not_called()
125
+ isyntax.close()
126
+ gc.collect()
127
+ destroy_spy.assert_called_once()
128
+
129
+ def test_closes_after_error_from_contextmanager(self) -> None:
130
+ f = io.BytesIO()
131
+ with pytest.raises(libisyntax.LibISyntaxFatalError), ISyntax(f, 0):
132
+ pass
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes