Skip to content

Commit

Permalink
versioning for python packages (#26493)
Browse files Browse the repository at this point in the history
maturin: Add supported- subpackage; needed for pydantic-core build
pydantic-core: versioned python
setuptools-rust: Add supported- subpackage; needed for maturin build
typing-extensions: Add supported- subpackage; needed for pydantic-core
build

---------

Signed-off-by: Srishti Hegde <[email protected]>
Signed-off-by: srishtih <[email protected]>
  • Loading branch information
srishtih authored Aug 16, 2024
1 parent 8d9a5ad commit 213a673
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 49 deletions.
72 changes: 59 additions & 13 deletions py3-maturin.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,88 @@
package:
name: py3-maturin
version: 1.7.0
epoch: 1
epoch: 2
description: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages
copyright:
- license: MIT OR Apache-2.0
dependencies:
runtime:
- py3-tomli
provider-priority: 0

environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- python3-dev
- py3-supported-pip
- py3-supported-python
- py3-supported-python-dev
- py3-supported-setuptools
- py3-supported-setuptools-rust
- py3-supported-wheel
- rust
- wolfi-base

vars:
pypi-package: maturin

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

pipeline:
- uses: git-checkout
with:
expected-commit: 2061d01bf40ee4c753cc03b84e22ac226a962414
repository: https://github.com/pyo3/maturin
tag: v${{package.version}}

- name: Python Build
uses: python/build-wheel
subpackages:
- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}
description: ${{vars.pypi-package}} installed for python${{range.key}}
dependencies:
runtime:
- py${{range.key}}-tomli
provides:
- py3-${{vars.pypi-package}}
provider-priority: ${{range.value}}
pipeline:
- uses: py/pip-build-install
with:
python: python${{range.key}}
- uses: strip

- uses: strip
- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}-bin
description: Executable binaries for ${{vars.pypi-package}} installed for python${{range.key}}
dependencies:
runtime:
- py${{range.key}}-${{vars.pypi-package}}
provides:
- py3-${{vars.pypi-package}}
provider-priority: ${{range.value}}
pipeline:
- runs: |
mkdir -p ${{targets.contextdir}}/usr
mv ${{targets.contextdir}}/../py${{range.key}}-${{vars.pypi-package}}/usr/bin ${{targets.contextdir}}/usr
test:
pipeline:
- uses: python/import
with:
python: python${{range.key}}
import: ${{vars.pypi-package}}

test:
pipeline:
- uses: python/import
with:
imports: |
import maturin
- 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
61 changes: 42 additions & 19 deletions py3-pydantic-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,68 @@
package:
name: py3-pydantic-core
version: 2.22.0
epoch: 0
epoch: 1
copyright:
- license: MIT
dependencies:
runtime:
- py3-typing-extensions
- python3
provider-priority: 0

environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- py3-build
- py3-installer
- py3-setuptools
- py3-typing-extensions
- python3
- py3-supported-build
- py3-supported-installer
- py3-supported-pip
- py3-supported-python
- py3-supported-setuptools
- py3-supported-typing-extensions
- py3-supported-wheel
- rust
- wolfi-base

vars:
pypi-package: pydantic-core
module-name: pydantic_core

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

pipeline:
- uses: git-checkout
with:
expected-commit: a6d0d631b529e5b4f38ccd71dd79af60a61516b8
repository: https://github.com/pydantic/pydantic-core
tag: v${{package.version}}

- name: Python Build
uses: python/build-wheel

- uses: strip

test:
pipeline:
- uses: python/import
with:
import: pydantic_core
subpackages:
- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}
description: ${{vars.pypi-package}} installed for python${{range.key}}
dependencies:
runtime:
- py${{range.key}}-typing-extensions
provides:
- py3-${{vars.pypi-package}}
provider-priority: ${{range.value}}
pipeline:
- runs: pip${{range.key}} install maturin
- uses: py/pip-build-install
with:
python: python${{range.key}}
- uses: strip
test:
pipeline:
- uses: python/import
with:
python: python${{range.key}}
import: ${{vars.module-name}}

update:
enabled: true
Expand Down
65 changes: 49 additions & 16 deletions py3-setuptools-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,76 @@
package:
name: py3-setuptools-rust
version: 1.10.1
epoch: 0
epoch: 1
description: Setuptools Rust extension plugin
copyright:
- license: MIT
dependencies:
runtime:
- py3-setuptools
- py3-semantic-version
- py3-typing-extensions
- python3
provider-priority: 0

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

vars:
pypi-package: setuptools-rust
module-name: setuptools_rust

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

pipeline:
- uses: git-checkout
with:
repository: https://github.com/PyO3/setuptools-rust
tag: v${{package.version}}
expected-commit: df30297ac3d06b3a6536c3d304e780cdccc86da1

- name: Python Build
runs: python -m build

- name: Python Install
runs: python3 -m installer -d "${{targets.destdir}}" dist/*.whl
subpackages:
- range: py-versions
name: py${{range.key}}-${{vars.pypi-package}}
description: ${{vars.pypi-package}} installed for python${{range.key}}
dependencies:
runtime:
- py${{range.key}}-setuptools
- py${{range.key}}-semantic-version
- py${{range.key}}-typing-extensions
provides:
- py3-${{vars.pypi-package}}
provider-priority: ${{range.value}}
pipeline:
- uses: py/pip-build-install
with:
python: python${{range.key}}
- uses: strip
test:
pipeline:
- uses: python/import
with:
python: python${{range.key}}
import: ${{vars.module-name}}

- 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
10 changes: 9 additions & 1 deletion py3-typing-extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package:
name: py3-typing-extensions
version: 4.12.2
epoch: 3
epoch: 4
description: Backported and Experimental Type Hints for Python 3.7+
copyright:
- license: PSF-2.0
Expand Down Expand Up @@ -57,6 +57,14 @@ subpackages:
pipeline:
- runs: python${{range.key}} -c "from ${{vars.module_name}} import TypeAlias, TypeGuard"

- 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
github:
Expand Down

0 comments on commit 213a673

Please sign in to comment.