Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use setuptools instead of pdm for package build #26

Merged
merged 8 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 45 additions & 26 deletions .github/workflows/build_python.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,62 @@
# Workflow to build the parallelproj C/CUDA libs (incl. installation of CUDA)
name: python build
name: Build and Test

on:
push:
branches: [ "master" ]
branches:
- master
pull_request:
branches: [ "master" ]

jobs:
Testing:
runs-on: ${{ matrix.os }}
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9','3.10']
os: [ubuntu-latest]
python-version: [3.9, 3.11]
tensorflow-version: [2.13, 2.15]

steps:
- uses: actions/checkout@v4
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # default 1 is, which doesnt allow to get all tags which we need for version from scm
fetch-tags: true
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
fetch-depth: 0 # Fetch all history to ensure tags are available

# Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Show package version
# Install dependencies
- name: Install dependencies
run: |
git describe --tags
pdm show --version
- name: Install dependencies and package
python -m pip install --upgrade pip
pip install build

# Build the package
- name: Build the package
run: |
pdm update -d -G test
pdm list
- name: Test CLI
python -m build

# Install tensorflow
- name: Install tensorflow
run: |
pdm run pyapetnet_list_models
pdm run pyapetnet_predict_from_nifti -h
pdm run pyapetnet_predict_from_dicom -h
- name: Run Tests
pip install tensorflow==${{ matrix.tensorflow-version }}

# Install the package
- name: Install the package
run: |
pip install dist/*.whl

# Run tests
- name: Run tests
run: |
pip install pytest
pytest -vv tests

# Test entry points
- name: Test entry points
run: |
pdm run tox
pyapetnet_list_models
pyapetnet_predict_from_nifti -h
pyapetnet_predict_from_dicom -h
41 changes: 41 additions & 0 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Python distributions to PyPI

on:
push:
tags:
- "v[0-9]+"
- "v[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+[a-z][0-9]+"
- "v[0-9]+.[0-9]+[a-z][0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+[a-z][0-9]+"

jobs:
build-n-publish:
name: Build and publish Python distributions package to PyPI
runs-on: ubuntu-latest

permissions:
id-token: write
contents: read

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history to ensure tags are available
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .

- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
34 changes: 0 additions & 34 deletions .github/workflows/publish_pypi.yaml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/publish_test_pypi.yaml

This file was deleted.

24 changes: 24 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Include necessary metadata files
include LICENSE
include README.md
include pyproject.toml

# Include only the package files
graft src/pyapetnet

# Include trained models
recursive-include src/pyapetnet/trained_models

# Exclude unwanted directories
prune .git
prune .github
prune binder
prune demo_data
prune demos
prune figures
prune notebooks
prune scripts
prune tests

# Exclude unwanted files
global-exclude *.pyc *.pyo __pycache__
Loading
Loading