Skip to content
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

[internal] Upgrade PyO3 to 14.1 #12405

Merged
merged 4 commits into from
Jul 22, 2021

Conversation

Eric-Arellano
Copy link
Contributor

This allows us to simplify setup of the dependency.

Tuple structs are also now legal with #[pyclass], so we can use the newytpe pattern via tuple structs.

See https://github.com/PyO3/pyo3/blob/main/CHANGELOG.md for the changelog.

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Copy link
Contributor Author

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Tuple structs are also now legal with #[pyclass], so we can use the newytpe pattern via tuple structs.

I personally like this change a lot. I think it makes more clear when the PyFoo types are nothing more than newtypes w/ FFI support. Note that we still use a normal struct for PyNailgunClient, which is not a newtype.

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Copy link

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

I personally like this change a lot.

👍 really nice to see positive feedback! Also saw in #12225 you posted the perf gap is closed with 0.14, which is cool. We put a fair bit of work into optimising since 0.13.

Comment on lines -35 to -44
if cfg!(target_os = "macos") {
// N.B. On OSX, we force weak linking by passing the param `-undefined dynamic_lookup` to
// the underlying linker. This avoids "missing symbol" errors for Python symbols
// (e.g. `_PyImport_ImportModule`) at build time when bundling the PyO3 sources.
// The missing symbols will instead by dynamically resolved in the address space of the parent
// binary (e.g. `python`) at runtime. We do this to avoid needing to link to libpython
// (which would constrain us to specific versions of Python).
println!("cargo:rustc-cdylib-link-arg=-undefined");
println!("cargo:rustc-cdylib-link-arg=dynamic_lookup");
}

Choose a reason for hiding this comment

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

You might want to keep this bit around - unfortunately it looks like I'll have to revert this for PyO3 0.14.2: PyO3/pyo3#1719

(I'll probably add something to the pyo3-build-config crate to do essentially what you've written here.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, thanks! I'll pin to 14.1 for now. FYI I have an M1 machine also and I'm happy to help test things with that issue.

@Eric-Arellano
Copy link
Contributor Author

Great work with the release! I've been watching the repo via GitHub notifications and it's super exciting to see all the momentum 🥳

Copy link
Contributor

@tdyas tdyas left a comment

Choose a reason for hiding this comment

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

lgtm

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@Eric-Arellano Eric-Arellano merged commit b165637 into pantsbuild:main Jul 22, 2021
@Eric-Arellano Eric-Arellano deleted the upgrade-pyo3 branch July 22, 2021 18:43
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