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

Declarative modules: submodule declarations are not considered covered #4286

Closed
alex opened this issue Jun 25, 2024 · 7 comments · Fixed by #4308
Closed

Declarative modules: submodule declarations are not considered covered #4286

alex opened this issue Jun 25, 2024 · 7 comments · Fixed by #4308

Comments

@alex
Copy link
Contributor

alex commented Jun 25, 2024

From the coverage report on pyca/cryptography#11159

Screenshot 2024-06-25 at 7 08 50 PM

As you can see the mod ... lines are all considered uncovered. This possibly has something to do with the spans on the generated code.

@alex
Copy link
Contributor Author

alex commented Jun 26, 2024

I suspect, but am not positive, that this is because the __pyo3_init functions are generated for submodules, but obviously never called.

alex added a commit to alex/pyo3 that referenced this issue Jun 27, 2024
… `const fn`

Instead we can just declare a `const`. This may help with coverage issues, refs PyO3#4286.
@alex
Copy link
Contributor Author

alex commented Jun 27, 2024

Ok, my idea here is:

  • Add a new submodule parameter to pymodule: pymodule(submodule)
  • Automatically add this attribute for nested modules (users could add it themselves for their own modules)
  • When a module is marked submodule, we no longer emit __pyo3_init

WDYT?

alex added a commit to alex/pyo3 that referenced this issue Jun 27, 2024
alex added a commit to alex/pyo3 that referenced this issue Jul 1, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 1, 2024
alex added a commit to alex/pyo3 that referenced this issue Jul 2, 2024
alex added a commit to alex/pyo3 that referenced this issue Jul 2, 2024
alex added a commit to alex/pyo3 that referenced this issue Jul 2, 2024
@alex
Copy link
Contributor Author

alex commented Jul 4, 2024

@davidhewitt Once this and #4288 and #4308 are merged, I'd be interested in doing a point release so we can take advantage of declarative modules. Anything else you'd want to get in there?

@davidhewitt
Copy link
Member

I just had #4304, agreed a point release would be good. I'll try to review / prep the release tomorrow at the latest.

@alex
Copy link
Contributor Author

alex commented Jul 4, 2024

Cool, thanks!

alex added a commit to alex/pyo3 that referenced this issue Jul 5, 2024
alex added a commit to alex/pyo3 that referenced this issue Jul 5, 2024
@davidhewitt
Copy link
Member

I assume this is now resolved 😄

@alex
Copy link
Contributor Author

alex commented Jul 9, 2024 via email

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 a pull request may close this issue.

2 participants