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

[Bug]: [typing] "_models" in typing annotation confuses sphinx #6152

Open
4 tasks done
xiangyan99 opened this issue Feb 25, 2025 · 0 comments
Open
4 tasks done

[Bug]: [typing] "_models" in typing annotation confuses sphinx #6152

xiangyan99 opened this issue Feb 25, 2025 · 0 comments
Labels
bug Something isn't working emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Comments

@xiangyan99
Copy link
Member

Describe the bug

This is transferred from Azure/autorest.python#2964

we add "_models." in our generated code.

e.g.

def init(
self,
*,
vectorizer_name: str,
ai_services_vision_parameters: Optional["_models.AIServicesVisionParameters"] = None,
**kwargs: Any
) -> None:

The reason is to avoid name conflicts. we've had issues in the past, for example, if an enum is named the same thing as a model, by tying it to _models (we also make it private so we're not exposing anything), we avoid naming conflicts.

Unfortunately, Sphinx cannot parse the model "_models.AIServicesVisionParameters" correctly.

In Sphinx generated code, it shows
_models.SearchIndexerDataIdentity
and loses xref.

We need to find some other ways to solve the name conflicts.

Reproduction

As above

Checklist

@xiangyan99 xiangyan99 added the bug Something isn't working label Feb 25, 2025
@markcowl markcowl added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working emitter:client:python Issue for the Python client emitter: @typespec/http-client-python
Projects
None yet
Development

No branches or pull requests

2 participants