Skip to content

Commit 4ca8110

Browse files
authored
Merge pull request #741 from mrava87/build-uv
Build/CI: modernize build/doc/ci
2 parents bca6dbc + 0a0139a commit 4ca8110

184 files changed

Lines changed: 11955 additions & 2306 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
[run]
22
branch = True
33
source = pylops
4+
omit =
5+
pylops/basicoperators/_*.py
6+
pylops/signalprocessing/_*.py
7+
pylops/utils/_*.py
8+
pylops/waveeqprocessing/_*.py

.github/workflows/build.yaml

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

1818
runs-on: ${{ matrix.platform }}
19-
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/*
25-
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version: ${{ matrix.python-version }}
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip setuptools
32-
pip install flake8 pytest
3319

34-
if [[ "${{ matrix.platform }}" == ubuntu* ]]; then
35-
pip install -r requirements-dev.txt
36-
pip install -r requirements-pyfftw.txt
37-
else
38-
pip install -r requirements-dev-arm.txt
39-
pip install -r requirements-pyfftw.txt
40-
fi
41-
pip install -r requirements-torch.txt
42-
- name: Install pylops
43-
run: |
44-
python -m setuptools_scm
45-
pip install .
46-
- name: Tests with pytest
47-
run: |
48-
pytest
20+
steps:
21+
- name: Check out source repository
22+
uses: actions/checkout@v6
23+
with:
24+
fetch-depth: 0
25+
- name: Install uv with Python ${{ matrix.python-version }}
26+
uses: astral-sh/setup-uv@v6
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies and pylops
30+
run: uv sync --locked --extra advanced --extra stat --extra deep --all-groups
31+
- name: Test with pytest
32+
run: uv run pytest --color=yes pytests/

.github/workflows/buildcupy.yaml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,26 @@ jobs:
1313
runs-on: self-hosted
1414
steps:
1515
- name: Check out source repository
16-
uses: actions/checkout@v4
17-
- name: Set up Python environment and Install dependencies and pylops
16+
uses: actions/checkout@v6
17+
with:
18+
fetch-depth: 0
19+
- name: Install uv with Python 3.11
20+
uses: astral-sh/setup-uv@v6
21+
with:
22+
python-version: 3.11
23+
- name: Install dependencies and pylops
1824
run: |
19-
python3 -m venv .venv-pylops
20-
# write install scripts
21-
cat << 'EOF' > pylops_tests.sh
22-
#!/bin/bash
23-
PYTHON=.venv-pylops/bin/python3
24-
PIP=.venv-pylops/bin/pip
25-
ls $PYTHON
26-
ls $PIP
27-
$PIP install
28-
$PIP install --upgrade pip setuptools
29-
$PIP install install flake8 pytest setuptools-scm
30-
$PIP install -r requirements-dev-gpu.txt
31-
$PIP install cupy-cuda12x
32-
$PYTHON -m setuptools_scm
33-
$PIP install .
34-
EOF
35-
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash pylops_tests.sh
36-
- name: Tests with pytest
25+
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
26+
uv sync --locked --extra advanced \
27+
--extra stat --extra gpu-cu12 \
28+
--extra deep-cu128 --all-groups
29+
'
30+
echo "done!"
31+
- name: Test with pytest
3732
run: |
38-
export CUPY_PYLOPS=1; export TEST_CUPY_PYLOPS=1;
39-
export PYTEST=.venv-pylops/bin/pytest
40-
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 $PYTEST
33+
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
34+
export CUPY_PYLOPS=1
35+
export TEST_CUPY_PYLOPS=1
36+
uv run pytest --color=yes pytests/
37+
'
4138
echo "done!"

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

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,38 @@
22
# For more information see: https://github.com/codacy/codacy-coverage-reporter-action
33
name: PyLops-coverage
44

5-
on: [push, pull_request_target]
5+
on:
6+
pull_request:
7+
push:
8+
branches: [dev]
69

710
jobs:
811
build:
9-
strategy:
10-
matrix:
11-
platform: [ ubuntu-latest, ]
12-
python-version: ["3.11", ]
13-
14-
runs-on: ${{ matrix.platform }}
12+
runs-on: ubuntu-latest
1513
steps:
16-
- uses: actions/checkout@v4
17-
- name: Get history and tags for SCM versioning to work
18-
run: |
19-
git fetch --prune --unshallow
20-
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: ${{ matrix.python-version }}
25-
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install flake8 pytest
29-
pip install -r requirements-dev.txt
30-
pip install -r requirements-pyfftw.txt
31-
pip install -r requirements-torch.txt
32-
- name: Install pylops
33-
run: |
34-
pip install .
35-
pip install coverage
36-
- name: Code coverage with coverage
37-
run: |
38-
coverage run -m pytest
39-
coverage xml
40-
- name: Run codacy-coverage-reporter
41-
uses: codacy/codacy-coverage-reporter-action@v1
42-
with:
43-
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
44-
coverage-reports: coverage.xml
14+
- name: Check out source repository
15+
uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
- name: Install uv with Python
19+
uses: astral-sh/setup-uv@v6
20+
with:
21+
python-version: "3.11"
22+
- name: Install dependencies and pylops
23+
run: uv sync --locked --extra advanced --extra stat --extra deep --all-groups
24+
- name: Coverage with pytest
25+
run: |
26+
uv run coverage run -m pytest
27+
uv run coverage xml
28+
uv run coverage html
29+
- name: Upload HTML coverage report
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: coverage-html
33+
path: htmlcov/
34+
- name: Run codacy-coverage-reporter
35+
if: github.event_name == 'push'
36+
uses: codacy/codacy-coverage-reporter-action@v1
37+
with:
38+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
39+
coverage-reports: coverage.xml

.github/workflows/ruff.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This workflow runs Ruff on the PR
2+
# For more information see: https://github.com/marketplace/actions/ruff-action
3+
name: PyLops-ruff
4+
5+
on: [push, pull_request]
6+
7+
jobs:
8+
ruff-lint:
9+
runs-on: ubuntu-latest
10+
name: Lint
11+
steps:
12+
- name: Check out source repository
13+
uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
- name: Lint with ruff
17+
uses: astral-sh/ruff-action@v3
18+
with:
19+
src: "./pylops"

.pre-commit-config.yaml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
exclude: "^docs/"
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.0.1
4+
rev: v6.0.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
8+
- id: mixed-line-ending
9+
- id: check-toml
810
- id: check-yaml
11+
- id: check-added-large-files
12+
- id: check-case-conflict
13+
- id: check-merge-conflict
914

10-
- repo: https://github.com/psf/black
11-
rev: 22.3.0
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.14.14
1217
hooks:
13-
- id: black
14-
args: # arguments to configure black
15-
- --line-length=88
18+
- id: ruff-check
19+
args: [ --fix ]
20+
- id: ruff-format
1621

17-
- repo: https://github.com/pycqa/isort
18-
rev: 5.12.0
22+
- repo: https://github.com/astral-sh/uv-pre-commit
23+
rev: 0.9.28
1924
hooks:
20-
- id: isort
21-
name: isort (python)
22-
args:
23-
[
24-
"--profile",
25-
"black",
26-
"--skip",
27-
"__init__.py",
28-
"--filter-files",
29-
"--line-length=88",
30-
]
25+
- id: uv-lock
26+
27+
- repo: https://github.com/abravalheri/validate-pyproject
28+
rev: "v0.23"
29+
hooks:
30+
- id: validate-pyproject
31+
additional_dependencies: ["validate-pyproject-schema-store[all]"]

.readthedocs.yaml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
# Required
66
version: 2
77

8-
# Set the version of Python and other tools you might need
9-
build:
10-
os: ubuntu-24.04
11-
tools:
12-
python: "3.12"
13-
148
# Build documentation in the docs/ directory with Sphinx
159
sphinx:
1610
configuration: docs/source/conf.py
1711

18-
# Declare the Python requirements required to build your docs
19-
python:
20-
install:
21-
- requirements: requirements-doc.txt
22-
- requirements: requirements-torch.txt
23-
- method: pip
24-
path: .
12+
# Set the version of environment using UV
13+
build:
14+
os: ubuntu-24.04
15+
tools:
16+
python: "3.12"
17+
jobs:
18+
pre_create_environment:
19+
- asdf plugin add uv
20+
- asdf install uv latest
21+
- asdf global uv latest
22+
create_environment:
23+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
24+
install:
25+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --locked --extra advanced --extra stat --extra deep --all-groups

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ The best way to get in touch with the core developers and maintainers is to
66
join the [PyLops slack channel](https://pylops.slack.com/) as well as
77
open new *Issues* directly from the GitHub repo.
88

9-
Moreover, take a look at the [Roadmap](https://pylops.readthedocs.io/en/stable/roadmap.html)
10-
page for a list of current ideas for improvements and additions to the PyLops library.
11-
12-
139
## Welcomed contributions
1410

1511
### Bug reports

MANIFEST.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
exclude .*
2-
exclude environment.yml requirements.txt Makefile
3-
exclude environment-dev.yml requirements-dev.txt azure-pipelines.yml readthedocs.yml
2+
exclude Makefile
3+
exclude environment*
4+
exclude requirements*
5+
exclude azure-pipelines.yml readthedocs.yml
46
recursive-exclude docs *
57
recursive-exclude examples *
68
recursive-exclude pytests *

0 commit comments

Comments
 (0)