-
Notifications
You must be signed in to change notification settings - Fork 553
Closed
Description
Hi! Thanks for the great project.
I'm trying to create a Python package using Codon. I've written a small example that uses multiple files, but I'm confused about how to build it correctly.
Here's my file structure:
mymodule/
├── __init__.py
└── main.py
setup.py
__init__.py
from .main import MyClass, ack
print("Hello, Codon! in __init__.py")
main.py
print("Hello, Codon! in main.py")
@dataclass(python=True)
class MyClass:
def __init__(self):
print("MyClass initialized")
def say_hello(self):
print("Hello, Codon!")
def ack(m: int, n: int) -> int:
if m == 0:
return n + 1
elif n == 0:
return ack(m - 1, 1)
else:
return ack(m - 1, ack(m, n - 1))
I followed the documentation and created a setup.py
that builds the extension using Codon.
However, when I try to import MyClass
or ack
, I get an ImportError
. It seems that only the file specified in the extension (__init__.py
) is being compiled.
What's the proper way to build a Codon-based Python extension that includes multiple files?
The full example is here:
👉 https://github.com/sk-uma/codon-pyext-example
Thanks in advance for any help!
Metadata
Metadata
Assignees
Labels
No labels