Skip to content

Commit

Permalink
Make it buildable with Cython==3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vovaf709 committed Aug 9, 2023
1 parent 47f7f05 commit 0c5f098
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion _pyproject_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@
from setuptools.command.build_py import build_py


class NumpyImport:
class NumpyImport(dict):
"""Hacky way to return Numpy's include path with lazy import."""

# Must be json-serializable due to
# https://github.com/cython/cython/blob/6ad6ca0e9e7d030354b7fe7d7b56c3f6e6a4bc23/Cython/Compiler/ModuleNode.py#L773
def __init__(self):
return super().__init__(self, description=self.__doc__)

# Must be hashable due to
# https://github.com/cython/cython/blob/6ad6ca0e9e7d030354b7fe7d7b56c3f6e6a4bc23/Cython/Compiler/Main.py#L307
def __hash__(self):
return id(self)

def __repr__(self):
import numpy as np

Expand Down
14 changes: 13 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,19 @@
]


class NumpyImport:
class NumpyImport(dict):
"""Hacky way to return Numpy's include path with lazy import."""

# Must be json-serializable due to
# https://github.com/cython/cython/blob/6ad6ca0e9e7d030354b7fe7d7b56c3f6e6a4bc23/Cython/Compiler/ModuleNode.py#L773
def __init__(self):
return super().__init__(self, description=self.__doc__)

# Must be hashable due to
# https://github.com/cython/cython/blob/6ad6ca0e9e7d030354b7fe7d7b56c3f6e6a4bc23/Cython/Compiler/Main.py#L307
def __hash__(self):
return id(self)

def __repr__(self):
import numpy as np

Expand Down

0 comments on commit 0c5f098

Please sign in to comment.