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

Automated module= field creation in declarative modules #4213

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

Tpt
Copy link
Contributor

@Tpt Tpt commented May 27, 2024

Sets automatically the "module" field of all contained classes and submodules in a declarative module

Adds the "module" field to #[pymodule] attributes in order to set the name of the parent module. By default, the module is assumed to be a root module.

@davidhewitt
Copy link
Member

👍 thanks, I'll try to review later. Also, I find myself wanting to use declarative modules all the time so I'm tempted to call them stable once we merge this! 😁

Copy link
Member

@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.

Thanks, I think this implementation looks reasonable to me! Just needs some documenting and then I think we can ship in 0.22!

};

#[derive(Default)]
pub struct PyModuleOptions {
krate: Option<CrateAttribute>,
name: Option<syn::Ident>,
module: Option<ModuleAttribute>,
Copy link
Member

Choose a reason for hiding this comment

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

This new attribute probably needs documenting in the guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Sorry for the huge lag

Sets automatically the "module" field of all contained classes and submodules in a declarative module

Adds the "module" field to pymodule attributes in order to set the name of the parent modules. By default, the module is assumed to be a root module
Copy link
Member

@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.

Thanks, LGTM!

@davidhewitt davidhewitt added this pull request to the merge queue Jun 6, 2024
Merged via the queue into PyO3:main with commit 11d67b3 Jun 6, 2024
39 checks passed
@Tpt Tpt deleted the auto-module branch June 6, 2024 13:57
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