From 7b6e33781e5b0f1cc12b34eec762689b66e5635d Mon Sep 17 00:00:00 2001 From: Pravir Kumar Date: Mon, 23 Feb 2026 02:43:42 +0200 Subject: [PATCH] Refactor project structure to src layout --- .github/workflows/ci.yml | 4 +-- pyproject.toml | 29 ++++++------------- {sigpyproc => src/sigpyproc}/__init__.py | 0 {sigpyproc => src/sigpyproc}/apps/__init__.py | 0 .../sigpyproc}/apps/spp_clean.py | 0 .../sigpyproc}/apps/spp_digifil.py | 0 .../sigpyproc}/apps/spp_extract.py | 0 .../sigpyproc}/apps/spp_header.py | 0 {sigpyproc => src/sigpyproc}/base.py | 0 {sigpyproc => src/sigpyproc}/block.py | 0 {sigpyproc => src/sigpyproc}/core/__init__.py | 0 .../sigpyproc}/core/custom_types.py | 0 {sigpyproc => src/sigpyproc}/core/filters.py | 0 {sigpyproc => src/sigpyproc}/core/kernels.py | 0 {sigpyproc => src/sigpyproc}/core/rfi.py | 0 {sigpyproc => src/sigpyproc}/core/stats.py | 0 {sigpyproc => src/sigpyproc}/foldedcube.py | 0 {sigpyproc => src/sigpyproc}/fourierseries.py | 0 {sigpyproc => src/sigpyproc}/header.py | 0 {sigpyproc => src/sigpyproc}/io/__init__.py | 0 {sigpyproc => src/sigpyproc}/io/bits.py | 0 {sigpyproc => src/sigpyproc}/io/fbh5.py | 0 {sigpyproc => src/sigpyproc}/io/fileio.py | 0 {sigpyproc => src/sigpyproc}/io/pfits.py | 0 {sigpyproc => src/sigpyproc}/io/rescale.py | 0 {sigpyproc => src/sigpyproc}/io/sigproc.py | 0 {sigpyproc => src/sigpyproc}/params.py | 0 {sigpyproc => src/sigpyproc}/readers.py | 0 .../sigpyproc}/simulation/__init__.py | 0 .../sigpyproc}/simulation/furby.py | 0 {sigpyproc => src/sigpyproc}/timeseries.py | 0 {sigpyproc => src/sigpyproc}/utils.py | 0 {sigpyproc => src/sigpyproc}/viz/__init__.py | 0 {sigpyproc => src/sigpyproc}/viz/styles.py | 0 34 files changed, 11 insertions(+), 22 deletions(-) rename {sigpyproc => src/sigpyproc}/__init__.py (100%) rename {sigpyproc => src/sigpyproc}/apps/__init__.py (100%) rename {sigpyproc => src/sigpyproc}/apps/spp_clean.py (100%) rename {sigpyproc => src/sigpyproc}/apps/spp_digifil.py (100%) rename {sigpyproc => src/sigpyproc}/apps/spp_extract.py (100%) rename {sigpyproc => src/sigpyproc}/apps/spp_header.py (100%) rename {sigpyproc => src/sigpyproc}/base.py (100%) rename {sigpyproc => src/sigpyproc}/block.py (100%) rename {sigpyproc => src/sigpyproc}/core/__init__.py (100%) rename {sigpyproc => src/sigpyproc}/core/custom_types.py (100%) rename {sigpyproc => src/sigpyproc}/core/filters.py (100%) rename {sigpyproc => src/sigpyproc}/core/kernels.py (100%) rename {sigpyproc => src/sigpyproc}/core/rfi.py (100%) rename {sigpyproc => src/sigpyproc}/core/stats.py (100%) rename {sigpyproc => src/sigpyproc}/foldedcube.py (100%) rename {sigpyproc => src/sigpyproc}/fourierseries.py (100%) rename {sigpyproc => src/sigpyproc}/header.py (100%) rename {sigpyproc => src/sigpyproc}/io/__init__.py (100%) rename {sigpyproc => src/sigpyproc}/io/bits.py (100%) rename {sigpyproc => src/sigpyproc}/io/fbh5.py (100%) rename {sigpyproc => src/sigpyproc}/io/fileio.py (100%) rename {sigpyproc => src/sigpyproc}/io/pfits.py (100%) rename {sigpyproc => src/sigpyproc}/io/rescale.py (100%) rename {sigpyproc => src/sigpyproc}/io/sigproc.py (100%) rename {sigpyproc => src/sigpyproc}/params.py (100%) rename {sigpyproc => src/sigpyproc}/readers.py (100%) rename {sigpyproc => src/sigpyproc}/simulation/__init__.py (100%) rename {sigpyproc => src/sigpyproc}/simulation/furby.py (100%) rename {sigpyproc => src/sigpyproc}/timeseries.py (100%) rename {sigpyproc => src/sigpyproc}/utils.py (100%) rename {sigpyproc => src/sigpyproc}/viz/__init__.py (100%) rename {sigpyproc => src/sigpyproc}/viz/styles.py (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 511fe85..ecddfd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: run: uv sync --extra develop - name: Run ty - run: uv run ty check sigpyproc/ + run: uv run ty check test: name: Tests & Coverage @@ -69,7 +69,7 @@ jobs: run: uv sync --extra tests - name: Run pytest - run: uv run pytest --cov=sigpyproc --cov-report=xml -v + run: uv run pytest --cov=src --cov-report=xml -v - name: Upload coverage to Codecov # only upload once — ubuntu + latest python avoids duplicate reports diff --git a/pyproject.toml b/pyproject.toml index f4562fb..0e85953 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,10 +2,6 @@ requires = ["uv_build>=0.10.4,<0.11.0"] build-backend = "uv_build" -[tool.uv.build-backend] -module-name = "sigpyproc" -module-root = "" - [project] name = "sigpyproc" version = "2.0.0" @@ -13,8 +9,10 @@ description = "Python FRB/pulsar data toolbox" readme = "README.md" license = "MIT" license-files = ["LICENSE"] -authors = [{ name = "Ewan Barr", email = "ewan.d.barr@gmail.com" }] -maintainers = [{ name = "Pravir Kumar", email = "pravirka@gmail.com" }] +authors = [ + { name = "Pravir Kumar", email = "pravirka@gmail.com" }, + { name = "Ewan Barr", email = "ewan.d.barr@gmail.com" }, +] requires-python = ">=3.11" classifiers = [ "Programming Language :: Python :: 3 :: Only", @@ -76,15 +74,8 @@ spp_clean = "sigpyproc.apps.spp_clean:main" [tool.ruff] -include = [ - "pyproject.toml", - "sigpyproc/**/*.py", - "tests/**/*.py", - "docs/**/*.py", -] - -exclude = ["sigpyproc/apps/spp_digifil.py"] - +include = ["pyproject.toml", "src/**/*.py", "tests/**/*.py", "docs/**/*.py"] +exclude = ["src/sigpyproc/apps/spp_digifil.py"] line-length = 88 indent-width = 4 target-version = "py312" @@ -104,9 +95,6 @@ ignore = ["COM812", "D1", "D301", "PLR2004", "G004"] [tool.ruff.lint.pylint] max-args = 15 -[tool.ruff.lint.isort] -known-first-party = ["sigpyproc"] - [tool.ruff.lint.pydocstyle] convention = "numpy" @@ -114,7 +102,8 @@ convention = "numpy" python-version = "3.12" [tool.ty.src] -exclude = ["sigpyproc/apps/spp_digifil.py"] +include = ["src"] +exclude = ["tests", "src/sigpyproc/apps/spp_digifil.py"] [tool.ty.rules] not-iterable = "ignore" # For Numba prange @@ -131,7 +120,7 @@ addopts = ["-ra", "-q"] testpaths = ["tests"] [tool.coverage.paths] -source = ["./sigpyproc/"] +source = ["src/"] [tool.coverage.run] omit = ["tests/*", "docs/*", "*__init__.py", "*_types.py"] diff --git a/sigpyproc/__init__.py b/src/sigpyproc/__init__.py similarity index 100% rename from sigpyproc/__init__.py rename to src/sigpyproc/__init__.py diff --git a/sigpyproc/apps/__init__.py b/src/sigpyproc/apps/__init__.py similarity index 100% rename from sigpyproc/apps/__init__.py rename to src/sigpyproc/apps/__init__.py diff --git a/sigpyproc/apps/spp_clean.py b/src/sigpyproc/apps/spp_clean.py similarity index 100% rename from sigpyproc/apps/spp_clean.py rename to src/sigpyproc/apps/spp_clean.py diff --git a/sigpyproc/apps/spp_digifil.py b/src/sigpyproc/apps/spp_digifil.py similarity index 100% rename from sigpyproc/apps/spp_digifil.py rename to src/sigpyproc/apps/spp_digifil.py diff --git a/sigpyproc/apps/spp_extract.py b/src/sigpyproc/apps/spp_extract.py similarity index 100% rename from sigpyproc/apps/spp_extract.py rename to src/sigpyproc/apps/spp_extract.py diff --git a/sigpyproc/apps/spp_header.py b/src/sigpyproc/apps/spp_header.py similarity index 100% rename from sigpyproc/apps/spp_header.py rename to src/sigpyproc/apps/spp_header.py diff --git a/sigpyproc/base.py b/src/sigpyproc/base.py similarity index 100% rename from sigpyproc/base.py rename to src/sigpyproc/base.py diff --git a/sigpyproc/block.py b/src/sigpyproc/block.py similarity index 100% rename from sigpyproc/block.py rename to src/sigpyproc/block.py diff --git a/sigpyproc/core/__init__.py b/src/sigpyproc/core/__init__.py similarity index 100% rename from sigpyproc/core/__init__.py rename to src/sigpyproc/core/__init__.py diff --git a/sigpyproc/core/custom_types.py b/src/sigpyproc/core/custom_types.py similarity index 100% rename from sigpyproc/core/custom_types.py rename to src/sigpyproc/core/custom_types.py diff --git a/sigpyproc/core/filters.py b/src/sigpyproc/core/filters.py similarity index 100% rename from sigpyproc/core/filters.py rename to src/sigpyproc/core/filters.py diff --git a/sigpyproc/core/kernels.py b/src/sigpyproc/core/kernels.py similarity index 100% rename from sigpyproc/core/kernels.py rename to src/sigpyproc/core/kernels.py diff --git a/sigpyproc/core/rfi.py b/src/sigpyproc/core/rfi.py similarity index 100% rename from sigpyproc/core/rfi.py rename to src/sigpyproc/core/rfi.py diff --git a/sigpyproc/core/stats.py b/src/sigpyproc/core/stats.py similarity index 100% rename from sigpyproc/core/stats.py rename to src/sigpyproc/core/stats.py diff --git a/sigpyproc/foldedcube.py b/src/sigpyproc/foldedcube.py similarity index 100% rename from sigpyproc/foldedcube.py rename to src/sigpyproc/foldedcube.py diff --git a/sigpyproc/fourierseries.py b/src/sigpyproc/fourierseries.py similarity index 100% rename from sigpyproc/fourierseries.py rename to src/sigpyproc/fourierseries.py diff --git a/sigpyproc/header.py b/src/sigpyproc/header.py similarity index 100% rename from sigpyproc/header.py rename to src/sigpyproc/header.py diff --git a/sigpyproc/io/__init__.py b/src/sigpyproc/io/__init__.py similarity index 100% rename from sigpyproc/io/__init__.py rename to src/sigpyproc/io/__init__.py diff --git a/sigpyproc/io/bits.py b/src/sigpyproc/io/bits.py similarity index 100% rename from sigpyproc/io/bits.py rename to src/sigpyproc/io/bits.py diff --git a/sigpyproc/io/fbh5.py b/src/sigpyproc/io/fbh5.py similarity index 100% rename from sigpyproc/io/fbh5.py rename to src/sigpyproc/io/fbh5.py diff --git a/sigpyproc/io/fileio.py b/src/sigpyproc/io/fileio.py similarity index 100% rename from sigpyproc/io/fileio.py rename to src/sigpyproc/io/fileio.py diff --git a/sigpyproc/io/pfits.py b/src/sigpyproc/io/pfits.py similarity index 100% rename from sigpyproc/io/pfits.py rename to src/sigpyproc/io/pfits.py diff --git a/sigpyproc/io/rescale.py b/src/sigpyproc/io/rescale.py similarity index 100% rename from sigpyproc/io/rescale.py rename to src/sigpyproc/io/rescale.py diff --git a/sigpyproc/io/sigproc.py b/src/sigpyproc/io/sigproc.py similarity index 100% rename from sigpyproc/io/sigproc.py rename to src/sigpyproc/io/sigproc.py diff --git a/sigpyproc/params.py b/src/sigpyproc/params.py similarity index 100% rename from sigpyproc/params.py rename to src/sigpyproc/params.py diff --git a/sigpyproc/readers.py b/src/sigpyproc/readers.py similarity index 100% rename from sigpyproc/readers.py rename to src/sigpyproc/readers.py diff --git a/sigpyproc/simulation/__init__.py b/src/sigpyproc/simulation/__init__.py similarity index 100% rename from sigpyproc/simulation/__init__.py rename to src/sigpyproc/simulation/__init__.py diff --git a/sigpyproc/simulation/furby.py b/src/sigpyproc/simulation/furby.py similarity index 100% rename from sigpyproc/simulation/furby.py rename to src/sigpyproc/simulation/furby.py diff --git a/sigpyproc/timeseries.py b/src/sigpyproc/timeseries.py similarity index 100% rename from sigpyproc/timeseries.py rename to src/sigpyproc/timeseries.py diff --git a/sigpyproc/utils.py b/src/sigpyproc/utils.py similarity index 100% rename from sigpyproc/utils.py rename to src/sigpyproc/utils.py diff --git a/sigpyproc/viz/__init__.py b/src/sigpyproc/viz/__init__.py similarity index 100% rename from sigpyproc/viz/__init__.py rename to src/sigpyproc/viz/__init__.py diff --git a/sigpyproc/viz/styles.py b/src/sigpyproc/viz/styles.py similarity index 100% rename from sigpyproc/viz/styles.py rename to src/sigpyproc/viz/styles.py