Skip to content

Commit

Permalink
fix sdist build error ValueError: 'chgnet/graph/cygraph.pyx' doesn't …
Browse files Browse the repository at this point in the history
…match any files

  File "/tmp/build-env-d_rbfy8m/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 119, in nonempty
    raise ValueError(error_msg)
ValueError: 'chgnet/graph/cygraph.pyx' doesn't match any files

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
  • Loading branch information
janosh committed Jul 22, 2023
1 parent 9dc1f2c commit 7cbff96
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:

- name: Install dependencies
run: |
pip install cython
python setup.py build_ext --inplace
pip install -e .[test]
- name: Run Tests
Expand Down
22 changes: 17 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
from __future__ import annotations

from Cython.Build import cythonize
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext

extensions = cythonize(
[Extension("chgnet.graph.cygraph", ["chgnet/graph/cygraph.pyx"])]
)

setup(ext_modules=extensions)
class BuildExt(build_ext):
"""Custom build extension."""

def finalize_options(self):
"""Override finalize_options to ensure we don't run cythonize when making
a source distribution.
"""
import Cython.Build

self.distribution.ext_modules = Cython.Build.cythonize(
[Extension("chgnet.graph.cygraph", ["chgnet/graph/cygraph.pyx"])]
)
super().finalize_options()


setup(cmdclass={"build_ext": BuildExt})

0 comments on commit 7cbff96

Please sign in to comment.