-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use setuptools instead of pdm for package build (#26)
* remove pdm and tox and adapt pyproject.toml * clean up build process * work on package build * renew build workflow * add package install * run tests only on python 3.9 and 3.11 * test with two tf versions * add new publish to pypi workflow --------- Co-authored-by: Georg Schramm <georg@Georgs-MacBook-Pro-9.local>
- Loading branch information
Showing
11 changed files
with
129 additions
and
1,716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__ |
Oops, something went wrong.