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

WIP: Do not install optional requirements when building docker images for PyPI #850

Merged
merged 12 commits into from
Jun 13, 2024

Conversation

jesper-friis
Copy link
Collaborator

@jesper-friis jesper-friis commented Jun 11, 2024

Description

Try to make the building of docker images and PyPI wheels leaner by removing all optional requirements. We only want to build and distribute a DLite Python package that only depends on NumPy. The user can always install the additional requirements later, or by install DLite with

pip install dlite-python[full]

The main feature of this PR is the removal of optional Python requirements when building wheels. Other fixes to make the CI tests to pass, includes:

  • Fixed building Windows wheel by explicitly specifying Python version setup.py
  • Fixed building musllinux wheel by removing support for Python 3.12 on musllinux_1_2_i686 (a rare platform) since building NumPy fails by complaining about it can't find NumPy. Can be readded in a later PR
  • Document our general support Python 3.12 (except for musllinux_1_2_i686)
  • Made the docker images even leaner by only including a single layer and removing temporary files after build
  • Some general code cleanup of setup.py and other files

Type of change

  • Bug fix & code cleanup
  • New feature
  • Documentation update
  • Test update

Checklist for the reviewer

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?

@jesper-friis jesper-friis changed the title Do not install optional requirements when building docker images for PyPI WIP: Do not install optional requirements when building docker images for PyPI Jun 11, 2024
Copy link
Contributor

@torhaugl torhaugl left a comment

Choose a reason for hiding this comment

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

This PR fixes CI for musllinux and windows. It does not work for musllinux 32bit python 3.12, but that can be fixed in a seperate issue. The fix for Windoes seems to by this FIND_VIRTUALENV CMake variable and specifying the python version. The fix for musllinux was installing openssl-dev.

It also tries to downsize the Dockerfiles by chaining together RUN commands, as well as removing optional requirements during compilation. There is also some cleanup of the code.

It is not fully clear to me that pip install dlite-python[full] still works as intended, but if it does, then I think this can be merged. Otherwise, if you are not sure Jesper, I think this can be split into one MR that fixes the CI for musllinux and windows, then another that removes dependencies and reduces the size of the image.

@jesper-friis
Copy link
Collaborator Author

The fix for Windoes seems to by this FIND_VIRTUALENV CMake variable and specifying the python version. The fix for musllinux was installing openssl-dev.

Yes, in addition we had to explicitly specify PYTHON_VERSION in setup.py for Windows.

It is not fully clear to me that pip install dlite-python[full] still works as intended.

Agree, we have to check that. But I think we have to merge and make a new release to test that.

@jesper-friis jesper-friis merged commit 509732b into master Jun 13, 2024
13 checks passed
@jesper-friis jesper-friis deleted the lean-dockerfiles branch June 13, 2024 10:37
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

Successfully merging this pull request may close these issues.

2 participants