Skip to content

Commit

Permalink
Use pyproject.toml inplace of setup.py
Browse files Browse the repository at this point in the history
Correct zarr to be an optional dependency.
Update version to use generation _version.py file.
Update GH Actions in main.
Update minimum version of Python to 3.8
  • Loading branch information
blowekamp committed Jun 14, 2023
1 parent e2953db commit b81be0e
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 97 deletions.
31 changes: 6 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
pip install -e .[zarr,dev]
- name: Test with pytest
run: |
python -m pytest
Expand All @@ -65,14 +65,14 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.7
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt -r docs/requirements.txt twine build
python -m pip install -e .[zarr] twine build
- name: Build package
run: |
python -m build --wheel --sdist
Expand All @@ -86,8 +86,7 @@ jobs:
path: dist
- name: Build Sphinx Documentation
run: |
# install so that setuptools_scm generate version for package
pip install -e .
pip install -r docs/requirements.txt
make -C docs html
- name: Upload documentation
if: github.event_name == 'push'
Expand All @@ -109,21 +108,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
TARGET_BRANCH: 'gh-pages'

github_release:
if: startsWith(github.ref, 'refs/tags/v')
needs: package_docs
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
id: download
with:
name: python-packages
- name: Create Release and Upload
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} --repo ${{ github.repository }} --verify-tag --generate-notes --title "Release ${{ github.ref_name }}"
gh release upload ${{ github.ref_name }} --repo ${{ github.repository }} ${{steps.download.outputs.download-path}}/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ build
dist
sitkibex.dist-info
sitkibex.egg-info
_version.py
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx
sphinx-click
sphinx-click
-r ../requirements.txt
35 changes: 34 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
requires = ["setuptools>=61.0", "wheel", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[project]
name = "sitkibex"
authors = [
{ name="Bradley Lowekamp", email="bioinformatics@niaid.nih.gov" },
]
description = "Image registration for iterative fluorescence microscopy"
readme = "README.rst"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
]
dynamic = ["dependencies", "version"]


[project.optional-dependencies]
zarr= ["zarr"]
dev = [
"pytest",
"flake8",
]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}


[tool.setuptools_scm]
write_to = "sitkibex/_version.py"
local_scheme = "dirty-tag"


[tool.pytest.ini_options]
junit_family = "xunit2"
Expand Down
3 changes: 0 additions & 3 deletions requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SimpleITK >= 2.0.0
click
numpy
zarr
53 changes: 0 additions & 53 deletions setup.py

This file was deleted.

15 changes: 2 additions & 13 deletions sitkibex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,9 @@
from .resample import resample

try:
from importlib.metadata import version, PackageNotFoundError

__version__ = version(__name__)
from ._version import version as __version__
except ImportError:
from pkg_resources import get_distribution, DistributionNotFound

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
except PackageNotFoundError:
# package is not installed
pass
__version__ = "unknown version"

__author__ = ["Bradley Lowekamp"]

Expand Down

0 comments on commit b81be0e

Please sign in to comment.