From 37455c73baddf135fc5940a6247915ae8a8eb7db Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sat, 7 Mar 2026 20:01:33 +0000 Subject: [PATCH 1/9] build: switch to hatchling --- .gitignore | 2 +- pyproject.toml | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a0f8e75..4b851c1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ build dist pyproximal.egg-info/ -# setuptools_scm generated # +# hatchling generated # pyproximal/version.py # Development # diff --git a/pyproject.toml b/pyproject.toml index fc6022b..672b972 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,9 @@ [build-system] requires = [ - "setuptools >= 65", - "setuptools_scm[toml]", - "wheel", + "hatchling", + "hatch-vcs" ] -build-backend = "setuptools.build_meta" +build-backend = "hatchling.build" [project] name = "pyproximal" @@ -70,11 +69,18 @@ doc = [ "image", ] -[tool.setuptools.packages.find] -exclude = ["pytests"] +[project.urls] +Homepage = "https://github.com/PyLops/pyproximal" +Documentation = "https://pyproximal.readthedocs.io/en/stable" +Discussions = "https://github.com/PyLops/pyproximal/discussions" +Issues = "https://github.com/PyLops/pyproximal/issues" -[tool.setuptools_scm] -version_file = "pyproximal/version.py" +[tool.hatch.build.targets.wheel] +packages = ["pyproximal"] + +[tool.hatch] +version.source = "vcs" +build.hooks.vcs.version-file = "pyproximal/version.py" [tool.pytest.ini_options] addopts = "--verbose" From 57fab32f2f077a922f4d801ee2c6246c958087a0 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sat, 7 Mar 2026 20:25:50 +0000 Subject: [PATCH 2/9] minor: reorder hatch in pyproject.toml --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 672b972..3ca3bbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,13 +75,13 @@ Documentation = "https://pyproximal.readthedocs.io/en/stable" Discussions = "https://github.com/PyLops/pyproximal/discussions" Issues = "https://github.com/PyLops/pyproximal/issues" -[tool.hatch.build.targets.wheel] -packages = ["pyproximal"] - [tool.hatch] version.source = "vcs" build.hooks.vcs.version-file = "pyproximal/version.py" +[tool.hatch.build.targets.wheel] +packages = ["pyproximal"] + [tool.pytest.ini_options] addopts = "--verbose" python_files = ["pytests/*.py"] From fef0fe957340c2853fb029d8ba941dc60e4c3e54 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sat, 7 Mar 2026 20:38:47 +0000 Subject: [PATCH 3/9] minor: added exclude for sdist --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3ca3bbd..cd2ee8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,9 @@ build.hooks.vcs.version-file = "pyproximal/version.py" [tool.hatch.build.targets.wheel] packages = ["pyproximal"] +[tool.hatch.build.targets.sdist] +exclude = ["/.github", "/testdata"] + [tool.pytest.ini_options] addopts = "--verbose" python_files = ["pytests/*.py"] From f8981aa62a656ce8f6dcfc99c3dc1d206697aaff Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 8 Mar 2026 15:31:53 +0000 Subject: [PATCH 4/9] Remove SCM step in Github Actions --- .github/workflows/build.yaml | 7 ++----- .github/workflows/codacy-coverage-reporter.yaml | 13 ++----------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4dd6174..4d0082a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,11 +17,8 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v4 - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Check out source repository + uses: actions/checkout@v4 - name: Install uv with Python ${{ matrix.python-version }} uses: astral-sh/setup-uv@v6 with: diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 579c725..14931ef 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -17,33 +17,24 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v4 - - - name: Get history and tags for SCM versioning to work - run: | - git fetch --prune --unshallow - git fetch --depth=1 origin +refs/tags/*:refs/tags/* - + - name: Check out source repository + uses: actions/checkout@v4 - name: Install uv with Python ${{ matrix.python-version }} uses: astral-sh/setup-uv@v6 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies and pyproximal run: uv sync --locked --all-extras --all-groups - - name: Coverage with pytest run: | uv run coverage run -m pytest uv run coverage xml uv run coverage html - - name: Upload HTML coverage report uses: actions/upload-artifact@v4 with: name: coverage-html path: htmlcov/ - - name: Run codacy-coverage-reporter if: github.event_name == 'push' uses: codacy/codacy-coverage-reporter-action@v1 From e3920b6104850b5e64839790471bc2fd592ab7b2 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 8 Mar 2026 15:46:31 +0000 Subject: [PATCH 5/9] minor: better alignment between GAs --- .github/workflows/build.yaml | 5 ++++- .github/workflows/codacy-coverage-reporter.yaml | 16 ++++++---------- .github/workflows/mypy.yaml | 4 +++- .github/workflows/ruff.yaml | 6 ++++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4d0082a..5702c85 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,9 +16,12 @@ jobs: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] runs-on: ${{ matrix.platform }} + steps: - name: Check out source repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + fetch-depth: 0 - name: Install uv with Python ${{ matrix.python-version }} uses: astral-sh/setup-uv@v6 with: diff --git a/.github/workflows/codacy-coverage-reporter.yaml b/.github/workflows/codacy-coverage-reporter.yaml index 14931ef..856a946 100644 --- a/.github/workflows/codacy-coverage-reporter.yaml +++ b/.github/workflows/codacy-coverage-reporter.yaml @@ -9,20 +9,16 @@ on: jobs: build: - strategy: - matrix: - platform: [ubuntu-latest] - python-version: ["3.11"] - - runs-on: ${{ matrix.platform }} - + runs-on: ubuntu-latest steps: - name: Check out source repository - uses: actions/checkout@v4 - - name: Install uv with Python ${{ matrix.python-version }} + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Install uv with Python uses: astral-sh/setup-uv@v6 with: - python-version: ${{ matrix.python-version }} + python-version: "3.11" - name: Install dependencies and pyproximal run: uv sync --locked --all-extras --all-groups - name: Coverage with pytest diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index 08fbd56..1c40c80 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -9,7 +9,9 @@ jobs: name: MyPy steps: - name: Check out source repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + fetch-depth: 0 - name: Install uv with Python uses: astral-sh/setup-uv@v6 with: diff --git a/.github/workflows/ruff.yaml b/.github/workflows/ruff.yaml index c4ba642..3ab4a5c 100644 --- a/.github/workflows/ruff.yaml +++ b/.github/workflows/ruff.yaml @@ -10,8 +10,10 @@ jobs: name: Lint steps: - name: Check out source repository - uses: actions/checkout@v4 - - name: ruff Lint + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Lint with ruff uses: astral-sh/ruff-action@v3 with: src: "./pyproximal" From 8211b6704a4ed364a95aedc1f5e967a4815c889a Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 8 Mar 2026 16:12:28 +0000 Subject: [PATCH 6/9] ci: updated deploy Github action --- .github/workflows/deploy.yaml | 73 +++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index fb48608..01e3a23 100755 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,28 +1,67 @@ # This workflow uploads PyProx on PyPI using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries +# For more information see: https://github.com/python-attrs/attrs/blob/main/.github/workflows/pypi-package.yml name: PyProximal-deploy on: + push: + tags: ["*"] release: - types: [published] + types: + - published + workflow_dispatch: jobs: - deploy: + build-package: + name: Build & verify package runs-on: ubuntu-latest + + steps: + - name: Check out source repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Build and inspect package + uses: hynek/build-and-inspect-python-package@v2 + + release-test-pypi: + name: Publish in-dev package to test.pypi.org + if: github.repository_owner == 'PyLops' && github.ref_type == 'tag' + runs-on: ubuntu-latest + needs: build-package + permissions: + contents: read + id-token: write + + steps: + - name: Download package + uses: actions/download-artifact@v8 + with: + name: Packages + path: dist + + - name: Upload package to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: true + repository-url: https://test.pypi.org/legacy/ + + release-pypi: + name: Publish released package to pypi.org + if: github.repository_owner == 'PyLops' && github.event.action == 'published' + runs-on: ubuntu-latest + needs: build-package + permissions: + contents: read + id-token: write + steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 + - name: Download package + uses: actions/download-artifact@v8 with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + name: Packages + path: dist + + - name: Upload package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + attestations: true From 8621dd11b77b72c96e5eda67a8acbd5a5ac6623f Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 8 Mar 2026 19:03:36 +0000 Subject: [PATCH 7/9] minor: remove setuptools_scm from environment files --- environment-dev-arm.yml | 1 - environment-dev.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/environment-dev-arm.yml b/environment-dev-arm.yml index d386d10..845d36b 100644 --- a/environment-dev-arm.yml +++ b/environment-dev-arm.yml @@ -22,7 +22,6 @@ dependencies: - bm4d - bm3d - pytest-runner - - setuptools_scm - pooch - shibuya - sphinx-design diff --git a/environment-dev.yml b/environment-dev.yml index e39a571..b5f8651 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -23,7 +23,6 @@ dependencies: - bm4d - bm3d - pytest-runner - - setuptools_scm - pooch - shibuya - sphinx-design From 21b2e472bae4bda38d8917089ca94fa91deabdd8 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Sun, 8 Mar 2026 22:32:48 +0000 Subject: [PATCH 8/9] minor: small improvements to installation doc --- docs/source/installation.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 3af93dc..fa3dc52 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -5,7 +5,6 @@ Dependencies ************ - The mandatory dependencies of PyProximal are limited to: * Python 3.10 or greater @@ -54,10 +53,9 @@ First install `pyproximal` with your package manager of choice. >> uv add "pyproximal[advanced]" - From Source =========== -To access the latest source from github: +To access the latest source from GitHub: .. tab-set:: @@ -89,7 +87,6 @@ Fork the `PyProximal repository `_ and clo Install dependencies ==================== - We recommend installing dependencies into a separate environment. For that end, we provide a `Makefile` with useful commands for setting up the environment. @@ -178,7 +175,7 @@ At this point, the user must check the changes and then stage them before trying Final steps =========== -PyLops does not enforce the use of a linter as a pre-commit hook, but we do highly encourage using one before submitting a Pull Request. +PyProximal does not enforce the use of a linter as a pre-commit hook, but we do highly encourage using one before submitting a Pull Request. A properly configured linter (``ruff``) can be run with: .. tab-set:: From c7efdecd2637f52a16eca45e575eacbfba14c92c Mon Sep 17 00:00:00 2001 From: mrava87 Date: Thu, 12 Mar 2026 20:06:17 +0000 Subject: [PATCH 9/9] minor: small improvements in doc about installation --- README.md | 32 ++++++++++++++++++-------------- docs/source/contributing.rst | 2 +- docs/source/installation.rst | 15 ++++++++------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 231b558..76750b5 100644 --- a/README.md +++ b/README.md @@ -107,33 +107,37 @@ This repository is organized as follows: ## Getting started You need **Python 3.10 or greater**. -#### From Conda +#### From PyPI +To get the most out of PyProximal straight out of the box, we recommend using +the PyPI distribution via `uv`: -To get the most out of PyLops straight out of the box, we recommend `conda` to install PyLops: ```bash -conda install -c conda-forge pyproximal +uv pip install pyproximal ``` -#### From PyPI -You can also install pyproximal with `pip`: +or directly via `pip`: + ```bash pip install pyproximal ``` -or via `uv`: + +#### From Conda +You can also install PyProximal via `conda`: + ```bash -uv pip install pyproximal +conda install -c conda-forge pyproximal ``` #### From Github -Finally, you can also directly install from the main branch (although this is not recommended): +Finally, you can also directly install from the main branch (although this is not recommended) via `uv`: -``` -pip install git+https://git@github.com/PyLops/pyproximal.git@main -``` -or via `uv`: ```bash uv add git+https://github.com/PyLops/pyproximal.git --branch main ``` +or via `pip`: +```bash +pip install git+https://git@github.com/PyLops/pyproximal.git@main +``` ## Contributing *Feel like contributing to the project? Adding new operators or tutorial?* @@ -150,8 +154,8 @@ Execute the following command in your terminal: git clone https://github.com/your_name_here/pyproximal.git ``` -### 2. Install PyLops in a new Conda environment -To ensure that further development of PyLops is performed within the same environment (i.e., +### 2. Install PyProximal in a new Conda environment +To ensure that further development of PyProximal is performed within the same environment (i.e., same dependencies) as that defined by ``environment-dev.yml``/``environment-dev-arm.yml`` files, we suggest to work off a new Conda enviroment. diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst index 2272ec7..127bfac 100644 --- a/docs/source/contributing.rst +++ b/docs/source/contributing.rst @@ -113,7 +113,7 @@ will also be run as part of our CI. .. tab-set:: - .. tab-item:: conda + .. tab-item:: :iconify:`devicon:anaconda` conda .. code-block:: bash diff --git a/docs/source/installation.rst b/docs/source/installation.rst index fa3dc52..a16d6d9 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -37,8 +37,8 @@ First install `pyproximal` with your package manager of choice. >> conda install --channel conda-forge pyproximal - Most of the dependencies (all required and some of the optional) are - automatically installed for you. + which installs also the *required* dependencies, if not already present + in your environment. .. tab-item:: :iconify:`material-icon-theme:uv` uv @@ -46,8 +46,8 @@ First install `pyproximal` with your package manager of choice. >> uv add pyproximal - Only the *required* dependencies are installed. To install - some of the optional dependencies, run: + which installs also the *required* dependencies, if not already present + in your environment. To also install the optional dependencies, run: .. code-block:: bash @@ -79,7 +79,8 @@ Step-by-step installation for developers Fork PyProximal =============== -Fork the `PyProximal repository `_ and clone it by executing the following in your terminal: +Fork the `PyProximal repository `_ and clone it +by executing the following in your terminal: .. code-block:: bash @@ -175,8 +176,8 @@ At this point, the user must check the changes and then stage them before trying Final steps =========== -PyProximal does not enforce the use of a linter as a pre-commit hook, but we do highly encourage using one before submitting a Pull Request. -A properly configured linter (``ruff``) can be run with: +PyProximal does enforce the use of a linter (``ruff``), which is run both as a pre-commit hook and as a GitHub Action. +The linter can also be run locally with: .. tab-set::