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 dev - Build python packages for each of supported python versions. #15931

Closed
wants to merge 4 commits into from

Conversation

smoser
Copy link
Member

@smoser smoser commented Mar 27, 2024

I need to write some doc for this PR.

@smoser smoser requested a review from xnox March 27, 2024 21:06
@smoser smoser force-pushed the python-dev branch 2 times, most recently from 5614aad to 119cac8 Compare March 28, 2024 17:23
@smoser
Copy link
Member Author

smoser commented Mar 28, 2024

Things to point out that a reviewer would want to look at:

  1. use of 'py3-supported-python' - this is a way to get rid of a hard coded list of build time dependencies.
  2. use of py3-supported- (like 'py3-supported-installer' or 'py3-supported-pip') which allows a package to build-depend on a single package rather than 3.
  3. building with other pythons outside wolfi is not great here.
  4. HACK/NEEDS FIXING - this currently moves all programs that are put into /usr/bin into /usr/pybin// so that py3.10-pip and py3.11-pip (which would both install /usr/bin/pip) can be installed together.

Things that would make life easier:

  • ability to loop or some other way avoid the '-supported' packages above.

  • dynamnically building subpackages (so we don't have to have 3 lines like below. I'd rather have it "just work" than require the yaml file to declare that there is a package).

    - name: pypi-wheels-${{vars.pypi-package}}
      pipeline:
        - uses: py/collect-wheels
    
  • not declare 'py-versions' everywhere.

@dlorenc
Copy link
Member

dlorenc commented Mar 28, 2024

I like this approach! it seems like it won't confuse our scanner/advisory feed because it's still one version of each python library just "linked" against different python versions.

@smoser smoser force-pushed the python-dev branch 6 times, most recently from c79bf48 to d259615 Compare March 29, 2024 16:46
@smoser
Copy link
Member Author

smoser commented Mar 29, 2024

I don't think the build failure right now is due to my changes, but rather the dependency resolver. I do not think it is a circular dependency (which did cause issues earlier)

2024-03-29T16:56:46.4906470Z 2024/03/29 16:56:46 INFO error during command execution: 
    failed to build package: unable to build guest: 
       unable to generate image: installing apk packages: 
         error getting package dependencies: 
         solving "py3-supported-gpep517" constraint: 
           resolving "py3-supported-gpep517-15-r3.apk" deps:
2024-03-29T16:56:46.4908250Z could not find package either named 
    py3.10-tomli or that provides py3.10-tomli for py3.10-gpep517

py3-tomli.yaml does build a py3.10-tomli-2.0.1-r5.apk.

It does build locally given this order:

py3-supported-python
py3-flit-core
py3-setuptools
py3-pip
py3-installer
py3-tomli
py3-gpep517
py3-flit-core
py3-wheel
py3-cython
py3-numpy
py3-pathspec
py3-pyyaml
py3-yamllint

@xnox
Copy link
Member

xnox commented Apr 23, 2024

This is really good.

  1. This will enable us to trivially build numpy image latest-3.12 latest-3.11 latest-3.10 images, and then choose whichever one we need to be shipped to the user.

  2. pybin thing is a necessary evil and that's fine to get there. However, I somehow feel we might want to auto-generate conflicting packages too. Or ask apko to move them around. Such that numpy image latest-3.12 tag has /usr/bin/numpy with the valid python.

  3. To land this safely I do wonder if we need to generate default symlinks in the top level package for now.

@xnox
Copy link
Member

xnox commented Apr 23, 2024


py3-tomli.yaml does build a py3.10-tomli-2.0.1-r5.apk.

we may need to land it first / separately, as that's install check rather than build check. And install checks are done after each build, rather than after all builds are completed first.

smoser and others added 3 commits May 15, 2024 18:09
At this point most things should use the py/pip-build-install pipeline
and generally look like py3-pyyaml

Also:
* rename cython.yaml, numpy.yaml to py3-<name>

  These are python packages and present in pypi, for
  consistency, name them like other python packages.

Co-authored-by: Dimitri John Ledkov <[email protected]>
flit-core has bootstrap_install.py to handle this, so we use it.

pip doesn't stricktly depend on wheel, although buidling many projects
assumes that it is there.
You can get started with:
   make package/pip-zipapp \
     package/py3-{supported-python,setuptools,installer,wheel,pip}

Then most of core deps are built.
@pnasrat
Copy link
Member

pnasrat commented Jun 17, 2024

Close in favor of #20318

@pnasrat pnasrat closed this Jun 17, 2024
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.

4 participants