Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile python package into a single so/pyd file #6575

Open
Jzhenli opened this issue Dec 23, 2024 · 1 comment
Open

compile python package into a single so/pyd file #6575

Jzhenli opened this issue Dec 23, 2024 · 1 comment

Comments

@Jzhenli
Copy link

Jzhenli commented Dec 23, 2024

Is your feature request related to a problem? Please describe.

Hi, I'm not sure if it's possible to compile a pure python package (which should be a folder and include many *.py files) into a single so/pyd file?

Describe the solution you'd like.

some times we implement a python package, when we want to protect the code, we need to build all these files one by one to so/pyd file, if we can build all of them into a single file, it will be more convenient and hide the code structure.

Describe alternatives you've considered.

add an args "--module" for package compile.

Additional context

No response

@da-woods
Copy link
Contributor

I'm not sure if it's possible to compile a pure python package (which should be a folder and include many *.py files) into a single so/pyd file?

It isn't really supported. They're is a hacky workaround and a few third-party tools that automate the hacky workaround described at https://stackoverflow.com/q/30157363.

I don't really recommend spending too much time trying to make this work though - it isn't how Cython is designed to operate and you will run into problems.

we want to protect the code

This is a use case that I personally am not interested in supporting (I think most of the other Cython devs feel similarly, but I can't say that with absolute confidence).

Cython is open source so you're welcome to use it however you like. But we generally haven't implemented features that are only of interest for "protecting" code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants