Skip to content

Commit

Permalink
Support using system CMake and Ninja when available
Browse files Browse the repository at this point in the history
Add the requirements for `cmake` and `ninja` PyPI packages only when
the respective system tools are not available, in order to permit
using the system tools instead.  This avoids unnecessary dependencies
on third-party executables, and permits users to benefit from greater
portability due to downstream patching of CMake.
  • Loading branch information
mgorny committed Feb 10, 2025
1 parent b33b809 commit 69f2793
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ requires = [
"scikit-build>=0.13.1",
"Cython>=0.24",
"scipy>=0.16",
"cmake>=3.18",
"ninja"
]
build-backend = "setuptools.build_meta"

Expand Down
9 changes: 9 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
import os.path
import shutil

from setuptools import find_packages
from skbuild import setup
Expand All @@ -18,6 +19,13 @@ def exclude_non_implicit_cmake_files(cmake_manifest):
return [f for f in cmake_manifest if "implicit" in f]


setup_requires = []
if shutil.which("cmake") is None:
setup_requires += ["cmake>=3.18"]
if shutil.which("ninja") is None:
setup_requires += ["ninja"]


setup(
name="implicit",
version="0.7.2",
Expand All @@ -44,6 +52,7 @@ def exclude_non_implicit_cmake_files(cmake_manifest):
"Collaborative Filtering, Recommender Systems"
),
packages=find_packages(),
setup_requires=setup_requires,
install_requires=["numpy>=1.17.0", "scipy>=0.16", "tqdm>=4.27", "threadpoolctl"],
cmake_process_manifest_hook=exclude_non_implicit_cmake_files,
)

0 comments on commit 69f2793

Please sign in to comment.