Skip to content

Commit

Permalink
Move to poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBB committed Apr 12, 2023
1 parent 3c6cc82 commit fd61d97
Show file tree
Hide file tree
Showing 6 changed files with 318 additions and 13 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
pip install -r requirements.dev.txt
- name: Install package
run: |
pip install -vvv .
python -m pip install --upgrade pip
python -m pip install poetry
make install
- name: Test with pytest
run: |
pytest --benchmark-skip
make pytest
build_wheels:
name: Build wheels
Expand All @@ -52,15 +49,14 @@ jobs:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install cibuildwheel
python -m pip install --upgrade pip
python -m pip install cibuildwheel
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-*
CIBW_SKIP: '*musllinux*'
CIBW_BEFORE_BUILD: pip install -r requirements.dev.txt
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
Expand All @@ -78,10 +74,10 @@ jobs:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r requirements.dev.txt
python -m pip install --upgrade pip
python -m pip install poetry
- name: Build sdist
run: python setup.py sdist
run: poetry build -f sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
Expand Down
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: install mypy lint pytest test fmt fmtcheck

install:
poetry install --with=dev

mypy:
poetry run mypy splipy

lint:
poetry run ruff splipy

pytest:
poetry run pytest --benchmark-skip

bench:
poetry run pytest --benchmark-only

fmt:
poetry run black splipy
poetry run isort splipy

fmtcheck:
poetry run black splipy --check
poetry run isort splipy --check

test: mypy pytest lint fmtcheck
19 changes: 19 additions & 0 deletions build_ext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
import sys

from setuptools import Extension
from Cython.Build import cythonize
import numpy as np

extensions = cythonize(
Extension(
"splipy.basis_eval",
["splipy/basis_eval.pyx"],
include_dirs=[np.get_include()],
)
)

def build(setup_kwargs):
setup_kwargs.update({
"ext_modules": extensions,
})
198 changes: 198 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[tool.poetry]
name = "splipy"
version = "1.7.4"
description = "Spline modelling library for Python"
authors = [
"Kjetil Andre Johannessen <kjetijo@gmail.com>",
"Eivind Fonn <evfonn@gmail.com>",
]
maintainers = [
"Kjetil Andre Johannessen <kjetijo@gmail.com>",
"Eivind Fonn <evfonn@gmail.com>",
]
license = "GLP-3.0-only"
readme = "README.rst"
homepage = "https://github.com/SINTEF/Splipy"
repository = "https://github.com/SINTEF/Splipy"
documentation = "https://sintef.github.io/Splipy/"
keywords = [
"Bspline",
"Splines",
"NURBS",
"Curve",
"Surface",
"Volume",
"Interpolation",
"Approximation",
"Fit",
"Integration",
"Differentiation",
]
classifiers = [
"Development Status :: 5 - Beta",
"Topic :: Multimedia :: Graphics :: 3D Modeling",
"Topic :: Scientific/Engineering :: Mathematics",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
]
include = [
"splipy/templates/*.bpt",
{ path = "splipy/*.so", format="wheel" },
]

[tool.poetry.build]
script = "build_ext.py"
generate-setup-file = true

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
cython = "^0.29.34"
numpy = "^1.24.2"
scipy = "^1.10.1"

[tool.poetry.extras]
FiniteElement = ["nutils"]
Images = ["opencv-python"]
Rhino = ["rhino3dm"]

[tool.poetry.group.dev.dependencies]
mypy = "^1.2.0"
pytest = "^7.3.0"
pytest-benchmark = "^4.0.0"

[build-system]
requires = ["poetry-core", "cython", "numpy", "wheel", "setuptools"]
build-backend = "poetry.core.masonry.api"
File renamed without changes.

0 comments on commit fd61d97

Please sign in to comment.