ponkan-python 0.2.0__tar.gz → 0.2.1__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 (86) hide show
  1. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/PKG-INFO +2 -2
  2. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/docs/api.md +1 -1
  3. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/pyproject.toml +1 -1
  4. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/streaming/engine.py +14 -8
  5. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_streaming_engine_fake_async.py +16 -0
  6. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/.gitignore +0 -0
  7. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/LICENSE +0 -0
  8. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/NOTICE.md +0 -0
  9. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/README.md +0 -0
  10. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/docs/publishing.md +0 -0
  11. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/__init__.py +0 -0
  12. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/artifacts.py +0 -0
  13. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/capture.py +0 -0
  14. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/devices/__init__.py +0 -0
  15. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/devices/discovery.py +0 -0
  16. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/devices/n3dsxl_ftd3.py +0 -0
  17. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/errors.py +0 -0
  18. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/hardware_gate.py +0 -0
  19. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/image/__init__.py +0 -0
  20. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/image/frame.py +0 -0
  21. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/layouts.py +0 -0
  22. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/profiles.py +0 -0
  23. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/protocol/__init__.py +0 -0
  24. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/protocol/layout_3ds.py +0 -0
  25. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/protocol/n3dsxl.py +0 -0
  26. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/protocol/sizes.py +0 -0
  27. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/py.typed +0 -0
  28. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/streaming/__init__.py +0 -0
  29. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/streaming/buffers.py +0 -0
  30. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/streaming/policies.py +0 -0
  31. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/streaming/stats.py +0 -0
  32. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/tools/__init__.py +0 -0
  33. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/tools/capture_raw.py +0 -0
  34. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/tools/list_devices.py +0 -0
  35. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/tools/raw_to_png.py +0 -0
  36. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/tools/stream_n3dsxl.py +0 -0
  37. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/__init__.py +0 -0
  38. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/d3xx_backend.py +0 -0
  39. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/d3xx_native.py +0 -0
  40. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/d3xx_native_streaming.py +0 -0
  41. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/d3xx_streaming.py +0 -0
  42. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/ftd3_backend.py +0 -0
  43. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/ftd3_pipe.py +0 -0
  44. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/libusb_async.py +0 -0
  45. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/src/ponkan/transport/libusb_backend.py +0 -0
  46. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/conftest.py +0 -0
  47. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/README.md +0 -0
  48. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_connect.py +0 -0
  49. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_d3xx_backend.py +0 -0
  50. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_d3xx_native_streaming.py +0 -0
  51. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_ftd3_pipe.py +0 -0
  52. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_high_level_capture_read_api.py +0 -0
  53. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_open_close.py +0 -0
  54. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_raw_capture.py +0 -0
  55. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/e2e/test_n3dsxl_streaming.py +0 -0
  56. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/manual/test_n3dsxl_decoder_visual.py +0 -0
  57. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/performance/README.md +0 -0
  58. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/performance/test_n3dsxl_d3xx_native_streaming_smoke.py +0 -0
  59. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/performance/test_n3dsxl_streaming_smoke.py +0 -0
  60. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_capture_device_discovery.py +0 -0
  61. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_capture_layout_metadata.py +0 -0
  62. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_capture_profiles.py +0 -0
  63. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_codex_pre_tool_use_policy.py +0 -0
  64. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_d3xx_backend.py +0 -0
  65. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_d3xx_native_api.py +0 -0
  66. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_d3xx_native_streaming_backend.py +0 -0
  67. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_d3xx_streaming_backend.py +0 -0
  68. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_ftd3_backend_selector.py +0 -0
  69. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_ftd3_pipe_payloads.py +0 -0
  70. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_hardware_gate.py +0 -0
  71. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_high_level_capture_read_api.py +0 -0
  72. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_layout_3ds_decoder.py +0 -0
  73. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_libusb_backend.py +0 -0
  74. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_n3dsxl_artifacts.py +0 -0
  75. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_n3dsxl_connect_sequence.py +0 -0
  76. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_n3dsxl_device_filter.py +0 -0
  77. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_n3dsxl_list_devices_cli.py +0 -0
  78. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_n3dsxl_session.py +0 -0
  79. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_n3dsxl_sizes.py +0 -0
  80. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_package.py +0 -0
  81. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_raw_capture_metadata.py +0 -0
  82. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_stream_n3dsxl_cli.py +0 -0
  83. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_streaming_buffers.py +0 -0
  84. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_streaming_performance_stats.py +0 -0
  85. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_streaming_policies.py +0 -0
  86. {ponkan_python-0.2.0 → ponkan_python-0.2.1}/tests/unit/test_structured_capture_errors.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: ponkan-python
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A Python capture library focused on new 3DS XL capture board frame acquisition.
5
5
  Project-URL: Documentation, https://github.com/niart120/ponkan-python/blob/master/docs/api.md
6
6
  Project-URL: Homepage, https://github.com/niart120/ponkan-python
@@ -244,7 +244,7 @@ if frame is not None:
244
244
  ```
245
245
 
246
246
  `CaptureReader.stats()` returns a `StreamStats` snapshot from the underlying
247
- streaming engine. `CaptureReader.close()` is idempotent and stops acquisition.
247
+ streaming engine. `CaptureReader.close()` is idempotent and releases the backend even before the first read.
248
248
 
249
249
  Backend selection note: starting with the current unreleased changes,
250
250
  `backend="auto"` shares the discovery resolver and uses `"d3xx-native"` on
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ponkan-python"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "A Python capture library focused on new 3DS XL capture board frame acquisition."
5
5
  readme = { file = "README.md", content-type = "text/markdown" }
6
6
  authors = [
@@ -63,6 +63,7 @@ class StreamingEngine:
63
63
  self._stats = StreamStats()
64
64
  self._completion_queue: queue.Queue[RawFrameResult] = queue.Queue(maxsize=raw_slots)
65
65
  self._running = False
66
+ self._released = False
66
67
  self._next_sequence = 0
67
68
  self._timing = StreamTimingCollector() if collect_timing else None
68
69
 
@@ -72,6 +73,9 @@ class StreamingEngine:
72
73
  The method is idempotent while already running. Each slot is checked out
73
74
  and submitted once.
74
75
  """
76
+ if self._released:
77
+ message = "streaming backend has already been released"
78
+ raise RuntimeError(message)
75
79
  if self._running:
76
80
  return
77
81
  self._running = True
@@ -86,16 +90,18 @@ class StreamingEngine:
86
90
  shutdown drains using the backend's own semantics.
87
91
  """
88
92
  _ = timeout
89
- if not self._running and self.buffer_pool.in_use_count() == 0:
93
+ if self._released:
90
94
  return
91
- self._running = False
92
- self._stats.cancelled += self.buffer_pool.in_use_count()
93
- self.backend.cancel_all()
94
- self.backend.drain()
95
- for slot in self.buffer_pool.slots:
96
- if slot.in_use:
97
- self.buffer_pool.release(slot.index)
95
+ if self._running or self.buffer_pool.in_use_count():
96
+ self._running = False
97
+ self._stats.cancelled += self.buffer_pool.in_use_count()
98
+ self.backend.cancel_all()
99
+ self.backend.drain()
100
+ for slot in self.buffer_pool.slots:
101
+ if slot.in_use:
102
+ self.buffer_pool.release(slot.index)
98
103
  self.backend.release()
104
+ self._released = True
99
105
 
100
106
  def process_completed(self, *, limit: int | None = None) -> int:
101
107
  """Decode completed raw results outside the callback.
@@ -4,6 +4,7 @@ import time
4
4
  import numpy as np
5
5
  import pytest
6
6
 
7
+ from ponkan.capture import CaptureReader
7
8
  from ponkan.image.frame import CaptureFrame
8
9
  from ponkan.protocol.sizes import BOTTOM_WIDTH_3DS, HEIGHT_3DS, TOP_WIDTH_3DS, video_size
9
10
  from ponkan.streaming.buffers import RawFrameSlot
@@ -288,3 +289,18 @@ def test_stop_uses_cancel_drain_release_order() -> None:
288
289
  assert backend.calls[-3:] == ["cancel_all", "drain", "release"]
289
290
  assert engine.buffer_pool.in_use_count() == 0
290
291
  assert engine.stats().cancelled == 2
292
+
293
+
294
+ def test_reader_closed_before_first_read_releases_owned_backend_once() -> None:
295
+ backend = _FakeAsyncBackend()
296
+ engine = StreamingEngine(backend)
297
+ reader = CaptureReader(engine)
298
+
299
+ reader.close()
300
+ assert backend.calls == ["release"]
301
+ engine.stop()
302
+
303
+ assert backend.calls.count("release") == 1
304
+ with pytest.raises(RuntimeError, match="released"):
305
+ engine.start()
306
+ assert not backend.submitted
File without changes
File without changes
File without changes
File without changes