pyo3 icon indicating copy to clipboard operation
pyo3 copied to clipboard

Declarative modules: submodule declarations are not considered covered

Open alex opened this issue 1 year ago • 2 comments

From the coverage report on https://github.com/pyca/cryptography/pull/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 avatar Jun 25 '24 23:06 alex

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

alex avatar Jun 26 '24 23:06 alex

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 avatar Jun 27 '24 01:06 alex

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

alex avatar Jul 04 '24 12:07 alex

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

davidhewitt avatar Jul 04 '24 16:07 davidhewitt

Cool, thanks!

alex avatar Jul 04 '24 16:07 alex

I assume this is now resolved 😄

davidhewitt avatar Jul 09 '24 12:07 davidhewitt

Yup! We're all aboard adopting them: https://github.com/pyca/cryptography/issues/11158

On Tue, Jul 9, 2024 at 8:16 AM David Hewitt @.***> wrote:

I assume this is now resolved 😄

— Reply to this email directly, view it on GitHub https://github.com/PyO3/pyo3/issues/4286#issuecomment-2217492564, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBDTCZRXOSN2QCHGUR3ZLPIDBAVCNFSM6AAAAABJ4X44VSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJXGQ4TENJWGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- All that is necessary for evil to succeed is for good people to do nothing.

alex avatar Jul 09 '24 12:07 alex