TwoPy 0.1.1__tar.gz → 0.1.2__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 (120) hide show
  1. {twopy-0.1.1 → twopy-0.1.2}/PKG-INFO +1 -1
  2. {twopy-0.1.1 → twopy-0.1.2}/pyproject.toml +1 -1
  3. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/__init__.py +1 -2
  4. twopy-0.1.2/src/twopy/_version.py +14 -0
  5. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/launcher.py +13 -3
  6. {twopy-0.1.1 → twopy-0.1.2}/src/twopy.egg-info/PKG-INFO +1 -1
  7. {twopy-0.1.1 → twopy-0.1.2}/src/twopy.egg-info/SOURCES.txt +1 -0
  8. {twopy-0.1.1 → twopy-0.1.2}/tests/test_import.py +2 -1
  9. twopy-0.1.2/tests/test_packaging.py +63 -0
  10. twopy-0.1.1/tests/test_packaging.py +0 -32
  11. {twopy-0.1.1 → twopy-0.1.2}/README.md +0 -0
  12. {twopy-0.1.1 → twopy-0.1.2}/setup.cfg +0 -0
  13. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/_segments.py +0 -0
  14. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/__init__.py +0 -0
  15. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/background_subtraction.py +0 -0
  16. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/dff.py +0 -0
  17. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/epoch_mapping.py +0 -0
  18. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/motion.py +0 -0
  19. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/persistence.py +0 -0
  20. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/response_processing/__init__.py +0 -0
  21. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/response_processing/apply.py +0 -0
  22. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/response_processing/options.py +0 -0
  23. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/response_processing/persistence.py +0 -0
  24. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/response_processing/qc.py +0 -0
  25. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/response_processing/signals.py +0 -0
  26. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/responses.py +0 -0
  27. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/trials.py +0 -0
  28. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/analysis/workflow.py +0 -0
  29. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/api.py +0 -0
  30. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/config.py +0 -0
  31. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/__init__.py +0 -0
  32. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/alignment_crop.py +0 -0
  33. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/api.py +0 -0
  34. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/frame_ranges.py +0 -0
  35. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/hdf5_writing.py +0 -0
  36. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/matlab_values.py +0 -0
  37. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/source_loading.py +0 -0
  38. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/stimulus_code.py +0 -0
  39. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/conversion/types.py +0 -0
  40. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/converted.py +0 -0
  41. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/__init__.py +0 -0
  42. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/cache.py +0 -0
  43. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/catalog.py +0 -0
  44. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/connection.py +0 -0
  45. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/generic.py +0 -0
  46. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/modeled.py +0 -0
  47. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/sql.py +0 -0
  48. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/database/types.py +0 -0
  49. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/inspection.py +0 -0
  50. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/matlab.py +0 -0
  51. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/__init__.py +0 -0
  52. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/__main__.py +0 -0
  53. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/constants.py +0 -0
  54. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/controls.py +0 -0
  55. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/display.py +0 -0
  56. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/display_paths.py +0 -0
  57. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/interactive.py +0 -0
  58. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/layout.py +0 -0
  59. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/loading.py +0 -0
  60. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/movie.py +0 -0
  61. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/paths.py +0 -0
  62. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/__init__.py +0 -0
  63. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/data.py +0 -0
  64. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/docks.py +0 -0
  65. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/export.py +0 -0
  66. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/export_controls.py +0 -0
  67. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/label_visibility.py +0 -0
  68. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/options.py +0 -0
  69. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/panels.py +0 -0
  70. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/processing_options.py +0 -0
  71. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/plotting/widgets.py +0 -0
  72. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/protocols.py +0 -0
  73. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/responses.py +0 -0
  74. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/roi.py +0 -0
  75. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/session.py +0 -0
  76. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/state.py +0 -0
  77. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/text.py +0 -0
  78. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/types.py +0 -0
  79. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/napari/viewer.py +0 -0
  80. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/parity/__init__.py +0 -0
  81. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/parity/dff.py +0 -0
  82. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/parity/roi.py +0 -0
  83. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/parity/saved_analysis.py +0 -0
  84. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/photodiode.py +0 -0
  85. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/photodiode_classification.py +0 -0
  86. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/roi.py +0 -0
  87. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/session.py +0 -0
  88. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/spatial.py +0 -0
  89. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/stimulus.py +0 -0
  90. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/synchronization.py +0 -0
  91. {twopy-0.1.1 → twopy-0.1.2}/src/twopy/typing_guards.py +0 -0
  92. {twopy-0.1.1 → twopy-0.1.2}/src/twopy.egg-info/dependency_links.txt +0 -0
  93. {twopy-0.1.1 → twopy-0.1.2}/src/twopy.egg-info/entry_points.txt +0 -0
  94. {twopy-0.1.1 → twopy-0.1.2}/src/twopy.egg-info/requires.txt +0 -0
  95. {twopy-0.1.1 → twopy-0.1.2}/src/twopy.egg-info/top_level.txt +0 -0
  96. {twopy-0.1.1 → twopy-0.1.2}/tests/test_api.py +0 -0
  97. {twopy-0.1.1 → twopy-0.1.2}/tests/test_background_subtraction.py +0 -0
  98. {twopy-0.1.1 → twopy-0.1.2}/tests/test_config.py +0 -0
  99. {twopy-0.1.1 → twopy-0.1.2}/tests/test_conversion.py +0 -0
  100. {twopy-0.1.1 → twopy-0.1.2}/tests/test_converted.py +0 -0
  101. {twopy-0.1.1 → twopy-0.1.2}/tests/test_database.py +0 -0
  102. {twopy-0.1.1 → twopy-0.1.2}/tests/test_dff.py +0 -0
  103. {twopy-0.1.1 → twopy-0.1.2}/tests/test_epoch_mapping.py +0 -0
  104. {twopy-0.1.1 → twopy-0.1.2}/tests/test_inspection.py +0 -0
  105. {twopy-0.1.1 → twopy-0.1.2}/tests/test_matlab.py +0 -0
  106. {twopy-0.1.1 → twopy-0.1.2}/tests/test_motion.py +0 -0
  107. {twopy-0.1.1 → twopy-0.1.2}/tests/test_napari.py +0 -0
  108. {twopy-0.1.1 → twopy-0.1.2}/tests/test_parity.py +0 -0
  109. {twopy-0.1.1 → twopy-0.1.2}/tests/test_persistence.py +0 -0
  110. {twopy-0.1.1 → twopy-0.1.2}/tests/test_photodiode_classification.py +0 -0
  111. {twopy-0.1.1 → twopy-0.1.2}/tests/test_real_fixture.py +0 -0
  112. {twopy-0.1.1 → twopy-0.1.2}/tests/test_response_processing.py +0 -0
  113. {twopy-0.1.1 → twopy-0.1.2}/tests/test_responses.py +0 -0
  114. {twopy-0.1.1 → twopy-0.1.2}/tests/test_roi.py +0 -0
  115. {twopy-0.1.1 → twopy-0.1.2}/tests/test_saved_analysis.py +0 -0
  116. {twopy-0.1.1 → twopy-0.1.2}/tests/test_session.py +0 -0
  117. {twopy-0.1.1 → twopy-0.1.2}/tests/test_stimulus.py +0 -0
  118. {twopy-0.1.1 → twopy-0.1.2}/tests/test_synchronization.py +0 -0
  119. {twopy-0.1.1 → twopy-0.1.2}/tests/test_trials.py +0 -0
  120. {twopy-0.1.1 → twopy-0.1.2}/tests/test_workflow.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: twopy
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Two-photon imaging analysis tool with a napari interface.
5
5
  Author-email: Gustavo Madeira Santana <fromweb1@gumadeiras.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "twopy"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Two-photon imaging analysis tool with a napari interface."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13,<3.14"
@@ -5,6 +5,7 @@ Inputs: none.
5
5
  Outputs: package constants and helper functions imported by users and scripts.
6
6
  """
7
7
 
8
+ from twopy._version import __version__
8
9
  from twopy.analysis import (
9
10
  DEFAULT_RESPONSE_POST_WINDOW_SECONDS,
10
11
  DEFAULT_RESPONSE_PRE_WINDOW_SECONDS,
@@ -174,5 +175,3 @@ __all__ = [
174
175
  "write_response_summary_grouped_csv",
175
176
  "write_response_summary_trials_csv",
176
177
  ]
177
-
178
- __version__ = "0.1.0"
@@ -0,0 +1,14 @@
1
+ """Package-version metadata for twopy.
2
+
3
+ Inputs: installed Python package metadata.
4
+ Outputs: the current twopy package version string.
5
+
6
+ Keeping this in one small module prevents the public Python API and command-line
7
+ interface from drifting when ``pyproject.toml`` changes.
8
+ """
9
+
10
+ from importlib.metadata import version
11
+
12
+ __all__ = ["__version__"]
13
+
14
+ __version__ = version("twopy")
@@ -9,8 +9,10 @@ analysis workflows belong in dedicated helpers that the controls call.
9
9
  """
10
10
 
11
11
  from argparse import ArgumentParser, Namespace
12
+ from collections.abc import Sequence
12
13
  from pathlib import Path
13
14
 
15
+ from twopy._version import __version__
14
16
  from twopy.napari.controls import add_twopy_magicgui_controls
15
17
  from twopy.napari.layout import place_response_options_after_recording_list
16
18
  from twopy.napari.loading import resolve_or_convert_launch_recording
@@ -99,11 +101,12 @@ def launch_napari(
99
101
  return view
100
102
 
101
103
 
102
- def parse_launch_args() -> Namespace:
104
+ def parse_launch_args(args: Sequence[str] | None = None) -> Namespace:
103
105
  """Parse command-line arguments for ``python -m twopy.napari``.
104
106
 
105
107
  Args:
106
- None.
108
+ args: Optional command-line arguments. ``None`` reads from
109
+ ``sys.argv``.
107
110
 
108
111
  Returns:
109
112
  Parsed argument namespace.
@@ -111,6 +114,13 @@ def parse_launch_args() -> Namespace:
111
114
  parser = ArgumentParser(
112
115
  description="Launch napari for a twopy-converted recording.",
113
116
  )
117
+ parser.add_argument(
118
+ "-v",
119
+ "--version",
120
+ action="version",
121
+ version=f"twopy {__version__}",
122
+ help="Print the current twopy package version and exit.",
123
+ )
114
124
  parser.add_argument(
115
125
  "recording_data_path",
116
126
  nargs="?",
@@ -152,7 +162,7 @@ def parse_launch_args() -> Namespace:
152
162
  action="store_true",
153
163
  help="Skip loading movie preview frames and show only the mean image.",
154
164
  )
155
- return parser.parse_args()
165
+ return parser.parse_args(args)
156
166
 
157
167
 
158
168
  def main() -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: twopy
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Two-photon imaging analysis tool with a napari interface.
5
5
  Author-email: Gustavo Madeira Santana <fromweb1@gumadeiras.com>
6
6
  License-Expression: MIT
@@ -2,6 +2,7 @@ README.md
2
2
  pyproject.toml
3
3
  src/twopy/__init__.py
4
4
  src/twopy/_segments.py
5
+ src/twopy/_version.py
5
6
  src/twopy/api.py
6
7
  src/twopy/config.py
7
8
  src/twopy/converted.py
@@ -5,6 +5,7 @@ Outputs: unittest assertions that confirm basic package metadata is available.
5
5
  """
6
6
 
7
7
  import unittest
8
+ from importlib.metadata import version
8
9
 
9
10
  import twopy
10
11
 
@@ -18,7 +19,7 @@ class ImportTest(unittest.TestCase):
18
19
  Inputs: imported twopy module.
19
20
  Outputs: a passing assertion when the version matches package metadata.
20
21
  """
21
- self.assertEqual(twopy.__version__, "0.1.0")
22
+ self.assertEqual(twopy.__version__, version("twopy"))
22
23
 
23
24
 
24
25
  if __name__ == "__main__":
@@ -0,0 +1,63 @@
1
+ """Tests for package metadata that exposes twopy as an application.
2
+
3
+ Inputs: project metadata from ``pyproject.toml``.
4
+ Outputs: assertions that command-line entry points stay wired to the launcher.
5
+ """
6
+
7
+ import tomllib
8
+ import unittest
9
+ from contextlib import redirect_stdout
10
+ from importlib.metadata import version
11
+ from io import StringIO
12
+ from pathlib import Path
13
+
14
+ from twopy.napari.launcher import parse_launch_args
15
+
16
+
17
+ class PackagingTest(unittest.TestCase):
18
+ """Tests package metadata that is easy to regress accidentally."""
19
+
20
+ def test_twopy_console_script_launches_napari(self) -> None:
21
+ """Confirm the ``twopy`` terminal command points at the launcher.
22
+
23
+ Inputs: repository ``pyproject.toml``.
24
+ Outputs: expected console-script target.
25
+ """
26
+ pyproject_path = Path(__file__).parents[1] / "pyproject.toml"
27
+ with pyproject_path.open("rb") as pyproject_file:
28
+ pyproject = tomllib.load(pyproject_file)
29
+
30
+ self.assertEqual(
31
+ pyproject["project"]["scripts"]["twopy"],
32
+ "twopy.napari:main",
33
+ )
34
+
35
+ def test_twopy_cli_prints_version(self) -> None:
36
+ """Confirm ``twopy --version`` reports package metadata.
37
+
38
+ Inputs: launcher argument parser and installed package metadata.
39
+ Outputs: version text and a clean parser exit.
40
+ """
41
+ output = StringIO()
42
+ with self.assertRaises(SystemExit) as exit_context, redirect_stdout(output):
43
+ parse_launch_args(["--version"])
44
+
45
+ self.assertEqual(exit_context.exception.code, 0)
46
+ self.assertEqual(output.getvalue().strip(), f"twopy {version('twopy')}")
47
+
48
+ def test_twopy_cli_prints_short_version(self) -> None:
49
+ """Confirm ``twopy -v`` is an alias for ``twopy --version``.
50
+
51
+ Inputs: launcher argument parser and installed package metadata.
52
+ Outputs: version text and a clean parser exit.
53
+ """
54
+ output = StringIO()
55
+ with self.assertRaises(SystemExit) as exit_context, redirect_stdout(output):
56
+ parse_launch_args(["-v"])
57
+
58
+ self.assertEqual(exit_context.exception.code, 0)
59
+ self.assertEqual(output.getvalue().strip(), f"twopy {version('twopy')}")
60
+
61
+
62
+ if __name__ == "__main__":
63
+ unittest.main()
@@ -1,32 +0,0 @@
1
- """Tests for package metadata that exposes twopy as an application.
2
-
3
- Inputs: project metadata from ``pyproject.toml``.
4
- Outputs: assertions that command-line entry points stay wired to the launcher.
5
- """
6
-
7
- import tomllib
8
- import unittest
9
- from pathlib import Path
10
-
11
-
12
- class PackagingTest(unittest.TestCase):
13
- """Tests package metadata that is easy to regress accidentally."""
14
-
15
- def test_twopy_console_script_launches_napari(self) -> None:
16
- """Confirm the ``twopy`` terminal command points at the launcher.
17
-
18
- Inputs: repository ``pyproject.toml``.
19
- Outputs: expected console-script target.
20
- """
21
- pyproject_path = Path(__file__).parents[1] / "pyproject.toml"
22
- with pyproject_path.open("rb") as pyproject_file:
23
- pyproject = tomllib.load(pyproject_file)
24
-
25
- self.assertEqual(
26
- pyproject["project"]["scripts"]["twopy"],
27
- "twopy.napari:main",
28
- )
29
-
30
-
31
- if __name__ == "__main__":
32
- unittest.main()
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
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