Skip to content

Commit 000c48b

Browse files
committed
switched
1 parent f6e85f5 commit 000c48b

File tree

8 files changed

+4019
-92
lines changed

8 files changed

+4019
-92
lines changed

.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: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,21 @@ 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+
uv sync --dev
21+
uv build
2622
27-
- name: Build
23+
- name: Check PyPI token
2824
run: |
29-
poetry build
25+
if [ -z "$PYPI_TOKEN_PETDEFACE" ]; then
26+
echo "Error: PYPI_TOKEN_PETDEFACE is not set or is empty check your secrets"
27+
exit 1
28+
fi
3029
31-
- name: Publish
32-
if: ${{ !contains(github.ref_name, 'test') }}
30+
- name: Publish Package
3331
run: |
34-
echo "Publishing to PyPI..."
35-
poetry config pypi-token.pypi $PYPI_TOKEN
36-
poetry publish
32+
uv publish --token $PYPI_TOKEN_PETDEFACE

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

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

89
# ignore pycache
910
__pycache__/

.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: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,27 @@ trouble running this container in singularity/apptainer.
161161
162162
## Development
163163
164-
This project uses poetry to package and build, to create a pip installable version of the package run:
164+
This project supports both [UV](https://github.com/astral-sh/uv) and standard Python (pip + build) workflows for development and packaging.
165+
166+
### Using UV (recommended for speed)
167+
168+
```bash
169+
git clone https://github.com/openneuropet/petdeface.git
170+
cd petdeface
171+
uv build
172+
pip install dist/petdeface-<X.X.X>-py3-none-any.whl # where X.X.X is the version number of the generated file
173+
```
174+
175+
### Using pip and python (no UV required)
165176
166177
```bash
167178
git clone https://github.com/openneuropet/petdeface.git
168179
cd petdeface
169-
poetry build
180+
pip install --upgrade pip
181+
pip install .[dev]
182+
# To build a wheel or sdist:
183+
pip install build
184+
python -m build
170185
pip install dist/petdeface-<X.X.X>-py3-none-any.whl # where X.X.X is the version number of the generated file
171186
```
172187

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

pyproject.toml

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
[tool.poetry]
1+
[project]
22
name = "petdeface"
33
version = "0.3.0"
44
description = "A nipype PET and MR defacing pipeline for BIDS datasets utilizing FreeSurfer's MiDeFace."
5-
authors = ["Martin Nørgaard <[email protected]>", "Anthony Galassi <[email protected]>", "Murat Bilgel <[email protected]>"]
6-
license = "MIT"
5+
authors = [
6+
{name = "Martin Nørgaard", email = "[email protected]"},
7+
{name = "Anthony Galassi", email = "[email protected]"},
8+
{name = "Murat Bilgel", email = "[email protected]"}
9+
]
10+
license = {text = "MIT"}
711
readme = "README.md"
8-
include = [
9-
"petdeface/*",
10-
"pyproject.toml",
11-
"data/sub-01/ses-baseline/anat/sub-01_ses-baseline_T1w.nii.gz",
12-
"data/sub-01/ses-baseline/anat/sub-01_ses-baseline_T1w.json",
13-
"data/sub-mni305/anat/sub-mni305_T1w.nii.gz",
14-
"data/sub-mni305/anat/sub-mni305_T1w.json",
12+
requires-python = ">=3.10"
13+
dependencies = [
14+
"setuptools>=68.1.2",
15+
"petutils>=0.0.1",
16+
"niworkflows>=1.11.0",
17+
"matplotlib>=3.10.1",
18+
"niftifixer @ git+https://github.com/openneuropet/nifti_fixer.git",
19+
"bids-validator-deno>=2.0.5",
20+
"nipreps>=1.0",
21+
"nireports>=25.2.0",
22+
"nibabel>=5.3.2",
23+
"nilearn>=0.10.4",
24+
"numpy>=2.1.3",
25+
"scipy>=1.14.1",
26+
"seaborn>=0.13.2",
27+
"pillow>=11.0.0",
28+
"imageio>=2.36.0",
29+
]
30+
31+
[project.optional-dependencies]
32+
dev = [
33+
"black>=23.7.0",
34+
"flake8>=6.1.0",
35+
"isort>=5.12.0",
36+
"pre-commit>=3.3.3",
37+
"pytest>=7.4.2",
38+
"sphinx>=7.2.6",
39+
"sphinx-rtd-theme>=3.0.1",
40+
"jupyterlab>=4.4.1",
41+
"notebook>=7.4.1",
42+
"nbconvert>=7.16.6",
43+
"ipywidgets>=8.1.6",
44+
"matplotlib>=3.10.1",
45+
"pandas>=2.2.3",
46+
"pyqt6>=6.9.0",
1547
]
1648

49+
[project.scripts]
50+
petdeface = "petdeface.petdeface:main"
51+
1752
# please update the bids version to the latest compliant version when making modifications to this code here
1853
[tool.bids]
1954
bids_version = "1.8.0"
2055

21-
[tool.poetry.dependencies]
22-
python = ">=3.10, <4.0"
23-
setuptools = "^68.1.2"
24-
petutils = "^0.0.1"
25-
niworkflows = "^1.11.0"
26-
matplotlib = "^3.10.1"
27-
niftifixer = {git = "https://github.com/openneuropet/nifti_fixer.git"}
28-
bids-validator-deno = "^2.0.5"
29-
nipreps = "^1.0"
30-
nireports = "^25.2.0"
31-
nibabel = "^5.3.2"
32-
nilearn = "^0.10.4"
33-
numpy = "^2.1.3"
34-
scipy = "^1.14.1"
35-
seaborn = "^0.13.2"
36-
pillow = "^11.0.0"
37-
imageio = "^2.36.0"
38-
39-
40-
[tool.poetry.group.dev.dependencies]
41-
black = "^23.7.0"
42-
flake8 = "^6.1.0"
43-
isort = "^5.12.0"
44-
pre-commit = "^3.3.3"
45-
pytest = "^7.4.2"
46-
sphinx = "^7.2.6"
47-
sphinx-rtd-theme = "^3.0.1"
48-
jupyterlab = "^4.4.1"
49-
notebook = "^7.4.1"
50-
nbconvert = "^7.16.6"
51-
ipywidgets = "^8.1.6"
52-
matplotlib = "^3.10.1"
53-
pandas = "^2.2.3"
54-
pyqt6 = "^6.9.0"
55-
5656
[tool.isort]
5757
profile = "black"
5858
force_single_line = true
5959
lines_after_imports = 2
6060

6161
[build-system]
62-
requires = ["poetry-core", "setuptools>=61.0"]
63-
build-backend = "poetry.core.masonry.api"
62+
requires = ["hatchling"]
63+
build-backend = "hatchling.build"
64+
65+
[tool.hatch.metadata]
66+
allow-direct-references = true
6467

6568
[tool.setuptools]
6669
package-data = { "petdeface" = [ "data/sub-01/ses-baseline/anat/*.nii", "data/sub-01/ses-baseline/anat/*.json", "data/sub-mni305/anat/sub-mni305_T1w.nii.gz", "data/sub-mni305/anat/sub-mni305_T1w.json"]}
67-
68-
[tool.poetry.scripts]
69-
petdeface = 'petdeface.petdeface:main'

0 commit comments

Comments
 (0)