Skip to content

pybind11 filesystem: import os is missing in files with os.PathLike in stubs #266

@dyollb

Description

@dyollb

I am using the pybind/stl/filesystem.h support to add pathlib.Path support.
In the stubs I get something like this:

class ImporterBase:
    """
    Base class for all importers.
    """
    def Import(self, file_path: os.PathLike | str | bytes) -> list[Entity]:
        """
        Imports a model from a file into the active model.
        """

However, the module os is not imported at the top of the file. Is this a pybind11 bug or a stubgen bug?
Where would this be processed (I would be willing to provide a PR)?

Would it help to provide a PR with a failing test?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions