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/pyproject.toml b/pyproject.toml index 4620e9a..0717945 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,17 @@ [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" -authors = [{ name = "Kevin Schmitz, Tom Groß, Anno Knierim" }] +readme = "README.rst" +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,30 +36,46 @@ dependencies = [ "astropy<=6.1.0", "click", "h5py", - "ipython", - "jupyter", - "matplotlib", "numpy", "pandas", + "matplotlib", "scipy", "toml", "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] - -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" -[tool.setuptools_scm] -write_to = "pyvisgrid/_version.py" +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "pyvisgrid/_version.py" + + +[tool.hatch.build.targets.wheel] +packages = ["."] -[tool.setuptools.packages.find] -where = ["."] +# as long as we still directly install +# pyvisgen from git we need to set this +# to true +[tool.hatch.metadata] +allow-direct-references = true 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