Skip to content

Commit

Permalink
fixing include .pyx files in build
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostert committed Aug 21, 2024
1 parent 26abdc1 commit 7de7507
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 161 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cython
pip install tox tox-gh-actions
- name: Test generator and physics output
run: tox
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [
"setuptools>=42",
"wheel",
"numpy",
"cython>=3.0a6"
"cython>=3.0a6",
]
build-backend = "setuptools.build_meta"

Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ package_dir =

packages = find:

python_requires = >=3.7
python_requires = >=3.8

install_requires =
dill
Expand All @@ -48,6 +48,7 @@ install_requires =
pyhepmc>=2.7.1

setup_requires =
cython
numpy

[options.packages.find]
Expand All @@ -59,6 +60,7 @@ where = src
include/*/*.txt
include/*/*.py
include/assets/*
*.pyx

DarkNews = py.typed

Expand Down
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,19 @@ def no_cythonize(extensions, **_ignore):


extensions = [
Extension("DarkNews.Cfourvec", ["src/DarkNews/Cfourvec.pyx"]),
Extension("DarkNews.Cfourvec", ["src/DarkNews/Cfourvec.pyx"], include_dirs=[np.get_include()]),
]
CYTHONIZE = cythonize is not None
print("Cythonize env var:", CYTHONIZE)
if CYTHONIZE:
compiler_directives = {"language_level": 3, "embedsignature": True}
extensions = cythonize(extensions, compiler_directives=compiler_directives)
else:
extensions = no_cythonize(extensions)


setup_args = dict(
# ext_modules=cythonize(["src/DarkNews/Cfourvec.pyx"]),
ext_modules=extensions,
include_dirs=np.get_include(),
ext_modules=cythonize(["src/DarkNews/Cfourvec.pyx"]),
# ext_modules=extensions,
include_dirs=[np.get_include()],
)


Expand Down
Loading

0 comments on commit 7de7507

Please sign in to comment.