Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup: use scikit-build for building C module #424

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_skbuild
doc/_build
doc/auto_examples
doc/gen_modules
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel", "scikit-build", "cmake", "cython", "ninja"]
13 changes: 11 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# build-system
cmake
cython
ninja
scikit-build
setuptools>=28.0.0
wheel

# testing
codecov
coverage
flake8
mock
pytest
pytest-cov
pytest-sugar
setuptools>=28.0.0

# deployment
twine
wheel
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import io
from setuptools import setup
from setuptools.extension import Extension
from skbuild import setup
import versioneer

with io.open('README.md', encoding='utf_8') as fp:
Expand All @@ -19,9 +18,9 @@
license='MIT',
install_requires=['numpy>=1.6.1', 'pillow'],
test_requires=['matplotlib'],
ext_modules=[Extension("wordcloud.query_integral_image",
["wordcloud/query_integral_image.c"])],
entry_points={'console_scripts': ['wordcloud_cli=wordcloud.__main__:main']},
packages=['wordcloud'],
package_data={'wordcloud': ['stopwords', 'DroidSansMono.ttf']}
package_data={'wordcloud': ['stopwords', 'DroidSansMono.ttf']},
cmake_languages=('C',),
cmake_source_dir='wordcloud'
)
13 changes: 13 additions & 0 deletions wordcloud/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.12.0)
project(hello LANGUAGES C)

find_package(PythonExtensions REQUIRED)
find_package(Cython REQUIRED)

set(module "query_integral_image")

add_cython_target(${module} ${module}.pyx C OUTPUT_VAR sources)
add_library(${module} MODULE ${sources})
python_extension_module(${module})

install(TARGETS ${module} LIBRARY DESTINATION wordcloud)
Loading