pyisyntax 0.1.2__tar.gz → 0.1.4__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.4/CHANGELOG.md +69 -0
  2. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/MANIFEST.in +1 -0
  3. {pyisyntax-0.1.2/pyisyntax.egg-info → pyisyntax-0.1.4}/PKG-INFO +6 -1
  4. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax/lowlevel/libisyntax.py +4 -0
  5. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax/wrapper.py +8 -0
  6. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/examples/isyntax_to_tiff.c +4 -3
  7. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax.c +180 -87
  8. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax.h +11 -2
  9. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_streamer.c +77 -23
  10. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/libisyntax.c +4 -0
  11. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/libisyntax.h +2 -1
  12. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/ltalloc.cc +12 -3
  13. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/mathutils.c +5 -3
  14. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/mathutils.h +14 -7
  15. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/stringutils.c +2 -2
  16. {pyisyntax-0.1.2 → pyisyntax-0.1.4/pyisyntax.egg-info}/PKG-INFO +6 -1
  17. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/pyisyntax.egg-info/SOURCES.txt +1 -0
  18. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/pyproject.toml +14 -1
  19. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/tests/test_lowlevel.py +5 -0
  20. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/tests/test_wrapper.py +27 -0
  21. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/LICENSE +0 -0
  22. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/README.md +0 -0
  23. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax/__init__.py +0 -0
  24. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax/lowlevel/__init__.py +0 -0
  25. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax/lowlevel/io_management.py +0 -0
  26. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/__init__.py +0 -0
  27. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/builder.py +0 -0
  28. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/pyisyntax.c +0 -0
  29. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/src/python_platform_utils.c +0 -0
  30. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/src/python_platform_utils.h +0 -0
  31. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/src/win32_utils.c +0 -0
  32. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/LICENSE.txt +0 -0
  33. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/README.md +0 -0
  34. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/examples/isyntax_example.c +0 -0
  35. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_dwt.c +0 -0
  36. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_reader.c +0 -0
  37. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_reader.h +0 -0
  38. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_streamer.h +0 -0
  39. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/arena.h +0 -0
  40. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/common.h +0 -0
  41. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/intrinsics.h +0 -0
  42. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/linux_platform.c +0 -0
  43. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/linux_utils.c +0 -0
  44. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/platform.c +0 -0
  45. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/platform.h +0 -0
  46. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/win32_utils.c +0 -0
  47. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/win32_utils.h +0 -0
  48. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/work_queue.c +0 -0
  49. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/platform/work_queue.h +0 -0
  50. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/ltalloc.h +0 -0
  51. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/stb_ds.h +0 -0
  52. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/stb_image.h +0 -0
  53. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/stb_image_write.h +0 -0
  54. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/stb_sprintf.h +0 -0
  55. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/yxml.c +0 -0
  56. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/third_party/yxml.h +0 -0
  57. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/benaphore.c +0 -0
  58. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/benaphore.h +0 -0
  59. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/block_allocator.c +0 -0
  60. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/block_allocator.h +0 -0
  61. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/libtiff_api.h +0 -0
  62. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/memrw.c +0 -0
  63. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/memrw.h +0 -0
  64. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/stringutils.h +0 -0
  65. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/timerutils.c +0 -0
  66. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/isyntax_build/vendor/libisyntax/src/utils/timerutils.h +0 -0
  67. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/pyisyntax.egg-info/dependency_links.txt +0 -0
  68. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/pyisyntax.egg-info/not-zip-safe +0 -0
  69. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/pyisyntax.egg-info/requires.txt +0 -0
  70. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/pyisyntax.egg-info/top_level.txt +0 -0
  71. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/setup.cfg +0 -0
  72. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/setup.py +0 -0
  73. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/tests/__init__.py +0 -0
  74. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/tests/conftest.py +0 -0
  75. {pyisyntax-0.1.2 → pyisyntax-0.1.4}/tests/data/DOWNLOAD.txt +0 -0
@@ -0,0 +1,69 @@
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.4] - 2024-08-31
11
+
12
+ ### Added
13
+
14
+ - Support for reading the slide barcode. The barcode string can be accessed via
15
+ the `barcode` property of an `ISyntax` instance.
16
+
17
+ ### Changed
18
+
19
+ - Bump the `libisyntax` submodule commit.
20
+
21
+ ## [0.1.3] - 2024-03-28
22
+
23
+ ### Added
24
+
25
+ - This CHANGELOG file.
26
+
27
+ ### Fixed
28
+
29
+ - Gracefully exit the contextmanager when an ISyntax file fails to open
30
+ ([#8](https://github.com/anibali/pyisyntax/issues/8)).
31
+ - Release reference to the associated cache object when an ISyntax object is closed
32
+ so that it can be garbage collected and destroyed
33
+ ([#9](https://github.com/anibali/pyisyntax/issues/9)).
34
+
35
+ ## [0.1.2] - 2024-03-25
36
+
37
+ ### Added
38
+
39
+ - Configuration option to set the cache size
40
+ ([#5](https://github.com/anibali/pyisyntax/issues/5)).
41
+
42
+ ### Changed
43
+
44
+ - Nest the `_pyisyntax` binary library file under the `isyntax` top-level
45
+ namespace.
46
+ - Bump the `libisyntax` submodule commit and match their API changes
47
+ (thanks @erikogabrielsson).
48
+
49
+ ## [0.1.1] - 2024-03-02
50
+
51
+ ### Changed
52
+
53
+ - Return `None` when an associated image/colour profile is not present.
54
+ - Reduce the number of provided wheels by using `py_limited_api`.
55
+ Multiple Python versions will continue being tested during CI through
56
+ the use of `tox`.
57
+
58
+ ## [0.1.0] - 2024-02-26
59
+
60
+ ### Added
61
+
62
+ - This is the initial release.
63
+
64
+ [unreleased]: https://github.com/anibali/pyisyntax/compare/v0.1.4...HEAD
65
+ [0.1.4]: https://github.com/anibali/pyisyntax/compare/v0.1.3...v0.1.4
66
+ [0.1.3]: https://github.com/anibali/pyisyntax/compare/v0.1.2...v0.1.3
67
+ [0.1.2]: https://github.com/anibali/pyisyntax/compare/v0.1.1...v0.1.2
68
+ [0.1.1]: https://github.com/anibali/pyisyntax/compare/v0.1.0...v0.1.1
69
+ [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.4
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
@@ -119,6 +119,10 @@ def get_macro_image(isyntax: ISyntaxPtr) -> ISyntaxImagePtr:
119
119
  return lib.libisyntax_get_macro_image(isyntax)
120
120
 
121
121
 
122
+ def get_barcode(isyntax: ISyntaxPtr) -> bytes:
123
+ return ffi.string(lib.libisyntax_get_barcode(isyntax))
124
+
125
+
122
126
  def image_get_level_count(wsi_image: ISyntaxImagePtr) -> int:
123
127
  return lib.libisyntax_image_get_level_count(wsi_image)
124
128
 
@@ -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
@@ -174,6 +178,10 @@ class ISyntax:
174
178
  except libisyntax.LibISyntaxFatalError:
175
179
  return None
176
180
 
181
+ @property
182
+ def barcode(self) -> str:
183
+ return libisyntax.get_barcode(self.ptr).decode("ascii")
184
+
177
185
  def read_icc_profile(self) -> memoryview | None:
178
186
  """Reads the ICC color profile for an image.
179
187
 
@@ -37,6 +37,7 @@
37
37
  #endif
38
38
 
39
39
  #include <stdint.h>
40
+ #include <inttypes.h>
40
41
  #include <assert.h>
41
42
  #include <stdlib.h>
42
43
  #include <string.h>
@@ -221,7 +222,7 @@ uint64_t parse_cache_size(const char *size_str) {
221
222
  uint64_t size;
222
223
  char unit;
223
224
 
224
- if (sscanf(size_str, "%lld%c", &size, &unit) == 2) {
225
+ if (sscanf(size_str, "%"PRIu64"%c", &size, &unit) == 2) {
225
226
  if (unit == 'M') {
226
227
  if (size > INT64_MAX / (1024)) {
227
228
  printf("Error: Cache size too large.\n");
@@ -238,7 +239,7 @@ uint64_t parse_cache_size(const char *size_str) {
238
239
  printf("Error: Invalid unit for cache size. Use 'M' for megabytes or 'G' for gigabytes.\n");
239
240
  return -1;
240
241
  }
241
- } else if (sscanf(size_str, "%lld", &size) != 1) {
242
+ } else if (sscanf(size_str, "%"PRIu64, &size) != 1) {
242
243
  printf("Error: Invalid cache size format.\n");
243
244
  return -1;
244
245
  }
@@ -426,7 +427,7 @@ int main(int argc, char **argv) {
426
427
 
427
428
  isyntax_cache_t *isyntax_cache = NULL;
428
429
  if (libisyntax_cache_create("isyntax-to-tiff cache", cache_size, &isyntax_cache) != LIBISYNTAX_OK) {
429
- fprintf(stderr, "Failed to create iSyntax cache with size %llu.\n", cache_size);
430
+ fprintf(stderr, "Failed to create iSyntax cache with size %"PRIu64".\n", cache_size);
430
431
  libisyntax_close(isyntax);
431
432
  return -1;
432
433
  }