-
Notifications
You must be signed in to change notification settings - Fork 27
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
Use maturin
as a build backend and improve github workflows
#165
base: main
Are you sure you want to change the base?
Conversation
c1f307d
to
7d7d102
Compare
Agree with the steps, especially this:
And we need to take into consideration, that currently for macos builds there is inconsistency #168, I will fix this using Maybe having jobs per each os with strategy matrix per python version and target:
|
|
e180ccc
to
df00717
Compare
I gave a try to |
|
To address questions:
|
aef5905
to
4782a04
Compare
Some updates:
Versioning investigation:
It was possible in build.rs via `semver::Prerelease::new("dev")`
|
981ce78
to
ccc52aa
Compare
46ef0f5
to
279b640
Compare
1. Incorrect bumping actionCurrent action for bumping is incorrect, with regex it gets wrong CARGO_VERSION It was working before because we didn't have dependencies defined separately like Details
It matches also versions for dependencies, defined lower (0.4.1):
Confirmed that now it works correctly: https://github.com/dottxt-ai/outlines-core/actions/runs/13390036577/job/37395484642?pr=165#step:4:186 with:
Result as expected:
2. Wheels checksChecked written versions in wheels with automated script, which bumps version, also scopes & overall functioning. All looks good. Wheels for checking could be downloaded here: https://github.com/dottxt-ai/outlines-core/actions/runs/13390483062 Scopes & versions confirmed
3. Dry-run publish workflowIt ran successfully in terms of building wheels, but
https://github.com/dottxt-ai/outlines-core/actions/runs/13392912542/job/37405398157 Indeed, we're using I asked for a fresh release: huggingface/tokenizers#1736 |
maturin
as build-backend
maturin
as a build backend and improve github workflows
068789f
to
b147dcf
Compare
Hey @yvan-sraka Could you please review this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not the right to approve (but I would do otherwise) as I opened that PR with my user … even if clearly most of the work here was made by @torymur.
I left a lot of comments because that's a huge PR that fixes so many useful things, like documenting and cleaning the Python interfaces exposed, but overall great work that could be merged as is!
run: | | ||
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version') | ||
if [ "${GITHUB_REF#refs/tags/}" != "$VERSION" ]; then | ||
echo "Version mismatch: Cargo.toml ($VERSION) doesn't match Release tag (${GITHUB_REF#refs/tags/})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great to check that assertion here!
strategy: | ||
matrix: | ||
platform: | ||
# older ubuntu to avoid messing with glibc version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have a link here or a short paragraph that explain what's exactly the kind of glibc
-related bug we try to avoid here? and since we're not distributing a static binary (e.g., musl
-based) this kind of issue can still affect users in the end, right?
- name: Install required packages | ||
run: | | ||
sudo apt update | ||
sudo apt install pkg-config gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -qy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why build-essential
isn't enough here? if not for openssl
, what's provided by pkg-config
? I'm btw curious if gcc
could be replaced by clang
here without breaking anything?
run: twine check --strict dist/* | ||
|
||
- name: Install built wheel | ||
if: matrix.platform.target == 'x86_64' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we filtering out aarch64
here?
platform: | ||
- runner: windows-latest | ||
target: x86 | ||
alias-target: i686-pc-windows-msvc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are Windows 32 bits programs still a thing?
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
# TODO: remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not addressing those left TODO comments in that PR?
@@ -76,11 +79,15 @@ jobs: | |||
- uses: actions/setup-python@v4 | |||
with: | |||
cache: pip | |||
python-version: "3.11" | |||
python-version: "3.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's broken with Python 3.10?
@@ -24,16 +24,6 @@ repos: | |||
rev: 23.3.0 | |||
hooks: | |||
- id: black | |||
- repo: https://github.com/pre-commit/mirrors-mypy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look like an unrelated change to that PR?
@@ -1,11 +1,27 @@ | |||
# How to release | |||
## Overview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great guide! Rendered
@@ -12,7 +12,6 @@ dependencies: | |||
- pydantic | |||
- pytest | |||
- pre-commit | |||
- jsonschema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why that change?
Why
maturin
is the best for Rust-based extensions and makes much faster builds. For cross-compilationcross
could be used, it works well withmaturin
, it's much faster than CPU emulation since it natively compiles code, has pre-configured cross-compilers. Linuxaarch64
build was taking more than an hour most likely due to QEMU, because it translates every instruction: #62Example

In this PR
maturin
as build backend. Closes Consider usingmaturin-action
to compile the wheels #105PyO3/maturin-action
to build wheels for releasePyO3/maturin-action
to publishmacos-14
&macos-15
. Closes Build wheels formacos14
#75cargo
workflow steps #21maturin
to generate docs automatically: Closes Add docstrings for python bindings #177Openssl
Switching from
openssl
torustls
, which drastically simplifies absolutely everything 🎉It was possible to opt out by:
rustls-tls
feature forhf-hub
dependencytokenizers
to addrustls-tls
feature, which was quickly merged on their side, so we're pinning to that commit (also Rust code was adjusted due to new version)Workflows
Changes:
Results
Each job:
https://github.com/dottxt-ai/outlines-core/actions/runs/13306992049/job/37160143310?pr=165