Skip to content

Commit

Permalink
Merge pull request #3 from gschramm/pyproject
Browse files Browse the repository at this point in the history
Pyproject
  • Loading branch information
gschramm authored Nov 27, 2024
2 parents 19b2a57 + c69b784 commit 116da0b
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 46 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build_python_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and Test Package

on:
push:
branches:
- master
pull_request:

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
with:
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: 3.12 # Change to the desired Python version

# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
# Build the package
- name: Build the package
run: |
python -m build
# Test importing the package
- name: Test the package import
run: |
python -m pip install dist/*.whl
python -c "import pymirc; print('pymirc version:', pymirc.__version__)"
2 changes: 2 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history to ensure tags are available
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
Expand Down
9 changes: 4 additions & 5 deletions pymirc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
from . import metrics
from . import viewer

from pkg_resources import get_distribution, DistributionNotFound
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
__version__ = version("pymirc")
except PackageNotFoundError:
__version__ = "unknown"
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
requires = ["setuptools >= 61.0", "wheel", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = { find = { include = ["pymirc*"], exclude = ["tutorial*"] } }

[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "dirty-tag"

[project]
name = "pymirc"
dynamic = ["version"]
dependencies = [
"numpy>=1.15",
"scipy>=1.1",
"matplotlib>=2.2.2",
"pydicom>=2.0",
"scikit-image>=0.14",
"numba>=0.39",
"nibabel>=3.0",
]
requires-python = ">=3.8"
authors = [
{name = "Georg Schramm"},
{name = "Tom Eelbode"},
{name = "Jeroen Bertels"},
]
maintainers = [
{name = "Georg Schramm", email = "[email protected]"}
]
description = "Python imaging utilities developed in the medical imaging research center of KU Leuven"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Operating System :: OS Independent",
]

[project.urls]
Repository = "https://github.com/gschramm/pymirc"
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

31 changes: 0 additions & 31 deletions setup.py

This file was deleted.

9 changes: 4 additions & 5 deletions style_guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Style guide for pymirc
======================
# Style guide for pymirc

* no tabs in source code (use spaces)
* use 2 or 4 spaces for indentation
* use numpy style for docstrings https://sphinxcontrib-napoleon.readthedocs.io/en/latest/
- no tabs in source code (use spaces)
- use numpy style for docstrings https://sphinxcontrib-napoleon.readthedocs.io/en/latest/
- use black formatter

0 comments on commit 116da0b

Please sign in to comment.