[v2][Python] Make generated implementation modules private · Issue #2048 · github/copilot-sdk · GitHub
Skip to content

[v2][Python] Make generated implementation modules private #2048

Description

@brettcannon

https://github.com/github/copilot-sdk/blob/main/python/copilot/generated/__init__.py Makes it clear that the copilot.generated subpackage is not meant to be public:

But the subpackage doesn't start with an underscore to signify it's an implementation detail: copilot._generated.

As well, https://github.com/github/copilot-sdk/blob/main/python/copilot/rpc.py and https://github.com/github/copilot-sdk/blob/main/python/copilot/session_events.py which are meant to act as the public API potentially over-expose things. While copilot.rpc does export something explicitly:

from .generated.rpc import (
SessionFsReaddirWithTypesEntryType as SessionFSReaddirWithTypesEntryType, # noqa: F401

... both files also do an import * followed by an import of __all__ from the generated code which lists everything contained in the generated code. E.g.:

from .generated.session_events import * # noqa: F401, F403
from .generated.session_events import __all__ # noqa: F401

exposes 330 symbols in the module:

I'm not sure if all 330 symbols are meant to be exposed, but at least copilot.generated should be made private by renaming it to copilot._generated. If all of those symbols are meant to be exposed then that one-liner in copilot.rpc might as well be removed. If they are not meant to be exposed then the import __all__ and import * should go and you can explicitly set __all__ in the exporting modules.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsdk-v2Work planned for Copilot SDK v2

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions