From 958bd0b4cc7573e657dda54cd307ab0b71e57799 Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Tue, 24 Jun 2025 16:06:16 +0200 Subject: [PATCH 1/4] Use dependency groups instead of optional deps for dev --- pyproject.toml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4620e9a..a7893d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,11 @@ name = "pyvisgrid" dynamic = ["version"] description = " Grid and visualize observations of radio interferometers." readme = "README.md" -authors = [{ name = "Kevin Schmitz, Tom Groß, Anno Knierim" }] +authors = [ + { name = "Kevin Schmitz", email = "kevin2.schmitz@tu-dortmund.de" }, + { name = "Tom Groß", email = "tom.gross@tu-dortmund.de" }, + { name = "Anno Knierim", email = "anno.knierim@tu-dortmund.de" }, +] maintainers = [ { name = "Kevin Schmitz", email = "kevin2.schmitz@tu-dortmund.de" }, { name = "Tom Groß", email = "tom.gross@tu-dortmund.de" }, @@ -32,9 +36,6 @@ dependencies = [ "astropy<=6.1.0", "click", "h5py", - "ipython", - "jupyter", - "matplotlib", "numpy", "pandas", "scipy", @@ -46,10 +47,21 @@ dependencies = [ ] [project.optional-dependencies] +plot = ["matplotlib"] -tests = ["h5py", "pytest >= 7.0", "pytest-cov", "tomli"] - -dev = ["pre-commit"] +[dependency-groups] +tests = [ + "h5py", + "pytest >= 7.0", + "pytest-cov", + "tomli", +] +dev = [ + "pre-commit", + "ipython", + "jupyter", + {include-group = "tests"}, +] [project.urls] repository = "https://github.com/radionets-project/pyvisgrid" From 2ebc13e72713644f14d55df32a9385386444b33e Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Tue, 24 Jun 2025 22:16:51 +0200 Subject: [PATCH 2/4] Allow direct references --- pyproject.toml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a7893d5..cfdaa86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [build-system] -requires = ["setuptools>=64", "setuptools_scm[toml]>=8"] -build-backend = "setuptools.build_meta" +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" [project] name = "pyvisgrid" dynamic = ["version"] description = " Grid and visualize observations of radio interferometers." -readme = "README.md" +readme = "README.rst" authors = [ { name = "Kevin Schmitz", email = "kevin2.schmitz@tu-dortmund.de" }, { name = "Tom Groß", email = "tom.gross@tu-dortmund.de" }, @@ -43,7 +43,7 @@ dependencies = [ "torch", "tqdm", "casatools", - "pyvisgen@git+https://github.com/radionets-project/pyvisgen#egg=main", + "pyvisgen@git+https://github.com/radionets-project/pyvisgen.git@main", ] [project.optional-dependencies] @@ -66,8 +66,18 @@ dev = [ [project.urls] repository = "https://github.com/radionets-project/pyvisgrid" -[tool.setuptools_scm] -write_to = "pyvisgrid/_version.py" +[tool.hatch.version] +source = "vcs" -[tool.setuptools.packages.find] -where = ["."] +[tool.hatch.build.hooks.vcs] +version-file = "pyvisgrid/_version.py" + + +[tool.hatch.build.targets.wheel] +packages = ["."] + +# as long as we still directly install +# pyvisgen from git we need to set this +# to true +[tool.hatch.metadata] +allow-direct-references = true From 5977aba01256f74339c43316f7f7955bb1d25645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Gro=C3=9F?= Date: Fri, 4 Jul 2025 16:17:21 +0200 Subject: [PATCH 3/4] Add matplotlib back to dependencies --- pyproject.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cfdaa86..0717945 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ dependencies = [ "h5py", "numpy", "pandas", + "matplotlib", "scipy", "toml", "torch", @@ -46,9 +47,6 @@ dependencies = [ "pyvisgen@git+https://github.com/radionets-project/pyvisgen.git@main", ] -[project.optional-dependencies] -plot = ["matplotlib"] - [dependency-groups] tests = [ "h5py", From 9c90c2f5efc9b93ca09ec9d5f3d83542293dcadf Mon Sep 17 00:00:00 2001 From: tgross03 Date: Fri, 4 Jul 2025 16:34:22 +0200 Subject: [PATCH 4/4] Update pre-commit hooks, Add codespell hook --- .pre-commit-config.yaml | 34 +++++++++++++++++++++++----------- pyvisgrid/core/gridder.py | 8 ++++---- pyvisgrid/core/stokes.py | 2 +- pyvisgrid/plotting/plotting.py | 6 +++--- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f72cf57..a843120 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,27 @@ repos: - - repo: https://github.com/pycqa/isort - rev: 5.12.0 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v5.0.0" hooks: - - id: isort - args: ["--profile", "black", "--filter-files"] - - repo: https://github.com/psf/black - rev: 22.6.0 + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: name-tests-test + args: ["--pytest-test-first"] + - id: requirements-txt-fixer + - id: trailing-whitespace + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.12.1" hooks: - - id: black-jupyter - - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + - id: ruff-format + - id: ruff-check + args: ["--fix", "--show-fixes"] + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 hooks: - - id: flake8 - args: [--max-line-length=88, "--extend-ignore=E203,E741"] + - id: codespell diff --git a/pyvisgrid/core/gridder.py b/pyvisgrid/core/gridder.py index eb5b990..d08ca8a 100644 --- a/pyvisgrid/core/gridder.py +++ b/pyvisgrid/core/gridder.py @@ -238,7 +238,7 @@ def from_pyvisgen( ---------- obs : pyvisgen.simulation.Observation - The obeservation which is returned by the + The observation which is returned by the ``pyvisgen.simulation.vis_loop`` function. vis_data : pyvisgen.simulation.Visibilities @@ -519,7 +519,7 @@ def plot_ungridded_uv(self, **kwargs): Default is ``None``, meaning the plot won't be saved. save_args : dict, optional - The additional arugments passed to the ``fig.savefig`` call. + The additional arguments passed to the ``fig.savefig`` call. Default is ``{"bbox_inches":"tight"}``. fig : matplotlib.figure.Figure | None, optional @@ -640,7 +640,7 @@ def plot_mask(self, stokes_component: str = "I", **kwargs): Default is ``None``, meaning the plot won't be saved. save_args : dict, optional - The additional arugments passed to the ``fig.savefig`` call. + The additional arguments passed to the ``fig.savefig`` call. Default is ``{"bbox_inches":"tight"}``. fig : matplotlib.figure.Figure | None, optional @@ -752,7 +752,7 @@ def plot_dirty_image(self, stokes_component: str = "I", **kwargs): Default is ``None``, meaning the plot won't be saved. save_args : dict, optional - The additional arugments passed to the ``fig.savefig`` call. + The additional arguments passed to the ``fig.savefig`` call. Default is ``{"bbox_inches":"tight"}``. fig : matplotlib.figure.Figure | None, optional diff --git a/pyvisgrid/core/stokes.py b/pyvisgrid/core/stokes.py index 3b3ce62..779f1ff 100644 --- a/pyvisgrid/core/stokes.py +++ b/pyvisgrid/core/stokes.py @@ -93,7 +93,7 @@ def compute_single_stokes_component( stokes_comp_2 : int Index of second stokes visibility. sign : str - Wether to add or substract ``stokes_comp_1`` and ``stokes_comp_2``. + Whether to add or subtract ``stokes_comp_1`` and ``stokes_comp_2``. Valid values are ``'+'`` or ``'-'``. Returns diff --git a/pyvisgrid/plotting/plotting.py b/pyvisgrid/plotting/plotting.py index d100203..75597f8 100644 --- a/pyvisgrid/plotting/plotting.py +++ b/pyvisgrid/plotting/plotting.py @@ -168,7 +168,7 @@ def plot_ungridded_uv( Default is ``None``, meaning the plot won't be saved. save_args : dict, optional - The additional arugments passed to the ``fig.savefig`` call. + The additional arguments passed to the ``fig.savefig`` call. Default is ``{"bbox_inches":"tight"}``. fig : matplotlib.figure.Figure | None, optional @@ -322,7 +322,7 @@ def plot_mask( Default is ``None``, meaning the plot won't be saved. save_args : dict, optional - The additional arugments passed to the ``fig.savefig`` call. + The additional arguments passed to the ``fig.savefig`` call. Default is ``{"bbox_inches":"tight"}``. fig : matplotlib.figure.Figure | None, optional @@ -531,7 +531,7 @@ def plot_dirty_image( Default is ``None``, meaning the plot won't be saved. save_args : dict, optional - The additional arugments passed to the ``fig.savefig`` call. + The additional arguments passed to the ``fig.savefig`` call. Default is ``{"bbox_inches":"tight"}``. fig : matplotlib.figure.Figure | None, optional