Skip to content

Commit 908a084

Browse files
TeranisCopilot
andcommitted
fix: add setup.py
Co-authored-by: Copilot <copilot@github.com>
1 parent 2f3a240 commit 908a084

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ setup.cfg
4141

4242
# Starting from pip 21.3 setup.py is not needed anymore
4343
# and we rely only on setup.cfg for env
44-
setup.py
4544
environment.yml
4645
# requirements.txt
4746
conda_env_list_commands.txt

setup.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# only needed for cython extensions, not needed to run normally
2+
import sys
3+
from setuptools import setup, Extension
4+
from Cython.Build import cythonize
5+
import numpy as np
6+
7+
setup(
8+
ext_modules=cythonize(
9+
Extension(
10+
"cellacdc.regionprops_helper",
11+
sources=["cellacdc/regionprops_helper.pyx"],
12+
include_dirs=[np.get_include()],
13+
),
14+
annotate=True,
15+
build_dir="build/cython", # .c and .html files go here
16+
)
17+
)
18+
# move compiled binary to precompiled/
19+
import shutil
20+
import os
21+
22+
src_dir = "cellacdc"
23+
for filename in os.listdir(src_dir):
24+
if filename.startswith("regionprops_helper") and (filename.endswith(".so") or filename.endswith(".pyd")):
25+
target_path = os.path.join("cellacdc", "precompiled", filename)
26+
shutil.move(os.path.join(src_dir, filename), target_path)
27+
print(f"Moved {filename} to {target_path}")
28+

0 commit comments

Comments
 (0)