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 #20318

Merged
merged 49 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
015c54e
Make several core python packages build for mulitple python versions.
smoser Mar 15, 2024
d259615
Resolve the dependency loop.
Mar 29, 2024
f521184
Merge main
xnox Apr 23, 2024
3a96413
Fun stuff
xnox Apr 23, 2024
820e540
Revert "Fun stuff"
xnox Apr 26, 2024
1df349d
Merge branch 'main' of https://github.com/wolfi-dev/os into python-dev
xnox Apr 26, 2024
27b22d6
Drop pybins and allow to install them all
xnox Apr 26, 2024
1aaf253
wip
xnox Apr 30, 2024
dc75866
Make several core python packages build for mulitple python versions.
smoser Mar 15, 2024
0618e50
Resolve the dependency loop.
Mar 29, 2024
3697501
Some cleanups of things. pip-build-install-bootstrap simplifies.
May 16, 2024
3203659
Merge branch 'main' of https://github.com/wolfi-dev/os into python-dev
xnox May 23, 2024
399b242
Upgrade setuptools
xnox May 23, 2024
9164430
Test setuptools
xnox May 23, 2024
35b2665
fixes
xnox May 23, 2024
19004cf
tomli
xnox May 23, 2024
54e9d98
foo
xnox May 23, 2024
337ede8
Merge branch 'main' of https://github.com/wolfi-dev/os into python-dev
xnox May 28, 2024
45b0e26
Add pip-zipapp.yaml file.
May 28, 2024
2daafb6
Merge branch 'python-dev' of https://github.com/smoser/wolfi-os into …
xnox May 28, 2024
2c6030b
Merge branch 'main' of https://github.com/wolfi-dev/os into python-dev
xnox May 28, 2024
634fa93
Remove no longer needed cython-0
xnox May 28, 2024
68b9a2f
Split wheel binary into -bin subpackage
xnox May 28, 2024
a2c8c0e
Make py3-pip coinstallable
xnox May 28, 2024
667f6a8
py3-supported-cython is not coinstallable, and not needed
xnox May 28, 2024
3c0e1c7
Fix py3-tomli priorities
xnox May 28, 2024
83eae21
py3-six fix up environment
xnox May 28, 2024
038bf1f
Fix up py3-numpy
xnox May 28, 2024
371edf6
Merge branch 'main' of https://github.com/wolfi-dev/os into python-dev
xnox May 28, 2024
4ba63ea
Fixup py3-pathspec
xnox May 29, 2024
2649591
Fixes
xnox May 29, 2024
958c89d
Remove duplicate patch
xnox May 29, 2024
6801483
Split numpy bins, in case something uses them
xnox May 29, 2024
96125aa
Fixup gpep517 dist-info and binaries
xnox May 29, 2024
bc08d0f
Include some bootstrap wheels from pypi in pip-zipapp
May 30, 2024
ccee10b
py3-pip make update check ignore beta b tags
pnasrat Jun 17, 2024
6cab0aa
py3-tomli epoch bump for merge
pnasrat Jun 17, 2024
168bda5
Merge branch 'main' into python-dev
pnasrat Jun 17, 2024
3710cfd
pip-zipapp lint clean
pnasrat Jun 17, 2024
1f219d8
py3-cython: fix typo in provides cython
pnasrat Jun 17, 2024
0f4779b
py3-cython fix spurious epoch bump
pnasrat Jun 17, 2024
bf6d717
Revert "Remove no longer needed cython-0"
pnasrat Jun 17, 2024
f4cfefb
py3-pyyaml: require py3-cython
pnasrat Jun 17, 2024
0fcf539
python packages: simplify build env deps
pnasrat Jun 17, 2024
d419de5
Merge remote-tracking branch 'upstream/main' into python-dev
pnasrat Jun 17, 2024
ef27c60
py3-gpep517 explicit setuptools dep
pnasrat Jun 17, 2024
8a0720d
py3-tomli don't use python/import
pnasrat Jun 17, 2024
dd74c20
py3-tomli fix typo
pnasrat Jun 17, 2024
1b2313a
Merge branch 'main' into python-dev
xnox Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions cython.yaml

This file was deleted.

61 changes: 0 additions & 61 deletions numpy.yaml

This file was deleted.

28 changes: 28 additions & 0 deletions pipelines/py/collect-wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Collect wheels built by a python pipeline

needs:
packages:
- util-linux

inputs:
dest:
description: the destination
default: ${{targets.subpkgdir}}/usr/share/wheels

pipeline:
xnox marked this conversation as resolved.
Show resolved Hide resolved
- name: "pip build ${{inputs.python}}"
runs: |
found=""
set --
for wheel in ./.wheels/*/*.whl; do
[ -f "$wheel" ] || continue
set -- "$@" "$wheel"
done
if [ $# -eq 0 ]; then
echo "No wheels found in $PWD/.wheels/*/*.whl"
exit 1
fi
mkdir -p ${{inputs.dest}}
echo "Found wheels:" "$@"
sha256sum "$@"
cp -v "$@" "${{inputs.dest}}"
18 changes: 18 additions & 0 deletions pipelines/py/install-compile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup, install and compile python

inputs:
python:
description: which python to use
required: true
dest:
description: the destination
default: ${{targets.subpkgdir}}

pipeline:
- name: "setup ${{inputs.python}}"
runs: |
${{inputs.python}} setup.py install --no-compile --root="${{targets.subpkgdir}}" --prefix=/usr
rm -Rf build/
- name: "compileall ${{inputs.python}}"
runs: |
${{inputs.python}} -m compileall --invalidation-mode=unchecked-hash -r100 ${{targets.subpkgdir}}/usr/lib/
58 changes: 58 additions & 0 deletions pipelines/py/pip-build-install-bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Use pip from a zipapp for bootstrap. Only for use with bootstrapping.

needs:
packages:
- pip-zipapp

inputs:
python:
description: which python to use
required: true
wheel:
description: build a wheel?
required: false
default: true
dest:
description: the destination
default: ${{targets.subpkgdir}}

pipeline:
- name: "pip-bootstrap build"
runs: |
export SOURCE_DATE_EPOCH=315532800
py=${{inputs.python}}
pipzip=/usr/share/pip-zipapp/pip-zipapp.pyz
[ -e "$pipzip" ] || { echo "missing pip-zip - $pipzip does not exist"; exit 1; }
[ -f "$pipzip" ] || { echo "missing pip-zip - $pipzip is not a file"; exit 1; }
pyver=$("$py" -c 'import sys; print("%s.%s" % (sys.version_info.major, sys.version_info.minor))')
sitepkgd=$("$py" -c 'import site; print(site.getsitepackages()[0])')
sitepkgd=${sitepkgd#/}
root=${{inputs.dest}}
wd="./.wheels/$pyver"
info() { echo "$@" 1>&2; }
vr() { info "execute:" "$@"; "$@"; }

tmpd=$(mktemp -d)
trap "rm -Rf '$tmpd'" EXIT

# --find-links to an empty dir and --no-index makes pip fully "offline"
distwheelsd="/usr/share/pip-zipapp/wheels"
mkdir -p "$distwheelsd"
info "$py is $pyver with site_packages dir '$sitepkgd'"

if [ "${{inputs.wheel}}" = "false" ]; then
info "skipping bdist-wheel"
vr "$py" "$pipzip" --python=/usr/bin/$py install --verbose --no-deps \
"--find-links=$distwheelsd" --no-index \
--force-reinstall --no-compile --prefix=/usr "--root=$root" .
else
vr "$py" "$pipzip" --python=/usr/bin/$py wheel --verbose "--wheel-dir=$wd" \
"--find-links=$distwheelsd" --no-index --no-deps .
set -- "$wd"/*.whl
[ -f "$1" ] || { info "did not produce a wheel in $wd"; exit 1; }
info "produced $# wheels: $*"
vr "$py" "$pipzip" --python=/usr/bin/$py install --verbose \
"--find-links=$distwheelsd" --no-index --no-build-isolation --no-deps \
--force-reinstall --no-compile --prefix=/usr "--root=$root" "$@"
fi
vr $py -m compileall --invalidation-mode=unchecked-hash -r100 "$root/$sitepkgd"
35 changes: 35 additions & 0 deletions pipelines/py/pip-build-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and install python package with pip

inputs:
python:
description: which python to use
required: true
dest:
description: the destination
default: ${{targets.subpkgdir}}

pipeline:
- name: "pip build ${{inputs.python}}"
runs: |
export SOURCE_DATE_EPOCH=315532800
py=${{inputs.python}}
pyver=$("$py" -c 'import sys; print("%s.%s" % (sys.version_info.major, sys.version_info.minor))')
sitepkgd=$("$py" -c 'import site; print(site.getsitepackages()[0])')
sitepkgd=${sitepkgd#/}
root=${{inputs.dest}}
wd="./.wheels/$pyver"
vr() { echo "execute:" "$@"; "$@"; }

tmpd=$(mktemp -d)
trap "rm -Rf '$tmpd'" EXIT

# --find-links to an empty dir and --no-index makes pip fully "offline"
distwheelsd="$tmpd/dist-wheels"
mkdir -p "$distwheelsd"
echo "$py is $pyver with site_packages dir '$sitepkgd'"
vr $py -m pip wheel --verbose "--wheel-dir=$wd" \
"--find-links=$distwheelsd" --no-index --no-build-isolation --no-deps .
vr $py -m pip install --verbose \
"--find-links=$distwheelsd" --no-index --no-build-isolation --no-deps \
--force-reinstall --no-compile --prefix=/usr "--root=$root" "$wd"/*.whl
vr $py -m compileall --invalidation-mode=unchecked-hash -r100 "$root/$sitepkgd"
57 changes: 57 additions & 0 deletions py3-cython.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package:
name: py3-cython
version: 3.0.10
epoch: 1
description: Cython is an optimising static compiler for both the Python & the extended Cython programming languages.
copyright:
- license: Apache-2.0
dependencies:
provider-priority: 0

vars:
pypi-package: cython

data:
- name: py-versions
items:
3.10: "310"
3.11: "311"
3.12: "312"

environment:
contents:
packages:
- build-base
- busybox
- py3-supported-pip
- py3-supported-python-dev
- py3-supported-wheel

pipeline:
- uses: fetch
with:
expected-sha256: 00f97476cef9fcd9a89f9d2a49be3b518e1a74b91f377fe08c97fcb44bc0f7d7
uri: https://github.com/cython/cython/archive/${{package.version}}.tar.gz

subpackages:
- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}
dependencies:
provider-priority: ${{range.value}}
provides:
- ${{package.name}}
- cython
pipeline:
- uses: py/pip-build-install
with:
python: python${{range.key}}
- uses: strip

- name: py3-wheels-${{vars.pypi-package}}
pipeline:
- uses: py/collect-wheels
xnox marked this conversation as resolved.
Show resolved Hide resolved

update:
enabled: true
github:
identifier: cython/cython
63 changes: 46 additions & 17 deletions py3-flit-core.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,71 @@
package:
name: py3-flit-core
version: 3.9.0
epoch: 1
epoch: 2
description: "simple packaging tool for simple packages (core)"
copyright:
- license: BSD-3-Clause
dependencies:
runtime:
- python3
provider-priority: 0

vars:
pypi-package: flit-core

data:
- name: py-versions
items:
3.10: "310"
3.11: "311"
3.12: "312"

environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- py3-installer
- python3
- wolfi-base
- py3-supported-python

pipeline:
- uses: fetch
with:
uri: https://files.pythonhosted.org/packages/source/f/flit/flit-${{package.version}}.tar.gz
expected-sha256: d75edf5eb324da20d53570a6a6f87f51e606eee8384925cd66a90611140844c7

- runs: |
cd flit_core
python3 build_dists.py

- runs: |
cd flit_core
python3 -m installer -d "${{targets.destdir}}" dist/flit_core-${{package.version}}-py3-none-any.whl
subpackages:
- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}
description: ${{vars.pypi-package}} installed for python${{range.key}}
dependencies:
provider-priority: ${{range.value}}
provides:
- ${{package.name}}
pipeline:
- runs: |
cd flit_core
rm -Rf dist/
python${{range.key}} -m flit_core.wheel
python${{range.key}} bootstrap_install.py \
--install-root=${{targets.subpkgdir}} \
dist/flit_core-${{package.version}}-py3-none-any.whl
mkdir -p /home/build/.wheels/${{range.key}}/
cp dist/flit_core-${{package.version}}-py3-none-any.whl \
/home/build/.wheels/${{range.key}}/
python${{range.key}} -m compileall --invalidation-mode=unchecked-hash -r100 \
${{targets.subpkgdir}}
rm -rf "${{targets.subpkgdir}}"/usr/lib/python3*/site-packages/flit_core/tests
- uses: strip
xnox marked this conversation as resolved.
Show resolved Hide resolved

- runs: |
rm -rf "${{targets.destdir}}"/usr/lib/python3*/site-packages/flit_core/tests
- name: py3-wheels-${{vars.pypi-package}}
pipeline:
- uses: py/collect-wheels

- uses: strip
- name: py3-supported-${{vars.pypi-package}}
description: meta package providing ${{vars.pypi-package}} for supported python versions.
dependencies:
runtime:
- py3.10-${{vars.pypi-package}}
- py3.11-${{vars.pypi-package}}
- py3.12-${{vars.pypi-package}}

update:
enabled: true
Expand Down
Loading
Loading