diff --git a/pyproject.toml b/pyproject.toml index cff7e24..c3fb216 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ packages = [ { include = "signaloid", from = "src" } ] + [tool.poetry-dynamic-versioning] enable = true vcs = "git" @@ -30,7 +31,7 @@ types-tabulate = "^0.9.0" types-PyYAML = "^6.0.0" [build-system] -requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"] +requires = ["poetry-core>=1.9.1", "poetry-dynamic-versioning>=1.0.0,<2.0.0"] build-backend = "poetry_dynamic_versioning.backend" [tool.poetry.dependencies] @@ -52,6 +53,7 @@ scipy = [ { version = ">=1.14.0", python = ">=3.11" }, ] + [tool.poetry.extras] sheets = ["gspread", "google-api-python-client", "oauth2client"] @@ -64,6 +66,13 @@ strict = true disallow_any_generics = false python_version = "3.10" exclude = '(^|/)\.venv/' +# `signaloid` is a PEP 420 namespace package, so it has no top-level `py.typed` +# marker. Resolve it from the source tree (via `mypy_path`) rather than as an +# installed distribution, so `mypy -p signaloid` type-checks the sources +# directly instead of failing on the absent namespace-level marker. +mypy_path = "src" +namespace_packages = true +explicit_package_bases = true [[tool.mypy.overrides]] module = [ diff --git a/src/signaloid/__init__.py b/src/signaloid/__init__.py deleted file mode 100644 index 860f233..0000000 --- a/src/signaloid/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from .distributional import DistributionalValue, DiracDelta - -__all__ = [ - "DistributionalValue", - "DiracDelta", -] diff --git a/src/signaloid/py.typed b/src/signaloid/circuitpython/py.typed similarity index 100% rename from src/signaloid/py.typed rename to src/signaloid/circuitpython/py.typed diff --git a/src/signaloid/distributional/distributional.py b/src/signaloid/distributional/distributional.py index fe325be..8807a2d 100644 --- a/src/signaloid/distributional/distributional.py +++ b/src/signaloid/distributional/distributional.py @@ -59,6 +59,8 @@ }, } +UR_TYPE_ATHENS = 0x04 + # First byte of the Ux Binary Data format, used to distinguish it from the legacy format UX_BINARY_FORMAT_MARKER = 0xF0 @@ -67,16 +69,17 @@ class DistributionalValue: def __init__( self, particle_value: float | None = None, - UR_type: int | None = None, + UR_type: int = UR_TYPE_ATHENS, dirac_deltas: list[DiracDelta] | None = None, double_precision: bool = True, ) -> None: self.particle_value: float | None = particle_value - self.UR_type: int | None = UR_type + self.UR_type: int = UR_type self._dirac_deltas: list[DiracDelta] = ( dirac_deltas if dirac_deltas is not None else [] ) self.double_precision = double_precision + """ properties """ diff --git a/src/signaloid/distributional/py.typed b/src/signaloid/distributional/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/signaloid/distributional_distance/py.typed b/src/signaloid/distributional_distance/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/signaloid/distributional_information_plotting/py.typed b/src/signaloid/distributional_information_plotting/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/signaloid/statistical_tests/py.typed b/src/signaloid/statistical_tests/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/signaloid/uxdata_toolkit.py b/src/signaloid/uxdata_toolkit/__init__.py similarity index 99% rename from src/signaloid/uxdata_toolkit.py rename to src/signaloid/uxdata_toolkit/__init__.py index d57419c..90ce787 100644 --- a/src/signaloid/uxdata_toolkit.py +++ b/src/signaloid/uxdata_toolkit/__init__.py @@ -283,7 +283,3 @@ def main(argv: list[str] | None = None) -> None: else: print("Unknown command. Use -h for help.") sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/src/signaloid/uxdata_toolkit/__main__.py b/src/signaloid/uxdata_toolkit/__main__.py new file mode 100644 index 0000000..f0963ea --- /dev/null +++ b/src/signaloid/uxdata_toolkit/__main__.py @@ -0,0 +1,30 @@ +# Copyright (c) 2026, Signaloid. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +""" +Entry point for running the Ux Data Toolkit as a module: + + python -m signaloid.uxdata_toolkit +""" + +from signaloid.uxdata_toolkit import main + +if __name__ == "__main__": + main() diff --git a/src/signaloid/uxdata_toolkit/py.typed b/src/signaloid/uxdata_toolkit/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/signaloid/uxdata_toolkit_test.py b/src/signaloid/uxdata_toolkit/uxdata_toolkit_test.py similarity index 100% rename from src/signaloid/uxdata_toolkit_test.py rename to src/signaloid/uxdata_toolkit/uxdata_toolkit_test.py