Skip to content

Conversation

@davidhewitt
Copy link
Member

This PR attempts to improve the situation in #5505 by using the Python interpreter to check what the latest PyO3 version is.

See the test for example output.

@davidhewitt davidhewitt mentioned this pull request Oct 15, 2025
@alex
Copy link
Contributor

alex commented Oct 15, 2025

I personally find the idea of hitting the network to check versions somewhat distasteful :-/

@davidhewitt
Copy link
Member Author

Fair enough, I pushed a second commit which removed the internet query and just attempts to improve the message slightly.

Comment on lines +481 to +484
the configured Python version (3.13) is newer than PyO3's maximum supported version (3.12)\n\
= help: this package is being built with PyO3 version ", env!("CARGO_PKG_VERSION"), "\n\
= help: check https://crates.io/crates/pyo3 for the latest PyO3 version available\n\
= help: updating this package to the latest version of PyO3 may provide compatibility with this Python version\n\
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone has got a moment to review / comment on this message, this is the last small tweak I'd like to merge into 0.27.

(I think the existing error message has been a frequent source of confusion for users adopting 3.14, maybe this new text is slightly better?)

Copy link
Contributor

@MatthijsKok MatthijsKok Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a user who admittedly gets confused by pyo3 from time to time, I feel the new error message is indeed a minor improvement :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads fine to me and is a bit more explicit than before. I guess we can only wait and see if it helps.

Copy link
Contributor

@Icxolu Icxolu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I agree with alex that we should preferably not start querying the network here.

///
/// This must be called from PyO3's build script, because it relies on environment
/// variables such as `CARGO_CFG_TARGET_OS` which aren't available at any other time.
#[allow(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not actionable now, but after #5486 we can make use of #[expect(...)] for these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it would be nice to apply across the codebase

Comment on lines +481 to +484
the configured Python version (3.13) is newer than PyO3's maximum supported version (3.12)\n\
= help: this package is being built with PyO3 version ", env!("CARGO_PKG_VERSION"), "\n\
= help: check https://crates.io/crates/pyo3 for the latest PyO3 version available\n\
= help: updating this package to the latest version of PyO3 may provide compatibility with this Python version\n\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads fine to me and is a bit more explicit than before. I guess we can only wait and see if it helps.

@davidhewitt
Copy link
Member Author

Thanks for the review!

@davidhewitt davidhewitt added this pull request to the merge queue Oct 16, 2025
Merged via the queue into PyO3:main with commit 8f669e7 Oct 16, 2025
42 of 43 checks passed
@davidhewitt davidhewitt deleted the version-message branch October 16, 2025 21:53
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