Skip to content

Commit

Permalink
Merge pull request #7 from Barsoomx/master
Browse files Browse the repository at this point in the history
Transition to PEP 518 Build System spec with pyproject.toml
  • Loading branch information
djdt authored Mar 21, 2024
2 parents 3926e2b + 728f6c8 commit 3bd10a4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 32 deletions.
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[build-system]
requires = ["setuptools", "wheel", "Cython", "numpy"]
build-backend = "setuptools.build_meta"

[project]
name = "ckwrap"
version = "1.2.1"
dependencies = [
"numpy",
"Cython",
]
description = "Python wrapper for Ckmeans.1d.dp, 4.3.5."
authors = [{name = "djdt"}]
license = {file = "LICENSE"}
readme = "README.md"

[project.urls]
Homepage = "https://github.com/djdt/ckwrap"

[project.optional-dependencies]
test = [
"pytest",
"scipy",
]

[tool.setuptools]
packages = ["ckwrap"]
47 changes: 15 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,28 @@
from Cython.Build import cythonize
from setuptools import setup, Extension
import numpy as np
from Cython.Build import cythonize

with open("README.md") as fp:
long_description = fp.read()

sources = [
"ckwrap/_ckwrap.pyx",
"Ckmeans.1d.dp/src/dynamic_prog.cpp",
"Ckmeans.1d.dp/src/EWL2_dynamic_prog.cpp",
"Ckmeans.1d.dp/src/EWL2_fill_log_linear.cpp",
"Ckmeans.1d.dp/src/EWL2_fill_quadratic.cpp",
"Ckmeans.1d.dp/src/EWL2_fill_SMAWK.cpp",
"Ckmeans.1d.dp/src/fill_log_linear.cpp",
"Ckmeans.1d.dp/src/fill_quadratic.cpp",
"Ckmeans.1d.dp/src/fill_SMAWK.cpp",
"Ckmeans.1d.dp/src/select_levels.cpp",
"Ckmeans.1d.dp/src/weighted_select_levels.cpp",
]

# Extension definition remains similar to your current setup.py
ckwrap = Extension(
name="_ckwrap",
sources=sources,
sources=[
"ckwrap/_ckwrap.pyx",
"Ckmeans.1d.dp/src/dynamic_prog.cpp",
"Ckmeans.1d.dp/src/EWL2_dynamic_prog.cpp",
"Ckmeans.1d.dp/src/EWL2_fill_log_linear.cpp",
"Ckmeans.1d.dp/src/EWL2_fill_quadratic.cpp",
"Ckmeans.1d.dp/src/EWL2_fill_SMAWK.cpp",
"Ckmeans.1d.dp/src/fill_log_linear.cpp",
"Ckmeans.1d.dp/src/fill_quadratic.cpp",
"Ckmeans.1d.dp/src/fill_SMAWK.cpp",
"Ckmeans.1d.dp/src/select_levels.cpp",
"Ckmeans.1d.dp/src/weighted_select_levels.cpp",
],
language="c++",
include_dirs=["Ckmeans.1d.dp/src", np.get_include()],
extra_compile_args=["-std=c++11", "-g0"],
)


setup(
name="ckwrap",
version="1.2.0",
description="Python wrapper for Ckmeans.1d.dp, 4.3.5.",
long_description=long_description,
long_description_content_type="text/markdown",
author="djdt",
license="LGPL",
url="https://github.com/djdt/ckwrap",
packages=["ckwrap"],
package_data={"ckwrap": ["*.pxd"]},
ext_modules=cythonize(ckwrap),
install_requires=["numpy", "Cython"],
tests_require=["pytest", "scipy"],
)

0 comments on commit 3bd10a4

Please sign in to comment.