Skip to content

Commit 9521152

Browse files
authored
Merge pull request #250 from mrava87/build-releaseprocess
Build: modernization of build process
2 parents 4c2ddb4 + 5f5ca4f commit 9521152

13 files changed

Lines changed: 124 additions & 84 deletions

.github/workflows/build.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1717

1818
runs-on: ${{ matrix.platform }}
19+
1920
steps:
20-
- uses: actions/checkout@v4
21-
- name: Get history and tags for SCM versioning to work
22-
run: |
23-
git fetch --prune --unshallow
24-
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
21+
- name: Check out source repository
22+
uses: actions/checkout@v6
23+
with:
24+
fetch-depth: 0
2525
- name: Install uv with Python ${{ matrix.python-version }}
2626
uses: astral-sh/setup-uv@v6
2727
with:

.github/workflows/codacy-coverage-reporter.yaml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,28 @@ on:
99

1010
jobs:
1111
build:
12-
strategy:
13-
matrix:
14-
platform: [ubuntu-latest]
15-
python-version: ["3.11"]
16-
17-
runs-on: ${{ matrix.platform }}
18-
12+
runs-on: ubuntu-latest
1913
steps:
20-
- uses: actions/checkout@v4
21-
22-
- name: Get history and tags for SCM versioning to work
23-
run: |
24-
git fetch --prune --unshallow
25-
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
26-
27-
- name: Install uv with Python ${{ matrix.python-version }}
14+
- name: Check out source repository
15+
uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
- name: Install uv with Python
2819
uses: astral-sh/setup-uv@v6
2920
with:
30-
python-version: ${{ matrix.python-version }}
31-
21+
python-version: "3.11"
3222
- name: Install dependencies and pyproximal
3323
run: uv sync --locked --all-extras --all-groups
34-
3524
- name: Coverage with pytest
3625
run: |
3726
uv run coverage run -m pytest
3827
uv run coverage xml
3928
uv run coverage html
40-
4129
- name: Upload HTML coverage report
4230
uses: actions/upload-artifact@v4
4331
with:
4432
name: coverage-html
4533
path: htmlcov/
46-
4734
- name: Run codacy-coverage-reporter
4835
if: github.event_name == 'push'
4936
uses: codacy/codacy-coverage-reporter-action@v1

.github/workflows/deploy.yaml

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,67 @@
11
# This workflow uploads PyProx on PyPI using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
2+
# For more information see: https://github.com/python-attrs/attrs/blob/main/.github/workflows/pypi-package.yml
33
name: PyProximal-deploy
44

55
on:
6+
push:
7+
tags: ["*"]
68
release:
7-
types: [published]
9+
types:
10+
- published
11+
workflow_dispatch:
812

913
jobs:
10-
deploy:
14+
build-package:
15+
name: Build & verify package
1116
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check out source repository
20+
uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
- name: Build and inspect package
24+
uses: hynek/build-and-inspect-python-package@v2
25+
26+
release-test-pypi:
27+
name: Publish in-dev package to test.pypi.org
28+
if: github.repository_owner == 'PyLops' && github.ref_type == 'tag'
29+
runs-on: ubuntu-latest
30+
needs: build-package
31+
permissions:
32+
contents: read
33+
id-token: write
34+
35+
steps:
36+
- name: Download package
37+
uses: actions/download-artifact@v8
38+
with:
39+
name: Packages
40+
path: dist
41+
42+
- name: Upload package to Test PyPI
43+
uses: pypa/gh-action-pypi-publish@release/v1
44+
with:
45+
attestations: true
46+
repository-url: https://test.pypi.org/legacy/
47+
48+
release-pypi:
49+
name: Publish released package to pypi.org
50+
if: github.repository_owner == 'PyLops' && github.event.action == 'published'
51+
runs-on: ubuntu-latest
52+
needs: build-package
53+
permissions:
54+
contents: read
55+
id-token: write
56+
1257
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python
15-
uses: actions/setup-python@v2
58+
- name: Download package
59+
uses: actions/download-artifact@v8
1660
with:
17-
python-version: '3.x'
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install build
22-
- name: Build package
23-
run: python -m build
24-
- name: Publish package
25-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
61+
name: Packages
62+
path: dist
63+
64+
- name: Upload package to PyPI
65+
uses: pypa/gh-action-pypi-publish@release/v1
2666
with:
27-
user: __token__
28-
password: ${{ secrets.PYPI_API_TOKEN }}
67+
attestations: true

.github/workflows/mypy.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ jobs:
99
name: MyPy
1010
steps:
1111
- name: Check out source repository
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v6
13+
with:
14+
fetch-depth: 0
1315
- name: Install uv with Python
1416
uses: astral-sh/setup-uv@v6
1517
with:

.github/workflows/ruff.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ jobs:
1010
name: Lint
1111
steps:
1212
- name: Check out source repository
13-
uses: actions/checkout@v4
14-
- name: ruff Lint
13+
uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
- name: Lint with ruff
1517
uses: astral-sh/ruff-action@v3
1618
with:
1719
src: "./pyproximal"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ build
1717
dist
1818
pyproximal.egg-info/
1919

20-
# setuptools_scm generated #
20+
# hatchling generated #
2121
pyproximal/version.py
2222

2323
# Development #

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ UV := $(shell command -v uv 2> /dev/null || command which uv 2> /dev/null)
44
NOX := $(shell command -v nox 2> /dev/null || command which nox 2> /dev/null)
55

66
.PHONY: install_conda dev-install_conda dev-install_conda_arm dev-install_uv
7-
.PHONY: tests tests_uv tests_nox doc doc_uv docupdate docupdate_uv servedoc
7+
.PHONY: tests tests_uv tests_nox doc doc_uv docupdate docupdate_uv servedoc servedoc_uv
88
.PHONY: lint lint_uv typeannot typeannot_uv coverage coverage_uv
99

1010
pipcheck:
@@ -57,7 +57,7 @@ tests_nox:
5757
$(NOX) -s tests
5858

5959
doc:
60-
cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\
60+
cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\
6161
rm -rf source/tutorials && rm -rf source/examples &&\
6262
rm -rf build && make html && cd ..
6363

@@ -68,6 +68,7 @@ doc_uv:
6868
rm -rf build && $(UV) run make html && cd ..
6969

7070
docupdate:
71+
make pythoncheck
7172
cd docs && make html && cd ..
7273

7374
docupdate_uv:

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,37 @@ This repository is organized as follows:
107107
## Getting started
108108
You need **Python 3.10 or greater**.
109109

110-
#### From Conda
110+
#### From PyPI
111+
To get the most out of PyProximal straight out of the box, we recommend using
112+
the PyPI distribution via `uv`:
111113

112-
To get the most out of PyLops straight out of the box, we recommend `conda` to install PyLops:
113114
```bash
114-
conda install -c conda-forge pyproximal
115+
uv pip install pyproximal
115116
```
116117

117-
#### From PyPI
118-
You can also install pyproximal with `pip`:
118+
or directly via `pip`:
119+
119120
```bash
120121
pip install pyproximal
121122
```
122-
or via `uv`:
123+
124+
#### From Conda
125+
You can also install PyProximal via `conda`:
126+
123127
```bash
124-
uv pip install pyproximal
128+
conda install -c conda-forge pyproximal
125129
```
126130

127131
#### From Github
128-
Finally, you can also directly install from the main branch (although this is not recommended):
132+
Finally, you can also directly install from the main branch (although this is not recommended) via `uv`:
129133

130-
```
131-
pip install git+https://git@github.com/PyLops/pyproximal.git@main
132-
```
133-
or via `uv`:
134134
```bash
135135
uv add git+https://github.com/PyLops/pyproximal.git --branch main
136136
```
137+
or via `pip`:
138+
```bash
139+
pip install git+https://git@github.com/PyLops/pyproximal.git@main
140+
```
137141

138142
## Contributing
139143
*Feel like contributing to the project? Adding new operators or tutorial?*
@@ -150,8 +154,8 @@ Execute the following command in your terminal:
150154
git clone https://github.com/your_name_here/pyproximal.git
151155
```
152156

153-
### 2. Install PyLops in a new Conda environment
154-
To ensure that further development of PyLops is performed within the same environment (i.e.,
157+
### 2. Install PyProximal in a new Conda environment
158+
To ensure that further development of PyProximal is performed within the same environment (i.e.,
155159
same dependencies) as that defined by ``environment-dev.yml``/``environment-dev-arm.yml`` files,
156160
we suggest to work off a new Conda enviroment.
157161

docs/source/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ will also be run as part of our CI.
113113

114114
.. tab-set::
115115

116-
.. tab-item:: conda
116+
.. tab-item:: :iconify:`devicon:anaconda` conda
117117

118118
.. code-block:: bash
119119

docs/source/installation.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
Dependencies
77
************
8-
98
The mandatory dependencies of PyProximal are limited to:
109

1110
* Python 3.10 or greater
@@ -38,26 +37,25 @@ First install `pyproximal` with your package manager of choice.
3837
3938
>> conda install --channel conda-forge pyproximal
4039
41-
Most of the dependencies (all required and some of the optional) are
42-
automatically installed for you.
40+
which installs also the *required* dependencies, if not already present
41+
in your environment.
4342

4443
.. tab-item:: :iconify:`material-icon-theme:uv` uv
4544

4645
.. code-block:: bash
4746
4847
>> uv add pyproximal
4948
50-
Only the *required* dependencies are installed. To install
51-
some of the optional dependencies, run:
49+
which installs also the *required* dependencies, if not already present
50+
in your environment. To also install the optional dependencies, run:
5251

5352
.. code-block:: bash
5453
5554
>> uv add "pyproximal[advanced]"
5655
57-
5856
From Source
5957
===========
60-
To access the latest source from github:
58+
To access the latest source from GitHub:
6159

6260
.. tab-set::
6361

@@ -81,15 +79,15 @@ Step-by-step installation for developers
8179

8280
Fork PyProximal
8381
===============
84-
Fork the `PyProximal repository <https://github.com/PyLops/pyproximal>`_ and clone it by executing the following in your terminal:
82+
Fork the `PyProximal repository <https://github.com/PyLops/pyproximal>`_ and clone it
83+
by executing the following in your terminal:
8584

8685
.. code-block:: bash
8786
8887
>> git clone https://github.com/YOUR-USERNAME/pyproximal.git
8988
9089
Install dependencies
9190
====================
92-
9391
We recommend installing dependencies into a separate environment.
9492
For that end, we provide a `Makefile` with useful commands for setting up the environment.
9593

@@ -178,8 +176,8 @@ At this point, the user must check the changes and then stage them before trying
178176

179177
Final steps
180178
===========
181-
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.
182-
A properly configured linter (``ruff``) can be run with:
179+
PyProximal does enforce the use of a linter (``ruff``), which is run both as a pre-commit hook and as a GitHub Action.
180+
The linter can also be run locally with:
183181

184182
.. tab-set::
185183

0 commit comments

Comments
 (0)