Skip to content

Split examples & check minimum versions #3370

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

mladedav
Copy link
Collaborator

@mladedav mladedav commented Jun 3, 2025

Motivation

Partly #2942, partly trying to make the minimum dependencies checks better (which is similar to the first point in that discussion.

Currently, both cargo deny and our MSRV checks use Cargo.lock file which has unified features and versions across both the axum crates and all the examples. This can hide some issues as usually when someone adds an example, they might use cargo add which will silently update the dependency for the whole repository. Some compilation errors (like axum requiring bytes@1.0 while it uses features from bytes@1.7) will then be hidden.

I don't think most users would ever need to use the minimal versions anyway so this is not as severe, but someone might run into compilation errors.

Solution

Split the examples out of the top-level workspace. I think this improves the situation and if we want to really move the examples to their own repository at any time, this would be the first step anyway.

In the discussion there was a consideration that this makes it harder to test changes locally because CI might error on the examples which will not be built locally with cargo test, but due to default-members in the workspace this has always been the case (unless you use --workspace).

The changes that are here regarding versions:

  • crc32fast is a transitive dependency which doesn't build with the lowest possible version. This was patched in CI manually, I just moved the patch into Cargo.toml.
  • lazy_static has the same issue but the minimum version seemed to be higher because of examples.
  • serde - we use features that were added after 1.0.0. I didn't look for the lowest possible version and just used whatever was the lowest version we used until now (the lowest version including tests). This could be lowered but I don't think there's a point.
  • bytes - we use impl From<Bytes> for BytesMut in sse.rs which was added in 1.7.
  • tracing-subscriber - last release accidentally did not update tracing-core to the correct and this optional feature forces the correct versions to be selected.

@jplatte
Copy link
Member

jplatte commented Jun 3, 2025

It used to be this way, we moved it together because local development was just super annoying with two workspaces in one repo. I forgot to update examples all the time.

@mladedav
Copy link
Collaborator Author

mladedav commented Jun 3, 2025

Then I'll probably just fix the versioning issues here and then drop that commit.

@mladedav mladedav changed the title Dm/split examples Split examples & check minimum versions Jun 3, 2025
@yanns
Copy link
Collaborator

yanns commented Jun 4, 2025

It used to be this way, we moved it together because local development was just super annoying with two workspaces in one repo. I forgot to update examples all the time.

I guess that the CI is screaming then for each PR?

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.

3 participants