Skip to content

Commit b5daf7d

Browse files
authored
switched to uv b/c poetry is getting worse by the day (#62)
Switching over to uv, packaged template t1w's, updated ci * added python version check in CI * update status badges * removed poetry * nested data/ folder 1 level lower to package template t1w's with python package (~15MB in size, not too shabby)
1 parent f6e85f5 commit b5daf7d

26 files changed

+4143
-132
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Check Python Compatibility
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
test-python-compatibility:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
15+
toolchain: [uv, pip]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install UV
27+
if: matrix.toolchain == 'uv'
28+
uses: astral-sh/setup-uv@v2
29+
with:
30+
version: "latest"
31+
32+
- name: Build package with ${{ matrix.toolchain }}
33+
if: matrix.toolchain == 'uv'
34+
run: |
35+
uv build
36+
ls -lh dist/
37+
38+
- name: Build package with ${{ matrix.toolchain }}
39+
if: matrix.toolchain == 'pip'
40+
run: |
41+
python -m pip install --upgrade pip build
42+
python -m build
43+
ls -lh dist/
44+
45+
- name: Install package with ${{ matrix.toolchain }}
46+
if: matrix.toolchain == 'uv'
47+
run: |
48+
uv pip install --system dist/*.whl
49+
uv run python -c "import petdeface; print('Package installed successfully')"
50+
51+
- name: Test CLI
52+
if: matrix.toolchain == 'uv'
53+
run: |
54+
uv run petdeface --help
55+
56+
- name: Install package with ${{ matrix.toolchain }}
57+
if: matrix.toolchain == 'pip'
58+
run: |
59+
python -m pip install dist/*.whl
60+
python -c "import petdeface; print('Package installed successfully')"
61+
62+
- name: Test CLI
63+
if: matrix.toolchain == 'pip'
64+
run: |
65+
petdeface --help

.github/workflows/petdeface.yaml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@ jobs:
1313
test_petdeface:
1414
runs-on: ubuntu-latest
1515
name: Test petdeface
16+
strategy:
17+
matrix:
18+
toolchain: [uv, pip]
1619
steps:
1720
- uses: actions/checkout@v3
18-
- name: Install Poetry
19-
run: pipx install poetry
2021
- uses: actions/setup-python@v4
2122
with:
2223
python-version: 3.11
23-
cache: poetry
24-
- run: poetry install
25-
- name: Run All Tests
26-
run: poetry run make testall
24+
- name: Install dependencies (UV)
25+
if: matrix.toolchain == 'uv'
26+
run: |
27+
curl -LsSf https://astral.sh/uv/install.sh | sh
28+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
29+
uv sync --dev
30+
- name: Install dependencies (pip)
31+
if: matrix.toolchain == 'pip'
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install .[dev]
35+
- name: Run All Tests (UV)
36+
if: matrix.toolchain == 'uv'
37+
run: uv run make testall
38+
- name: Run All Tests (pip)
39+
if: matrix.toolchain == 'pip'
40+
run: make testall

.github/workflows/publish_to_pypi.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,23 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v3
15-
16-
- name: Install dependencies
17-
run: |
18-
pipx install poetry
19-
poetry install
20-
21-
- name: Set up Python
22-
uses: actions/setup-python@v4
15+
- uses: actions/setup-python@v4
2316
with:
2417
python-version: 3.11
25-
cache: 'poetry'
18+
- name: Build Package
19+
run: |
20+
curl -LsSf https://astral.sh/uv/install.sh | sh
21+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
22+
uv sync --dev
23+
uv build
2624
27-
- name: Build
25+
- name: Check PyPI token
2826
run: |
29-
poetry build
27+
if [ -z "$PYPI_TOKEN_PETDEFACE" ]; then
28+
echo "Error: PYPI_TOKEN_PETDEFACE is not set or is empty check your secrets"
29+
exit 1
30+
fi
3031
31-
- name: Publish
32-
if: ${{ !contains(github.ref_name, 'test') }}
32+
- name: Publish Package
3333
run: |
34-
echo "Publishing to PyPI..."
35-
poetry config pypi-token.pypi $PYPI_TOKEN
36-
poetry publish
34+
uv publish --token $PYPI_TOKEN_PETDEFACE

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
# ignore virtualenv
66
venv/
7+
.venv/
78

89
# ignore pycache
910
__pycache__/
1011

1112
# ignore dist
1213
dist/
1314

15+
# ignore egg-info
16+
petdeface.egg-info/
17+
1418
# nipype generates pickle files, we need to redirect where it stores them,
1519
# but until then hack fix
1620
*.pkl

.readthedocs.yaml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,27 @@
22
# Read the Docs configuration file
33
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
44

5-
# Required
65
version: 2
76

8-
# Set the OS, Python version and other tools you might need
7+
# Build environment
98
build:
109
os: ubuntu-22.04
1110
tools:
1211
python: "3.12"
13-
jobs:
14-
post_create_environment:
15-
- pip install poetry
16-
- poetry config virtualenvs.create false
17-
post_install:
18-
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with=dev
12+
13+
# Python environment setup
14+
python:
15+
install:
16+
- method: pip
17+
path: .
18+
extra_requirements:
19+
- dev
1920

2021
# Build documentation in the "docs/" directory with Sphinx
2122
sphinx:
22-
configuration: docs/conf.py
23+
configuration: docs/conf.py
2324

2425
# Optionally build your docs in additional formats such as PDF and ePub
2526
# formats:
2627
# - pdf
2728
# - epub
28-
29-
# Optional but recommended, declare the Python requirements required
30-
# to build your documentation
31-
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
32-
# python:
33-
# install:
34-
# - requirements: docs/requirements.txt

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ This software can be installed via source or via pip from PyPi with `pip install
1414
|---------| ------ |
1515
| `docker build . -t petdeface` | ![docker_build](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiYzdXV0tYSkQzTVNkcG04cHA2S055UXlKRlZTU1VONThUMVRoZVcwU3l1aHFhdVBlNDNaRGVCYzdWM1Q0WjYzQ1lRU2ZTSHpmSERPWFRkVXVyb3k3RTZBPSIsIml2UGFyYW1ldGVyU3BlYyI6IjRCZFFIQnNGT2lKcDA1VG4iLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main) |
1616
| `docker push` | ![docker push icon](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoia0c1bEJYUGI2SXlWYi9JMm1tcGtiYWVTdVd3bmlnOUFaTjN4QjJITU5PTVpvQnN3TlowajhxNmhHY2RwQ2Z5SU93OExqc2xvMzFnTHFvajlqVk1MV2FzPSIsIml2UGFyYW1ldGVyU3BlYyI6Ikl6SzRyc1RabzBnSkplTjciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main) |
17+
| `Python 3.14 >= 3.10` | [![Check Python Compatibility](https://github.com/openneuropet/petdeface/actions/workflows/check_python_compatibility.yaml/badge.svg)](https://github.com/openneuropet/petdeface/actions/workflows/check_python_compatibility.yaml) |
18+
| `packaging` | [![Publish to PyPI](https://github.com/openneuropet/petdeface/actions/workflows/publish_to_pypi.yaml/badge.svg)](https://github.com/openneuropet/petdeface/actions/workflows/publish_to_pypi.yaml) |
19+
| `Docs` | ![RTD BADGE](https://app.readthedocs.org/projects/petdeface/badge/?version=latest&style=default) |
1720

1821
## Requirements
1922

@@ -161,12 +164,27 @@ trouble running this container in singularity/apptainer.
161164
162165
## Development
163166
164-
This project uses poetry to package and build, to create a pip installable version of the package run:
167+
This project supports both [UV](https://github.com/astral-sh/uv) and standard Python (pip + build) workflows for development and packaging.
168+
169+
### Using UV (recommended for speed)
170+
171+
```bash
172+
git clone https://github.com/openneuropet/petdeface.git
173+
cd petdeface
174+
uv build
175+
pip install dist/petdeface-<X.X.X>-py3-none-any.whl # where X.X.X is the version number of the generated file
176+
```
177+
178+
### Using pip and python (no UV required)
165179
166180
```bash
167181
git clone https://github.com/openneuropet/petdeface.git
168182
cd petdeface
169-
poetry build
183+
pip install --upgrade pip
184+
pip install .[dev]
185+
# To build a wheel or sdist:
186+
pip install build
187+
python -m build
170188
pip install dist/petdeface-<X.X.X>-py3-none-any.whl # where X.X.X is the version number of the generated file
171189
```
172190
-26 MB
Binary file not shown.

docs/installation.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ PETdeface can be installed via PyPi_::
99

1010
pip install petdeface
1111

12-
Or cloned and installed from source::
12+
Or cloned and installed from source (using UV)::
1313

1414
git clone https://github.com/openneuropet/petdeface.git
1515
cd petdeface
16-
poetry build
16+
uv build
17+
pip install dist/petdeface-<X.X.X>-py3-none-any.whl
18+
# where X.X.X is the version number of the generated file
19+
20+
Or cloned and installed from source (using pip and python)::
21+
22+
git clone https://github.com/openneuropet/petdeface.git
23+
cd petdeface
24+
pip install --upgrade pip
25+
pip install .[dev]
26+
pip install build
27+
python -m build
1728
pip install dist/petdeface-<X.X.X>-py3-none-any.whl
1829
# where X.X.X is the version number of the generated file
1930

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)