diff --git a/.travis.yml b/.travis.yml index 92f41e7..17bcb23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,10 +21,7 @@ install: - sudo apt update - sudo apt install libboost-dev - pip install -r requirements.txt -- python setup.py install -- pip install pytest -- pip install coveralls -- pip install pytest-cov +- pip install . script: - pytest --cov-append --cov=./waterz ./tests --verbose diff --git a/README.md b/README.md index 8ace4b3..3d6e2bf 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,21 @@ Based on the watershed implementation of [Aleksandar Zlateski](https://bitbucket # Installation Install c++ dependencies: + ``` sudo apt install libboost-dev ``` -Install from pipy +Install from PyPI + ``` pip install waterz ``` -install manually +install from local version + ``` -pip install -r requirements.txt -python setup.py install +pip install . ``` # Usage diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3872003 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "numpy", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 8dbecfc..6dada00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,8 @@ numpy cython + +# dev + +pytest +coveralls +pytest-cov diff --git a/setup.py b/setup.py index 87774a6..6d8e942 100644 --- a/setup.py +++ b/setup.py @@ -3,15 +3,12 @@ from setuptools.command.build_ext import build_ext as _build_ext # from Cython.Build import cythonize import os +import builtins VERSION = '0.9.5' PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__)) -with open(os.path.join(PACKAGE_DIR, "requirements.txt")) as f: - requirements = f.read().splitlines() - requirements = [l for l in requirements if not l.startswith('#')] - with open(os.path.join(PACKAGE_DIR, "README.md"), "r") as fh: long_description = fh.read() @@ -24,7 +21,7 @@ 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 + builtins.__NUMPY_SETUP__ = False import numpy self.include_dirs.append(numpy.get_include()) @@ -59,7 +56,7 @@ def finalize_options(self): license='MIT', cmdclass={'build_ext': build_ext}, setup_requires=['numpy'], - install_requires=requirements, + install_requires=['numpy', 'cython'], tests_require=['pytest'], packages=find_packages(), package_data={ @@ -73,5 +70,6 @@ def finalize_options(self): "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - ] + ], + requires_python=">=3.6, <4", ) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..0085b8a --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,9 @@ +import sys +from pathlib import Path + +# waterz is not locally importable; +# this snippet forces the tests to use the installed version. +# See here for more details: +# https://stackoverflow.com/questions/67176036/how-to-prevent-pytest-using-local-module +project_dir = str(Path(__file__).resolve().parent.parent) +sys.path = [p for p in sys.path if not p.startswith(project_dir)]