-
Notifications
You must be signed in to change notification settings - Fork 1.3k
pymodule derive macro #1832
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
pymodule derive macro #1832
Conversation
cb570c8
to
186a3e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this idea and I've been thinking about something similar for a while, though I agree that inline modules aren't optimal. It'd be great if we could put it on as an inner #![pymodule]
attribute, but it looks like that's still a nightly feature; tracking issue rust-lang/rust#54726.
Maybe we could only do this for some modules until #[pymodule]
mod decl {
#[pyfunction]
fn thing() {}
} |
For the formatting, I couldn't find any way to change local indent hint if we don't want to disable the whole file formatting. Also derive macro seems still always require to match the brace pair. Is it possible to add |
The mentioned issue looks quite old and then it means it is not expected to be solved in near future. Just go by experiencing git blame barrier? |
Yeah, I guess so; I haven't gotten a ton of use out of git blame for this project, and I think the stdlib is generally simple/encapsulated enough that it wouldn't be used that much there. |
@youknowone I think this change make developing harder. When I have errors the compiler does not show the line numbers and add suggestion: error[E0308]: mismatched types
|
= note: expected reference `&std::sync::Arc<pyobject::PyObject<(dyn pyobject::PyObjectPayload + 'static)>>`
found struct `std::sync::Arc<pyobject::PyObject<dyn pyobject::PyObjectPayload>>` Is there a way to fix this? |
I am sorry that discovering this comment so late. should we consider to revert this? |
Creating an inner module for every stdlib looks not ideal but i have no idea how to do without them