sizmailov / pybind11-stubgen

Generate stubs for python modules
Other
228 stars 45 forks source link

enum warning doesn't tell you where it's coming from #170

Closed virtuald closed 10 months ago

virtuald commented 10 months ago
pybind11_stubgen - [WARNING] Enum-like str representations were found with no matching mapping to the enum class location.
Use `--enum-class-locations` to specify full path to the following enum(s):

... not sure which functions are generating the warnings, and our packages are fairly large?

virtuald commented 10 months ago

But also, I've been really happy with the new improvements in stubgen, it's catching a lot more stuff that will hopefully result in better type checking :)

sizmailov commented 10 months ago

This is just a "helper" message. The actual errors that trigger this warning should be above, and should look like this:

https://github.com/sizmailov/pybind11-stubgen/blob/c34105aae8a35bb41554c97efead4744c1efdc35/tests/demo.errors.stderr.txt#L1-L2

virtuald commented 10 months ago

I'm not seeing those errors. Is there a flag? I'm doing...

    # Generate pyi modules
    out = cfg["out"]
    for stub in cfg["stubs"]:
        sys.argv = [
            "<dummy>",
            "--exit-code",
            "--ignore-invalid-expressions=<.*>",
            "--root-suffix=",
            "-o",
            out,
            stub,
        ]

        pybind11_stubgen.main()
virtuald commented 10 months ago

Oh I see, my ignore invalid expressions is going to ignore them.

sizmailov commented 10 months ago

It's a bug, If you ignore the expressions, the warning should not appear.