Skip to content

Compiling the Python script into native module using Cython #221

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

davidhjp01
Copy link

Added a build option to compile the Python code into a native module using Cython.

@davidhjp01
Copy link
Author

davidhjp01 commented Oct 16, 2024

@Jorgelmh need you to check if using pGlobals is okay instead of pLocals for supporting inheritance.

}

PyObject* pGlobals = PyModule_GetDict(pyModule);
auto deepestFile = searchLeafClassName(pGlobals);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jorgelmh passing pGlobals here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inheritance seems to work fine, just tried using the new binaries in component-model and seems to work as expected. I'd still recommend we wait until Lars reviews this part as I'm not sure if it might affect other functionality.

@markaren
Copy link
Member

Is this approach portable?

@davidhjp01
Copy link
Author

davidhjp01 commented Oct 17, 2024

Is this approach portable?

Hi Lars, this approach still requires Python runtime and dependencies used by the Python script, but it is to hide the main FMU logic by compiling it into a platform-dependent binary.

@markaren
Copy link
Member

markaren commented Oct 17, 2024

Yeah, I was thinking about platform portability. So when compiled on e.g. Windows this will only work on another Windows PC. What about Python version compatibility? In any case I think it needs som way of documenting which platform it is compiled for and in worst case throw an error saying this FMU is built for a specific platform.

@markaren
Copy link
Member

If the above comment could be addressed, we may move forward with this PR.

@davidhjp01
Copy link
Author

Hi, unfortunately I did not have much time to follow up on this, will do it eventually..

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

Successfully merging this pull request may close these issues.

3 participants