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

Python packages working is unpythonic #373

Open
cerna opened this issue Feb 2, 2022 · 0 comments
Open

Python packages working is unpythonic #373

cerna opened this issue Feb 2, 2022 · 0 comments

Comments

@cerna
Copy link
Contributor

cerna commented Feb 2, 2022

With the recent CMake rework the majority of Python code was structured so the modules belong to its own packages. This allows for tight enclosing of the logic and it's implementation, distribution via PEP503 API and installation in arbitrary Python virtual environments. This all in theory should help the ease of development and deployment.

Problem is in how the Python packages are now represented in the Machinekit-HAL repository. Because the structure is not how one would presume normal Python project should look like. Instead CMake at configure stage creates the tree structure via multiple configure_file calls in the BUILD TREE. From these the wheel are build and these are then installed into the development virtual environment from where the code can be run as part of the Machinekit-HAL suite.

As you can probably determine from the description alone, this makes for terrible developer's experience. He has to change the code, rerun the CMake program so the changes are propagated to the BUILD TREE from BINARY TREE, then he has to build the specific Python target to get the wheel out of it and then he has to rebuild the whole development virtual environment. (Which can take alone 30 seconds.)

(One of reasons and the main one why this was done how it was done is to avoid polluting BINARY TREE with any files Python interpreter creates when it is run [or can create depending on settings], for example the Python bytecode, PyTest cache etc. All has to be run from BUILD TREE to contain it.)

A much better workflow would be to have same structure in BINARY TREE and in BUILD TREE, maybe - if this can work - have only symlinks in BUILD TREE so that the CMake does not need to be rerun at each change to the code and start using the developing mode (I think it is called a editable mode in pip) in the development virtual environment. While creating wheels/sdists only when installing and/or packaging.

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

1 participant