Skip to content

Conversation

davidhewitt
Copy link
Member

This PR tries to re-use more of the library logic into repeatable patterns. I also bumped the minimum Python version to 3.6, made liberal use of f-strings, and changed many error messages to start with lowercase.

@tiran would you be willing to pass a quick review over this? In particular the new RustCommand base class should ensure that optional extensions failing will always print a nice message (thanks to except Exception on line 45 of command.py).

Fixes #105

@tiran
Copy link
Contributor

tiran commented Feb 15, 2021

Excellent work! optional=True now ignores cargo metadata errors:

...
running build_ext
running build_rust
error: failed to download `pyo3 v0.13.1`

Caused by:
  can't make HTTP request in the offline mode
build_rust: optional Rust extension _rust failed
Command '['cargo', 'metadata', '--manifest-path', 'src/rust/Cargo.toml', '--format-version', '1']' returned non-zero exit status 101.
generating cffi module 'build/temp.linux-x86_64-3.9/_padding.c'
creating build/temp.linux-x86_64-3.9
generating cffi module 'build/temp.linux-x86_64-3.9/_openssl.c'
building '_openssl' extension
creating build/temp.linux-x86_64-3.9/build
creating build/temp.linux-x86_64-3.9/build/temp.linux-x86_64-3.9
...

@davidhewitt
Copy link
Member Author

😄 thanks for confirming!

@davidhewitt davidhewitt merged commit 1e37cc8 into PyO3:master Feb 15, 2021
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.

RustExtension(optional=True) does not catch all build errors

2 participants