dzs commited on
Commit
1df9f37
·
1 Parent(s): ccaeabc

added debug mechanism

Browse files
Files changed (4) hide show
  1. fast_bisect/__init__.py +2 -12
  2. postBuild +1 -0
  3. pyproject.toml +3 -0
  4. setup.py +6 -4
fast_bisect/__init__.py CHANGED
@@ -1,15 +1,5 @@
1
  # fast_bisect/__init__.py
2
- import os
3
 
4
- FAST_BISECT_IMPL = None
5
 
6
- try:
7
- from .fast_bisect import cbisect # compiled extension
8
- FAST_BISECT_IMPL = "compiled"
9
- except Exception as e:
10
- # root-finder fallback (if that's what cbisect is meant to be)
11
- from scipy.optimize import bisect as cbisect
12
- FAST_BISECT_IMPL = f"scipy_fallback ({type(e).__name__}: {e})"
13
-
14
- if os.environ.get("FAST_BISECT_DEBUG", "0") == "1":
15
- print("fast_bisect impl:", FAST_BISECT_IMPL)
 
1
  # fast_bisect/__init__.py
 
2
 
3
+ from .fast_bisect import cbisect
4
 
5
+ __all__ = ["cbisect"]
 
 
 
 
 
 
 
 
 
postBuild CHANGED
@@ -1 +1,2 @@
 
1
  pip install -e .
 
1
+ pip install -U pip
2
  pip install -e .
pyproject.toml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [build-system]
2
+ requires = ["setuptools", "wheel", "Cython", "numpy"]
3
+ build-backend = "setuptools.build_meta"
setup.py CHANGED
@@ -1,13 +1,15 @@
1
  from setuptools import setup, Extension
2
  from Cython.Build import cythonize
3
- from pathlib import Path
4
 
5
  ext = Extension(
6
- name="fast_bisect.fast_bisect",
7
- sources=[str(Path("fast_bisect") / "fast_bisect.pyx")],
 
8
  )
9
 
10
  setup(
11
  name="fast_bisect",
12
- ext_modules=cythonize([ext]),
 
13
  )
 
1
  from setuptools import setup, Extension
2
  from Cython.Build import cythonize
3
+ import numpy as np
4
 
5
  ext = Extension(
6
+ name="fast_bisect.fast_bisect", # import fast_bisect.fast_bisect
7
+ sources=["fast_bisect/fast_bisect.pyx"],
8
+ include_dirs=[np.get_include()],
9
  )
10
 
11
  setup(
12
  name="fast_bisect",
13
+ version="0.0.0",
14
+ ext_modules=cythonize([ext], compiler_directives={"language_level": "3"}),
15
  )