Skip to content

Commit

Permalink
Merge pull request #59 from PandaGab/fix-installation
Browse files Browse the repository at this point in the history
Fix installation
  • Loading branch information
aldro61 authored Oct 11, 2024
2 parents 3db2ed8 + d5382d4 commit 815f88b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 25 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include cpp_extensions/*
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ Marchand, M., & Taylor, J. S. (2003). The set covering machine. Journal of Machi
```
pip install pyscm-ml
```
or
or locally with

```
python setup.py install
python -m pip install -e .
```

## Running tests
```
python setup.py test
python -m pip install pytest
python -m pytest
```

## Contributors
Expand Down
7 changes: 3 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package: .dev-dependencies
rm -r ./dist ./build
python setup.py sdist
python setup.py bdist_wheel
rm -r ./dist || true
python -m build

upload-pypi: .dev-dependencies
twine upload --skip-existing dist/* --verbose
Expand All @@ -10,4 +9,4 @@ upload-testpypi: .dev-dependencies
twine upload --skip-existing --repository testpypi dist/* --verbose

.dev-dependencies:
pip install wheel twine
pip install build twine
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "numpy<2"]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy
numpy<2
scikit-learn
six
20 changes: 3 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from numpy import get_include as get_numpy_include
import numpy
from platform import system as get_os_name
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext as _build_ext
Expand All @@ -28,25 +28,15 @@
os_compile_flags = []


# Required for the automatic installation of numpy
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy

self.include_dirs.append(numpy.get_include())


solver_module = Extension(
"pyscm._scm_utility",
language="c++",
sources=["cpp_extensions/utility_python_bindings.cpp", "cpp_extensions/solver.cpp"],
extra_compile_args=["-std=c++0x"] + os_compile_flags,
include_dirs=[numpy.get_include()]
)

dependencies = ["numpy", "scipy", "scikit-learn", "six"]
dependencies = ["numpy<2", "scikit-learn", "six"]

with open("README.md", "r") as f:
long_description = f.read()
Expand All @@ -55,8 +45,6 @@ def finalize_options(self):
name="pyscm-ml",
version="1.1.1",
packages=find_packages(),
cmdclass={"build_ext": build_ext},
setup_requires=dependencies,
install_requires=dependencies,
author="Alexandre Drouin",
author_email="[email protected]",
Expand All @@ -77,6 +65,4 @@ def finalize_options(self):
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
ext_modules=[solver_module],
test_suite="nose.collector",
tests_require=["nose"],
)

0 comments on commit 815f88b

Please sign in to comment.