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

wrap_pyfunction: allow working on all crate functions #1280

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

davidhewitt
Copy link
Member

This tweak allows for importing pyfunctions across modules in crates using glob imports.

e.g.

functions.rs

#[pyfunction]
fn foo() { }

module.rs

use functions::*;  // this will now pull in the pub(crate) generated function wrapper

// ...
wrap_pyfunction!(foo, m)?;

It's still not very user-friendly, so I don't really want to document this, but some users might want to do it, and I don't see why not. (I am aware of at least one person who's asked me offline about this.)

I think it might also be helpful to have support for this internally for the proposed pymodule syntax in #694 .

Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

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

Thanks!

@kngwyu kngwyu merged commit dcca3f8 into PyO3:master Nov 17, 2020
@davidhewitt davidhewitt deleted the cross-module-pyfunction branch April 3, 2021 06:11
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.

2 participants