Skip to content

Commit 313945e

Browse files
Merge pull request #12 from GiorgioMedico/fix/numpy1-compat-and-relaxed-deps
NumPy 1 compatibility, relaxed deps, and uv tooling migration
2 parents a9b8fa1 + 0e980b5 commit 313945e

14 files changed

Lines changed: 2243 additions & 96 deletions

File tree

.github/workflows/docs.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,17 @@ jobs:
3535
with:
3636
fetch-depth: 0
3737

38-
- name: Set up Python
39-
uses: actions/setup-python@v5
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v6
4040
with:
41-
python-version: '3.12'
42-
cache: 'pip'
43-
44-
- name: Install dependencies
45-
run: |
46-
python -m pip install --upgrade pip
47-
pip install -e '.[docs]'
48-
41+
enable-cache: true
42+
cache-dependency-glob: uv.lock
43+
44+
- name: Sync dependencies
45+
run: uv sync --locked --no-default-groups --group docs
46+
4947
- name: Build documentation
50-
run: |
51-
mkdocs build --clean --strict
48+
run: uv run mkdocs build --clean --strict
5249

5350
- name: Setup Pages
5451
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

.github/workflows/pre-commit.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- name: Set up Python
14-
uses: actions/setup-python@v5
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v6
1515
with:
16-
python-version: '3.12'
17-
- uses: pre-commit/action@v3.0.1
16+
enable-cache: true
17+
cache-dependency-glob: uv.lock
18+
- name: Sync dependencies
19+
run: uv sync --locked --no-default-groups --group dev
20+
- name: Cache pre-commit hook environments
21+
uses: actions/cache@v4
22+
with:
23+
path: ~/.cache/pre-commit
24+
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
25+
restore-keys: |
26+
pre-commit-${{ runner.os }}-
27+
- name: Run pre-commit
28+
run: uv run pre-commit run --all-files --show-diff-on-failure

.github/workflows/publish.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@ jobs:
1515
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18-
- name: Set up Python
19-
uses: actions/setup-python@v5
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
2020
with:
21-
python-version: '3.12'
22-
cache: 'pip'
23-
- name: Install build tools
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install build twine
21+
enable-cache: true
22+
cache-dependency-glob: uv.lock
2723
- name: Build package
28-
run: python -m build
24+
run: uv build
2925
- name: Verify package
30-
run: twine check dist/*
26+
run: uvx twine check dist/*
3127
- name: Publish to PyPI
3228
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: ci-test
32

43
on:
@@ -14,27 +13,24 @@ jobs:
1413
matrix:
1514
os: [ubuntu-latest, macos-latest]
1615
python-version: ['3.11', '3.12', '3.13']
16+
env:
17+
UV_PYTHON: ${{ matrix.python-version }}
1718
steps:
1819
- uses: actions/checkout@v4
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v6
1922
with:
20-
fetch-depth: 0
21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: ${{ matrix.python-version }}
25-
cache: 'pip'
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install -e '.[test]'
23+
enable-cache: true
24+
cache-dependency-glob: uv.lock
25+
- name: Sync dependencies
26+
run: uv sync --locked --no-default-groups --group test
3027
- name: Testing with coverage
31-
run: |
32-
python -m pytest tests --cov=interpolatepy --cov-report=xml --cov-report=term-missing
28+
run: uv run pytest tests --cov=interpolatepy --cov-report=xml --cov-report=term-missing
3329
- name: Upload coverage to Codecov
3430
uses: codecov/codecov-action@v5
3531
with:
3632
token: ${{ secrets.CODECOV_TOKEN }}
37-
file: ./coverage.xml
33+
files: ./coverage.xml
3834
flags: unittests
3935
name: codecov-umbrella
4036
fail_ci_if_error: false

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ target/
9999
# Jupyter Notebook
100100
.ipynb_checkpoints
101101

102-
# pyenv
103-
.python-version
104-
105102
# celery beat schedule file
106103
celerybeat-schedule
107104

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ pip install InterpolatePy
2828
<details>
2929
<summary><strong>Development Installation</strong></summary>
3030

31+
This project uses [uv](https://docs.astral.sh/uv/) for dependency and environment management.
32+
3133
```bash
3234
git clone https://github.com/GiorgioMedico/InterpolatePy.git
3335
cd InterpolatePy
34-
pip install -e '.[all]' # Includes testing and development tools
36+
uv sync # creates .venv with the default dev + test groups
3537
```
38+
39+
To include the docs group as well: `uv sync --all-groups`.
3640
</details>
3741

3842
## Quick Start
@@ -253,22 +257,22 @@ Set `INTERPOLATEPY_NO_CPP=1` to force pure-Python mode.
253257
```bash
254258
git clone https://github.com/GiorgioMedico/InterpolatePy.git
255259
cd InterpolatePy
256-
pip install -e '.[all]'
257-
pre-commit install
260+
uv sync # creates .venv with dev + test groups
261+
uv run pre-commit install
258262

259263
# Run tests
260-
python -m pytest tests/
264+
uv run pytest tests/
261265

262266
# Run tests with coverage
263-
python -m pytest tests/ --cov=interpolatepy --cov-report=html --cov-report=term
267+
uv run pytest tests/ --cov=interpolatepy --cov-report=html --cov-report=term
264268

265269
# Code quality
266-
ruff format interpolatepy/
267-
ruff check interpolatepy/
268-
mypy interpolatepy/
270+
uv run ruff format interpolatepy/
271+
uv run ruff check interpolatepy/
272+
uv run mypy interpolatepy/
269273

270274
# Run all pre-commit hooks
271-
pre-commit run --all-files
275+
uv run pre-commit run --all-files
272276
```
273277
</details>
274278

@@ -279,9 +283,9 @@ pre-commit run --all-files
279283
Contributions welcome! Please:
280284

281285
1. Fork the repo and create a feature branch
282-
2. Install dev dependencies: `pip install -e '.[all]'`
286+
2. Install dev dependencies: `uv sync`
283287
3. Follow existing patterns and add tests
284-
4. Run `pre-commit run --all-files` before submitting
288+
4. Run `uv run pre-commit run --all-files` before submitting
285289
5. Open a pull request with clear description
286290

287291
For major changes, open an issue first to discuss the approach.

docs/contributing.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,22 @@ Thank you for your interest in contributing to InterpolatePy! This guide will he
2222
cd InterpolatePy
2323
```
2424

25-
2. **Create a virtual environment**:
26-
```bash
27-
python -m venv venv
28-
source venv/bin/activate # On Windows: venv\Scripts\activate
29-
```
25+
2. **Install [uv](https://docs.astral.sh/uv/)** (project uses uv for environment management).
3026

3127
3. **Install development dependencies**:
3228
```bash
33-
pip install -e '.[all]' # Installs package + dev dependencies
29+
uv sync # creates .venv with the default dev + test groups
3430
```
3531

3632
4. **Install pre-commit hooks**:
3733
```bash
38-
pre-commit install
34+
uv run pre-commit install
3935
```
4036

4137
5. **Verify installation**:
4238
```bash
43-
python -c "import interpolatepy; print(interpolatepy.__version__)"
44-
pytest tests/ -v
39+
uv run python -c "import interpolatepy; print(interpolatepy.__version__)"
40+
uv run pytest tests/ -v
4541
```
4642

4743
### Project Structure
@@ -104,32 +100,32 @@ Follow our [coding standards](#coding-standards) and ensure your changes:
104100

105101
```bash
106102
# Run all tests
107-
pytest tests/
103+
uv run pytest tests/
108104

109105
# Run specific test file
110-
pytest tests/test_cubic_spline.py -v
106+
uv run pytest tests/test_cubic_spline.py -v
111107

112108
# Run with coverage
113-
pytest tests/ --cov=interpolatepy --cov-report=html --cov-report=term
109+
uv run pytest tests/ --cov=interpolatepy --cov-report=html --cov-report=term
114110

115111
# Run benchmarks
116-
pytest tests/ -k "benchmark" --benchmark-only
112+
uv run pytest tests/ -k "benchmark" --benchmark-only
117113
```
118114

119115
### 4. Check Code Quality
120116

121117
```bash
122118
# Format code
123-
ruff format interpolatepy/
119+
uv run ruff format interpolatepy/
124120

125121
# Check linting
126-
ruff check interpolatepy/
122+
uv run ruff check interpolatepy/
127123

128124
# Type checking
129-
mypy interpolatepy/
125+
uv run mypy interpolatepy/
130126

131127
# Run pre-commit checks
132-
pre-commit run --all-files
128+
uv run pre-commit run --all-files
133129
```
134130

135131
### 5. Commit Changes

docs/installation.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,39 +66,44 @@ For contributing to InterpolatePy or accessing the latest features:
6666

6767
### Clone and Install
6868

69+
InterpolatePy uses [uv](https://docs.astral.sh/uv/) for development. Install uv first, then:
70+
6971
```bash
7072
git clone https://github.com/GiorgioMedico/InterpolatePy.git
7173
cd InterpolatePy
72-
pip install -e '.[all]' # Includes testing and development tools
74+
uv sync # creates .venv with the default dev + test groups
7375
```
7476

75-
### With Development Dependencies
77+
### Selecting Dependency Groups
7678

7779
```bash
78-
# Install with all optional dependencies
79-
pip install -e '.[all]'
80+
# Default: dev + test groups
81+
uv sync
82+
83+
# Include the docs group as well
84+
uv sync --all-groups
8085

81-
# Or install specific groups
82-
pip install -e '.[test]' # Testing tools
83-
pip install -e '.[dev]' # Development tools
86+
# Or pick a specific group
87+
uv sync --group test
88+
uv sync --group docs
8489
```
8590

8691
### Development Tools Setup
8792

8893
```bash
8994
# Install pre-commit hooks
90-
pre-commit install
95+
uv run pre-commit install
9196

9297
# Run code quality checks
93-
ruff format interpolatepy/
94-
ruff check interpolatepy/
95-
mypy interpolatepy/
98+
uv run ruff format interpolatepy/
99+
uv run ruff check interpolatepy/
100+
uv run mypy interpolatepy/
96101

97102
# Run tests
98-
python -m pytest tests/
103+
uv run pytest tests/
99104

100105
# Run tests with coverage
101-
python -m pytest tests/ --cov=interpolatepy --cov-report=html --cov-report=term
106+
uv run pytest tests/ --cov=interpolatepy --cov-report=html --cov-report=term
102107
```
103108

104109
## C++ Backend (Optional)

docs/troubleshooting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ModuleNotFoundError: No module named 'interpolatepy'
1818
# Install from PyPI
1919
pip install interpolatepy
2020

21-
# Or install from source for development
22-
pip install -e .
21+
# Or install from source for development (uses uv)
22+
uv sync
2323
```
2424

2525
#### Problem: Specific Class Import Failed

0 commit comments

Comments
 (0)