Skip to content

Conversation

jbms
Copy link
Owner

@jbms jbms commented Oct 3, 2025

No description provided.

@jbms jbms requested a review from 2bndy5 October 3, 2025 04:48
[tool.ruff]
lint.extend-select = ["I"]

[too.ruff.per-file-target-version]
Copy link
Collaborator

@2bndy5 2bndy5 Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[too.ruff.per-file-target-version]
[tool.ruff.per-file-target-version]

Should help ruff better understand how to format/lint that 1 file.

@2bndy5
Copy link
Collaborator

2bndy5 commented Oct 3, 2025

Is this related to (or somehow helpful toward) #270?

@jbms
Copy link
Owner Author

jbms commented Oct 4, 2025

Is this related to (or somehow helpful toward) #270?

It didn't directly address that. However, it does interact with it in the following way:

  • The unresolved reference part of that issue is that the Sphinx Python domain attempts to resolve any types that occur in annotations using the py:class role, which previously didn't find py:data or py:attr objects.
  • That issue has now been fixed upstream: autodoc-documented type aliases can't be referenced from type annotations sphinx-doc/sphinx#10785 The upstream fix modifies lookup so that py:class will also find py:data and py:attr objects if there is no match of a py:class or py:exception object. (Not yet in any released sphinx version)
  • However, that fix doesn't address py:type objects such as are created with the new support in this PR.
  • However, I can add a monkey patch to this PR to backport the upstream sphinx fix and also have it properly support py:type in the same way.

@2bndy5
Copy link
Collaborator

2bndy5 commented Oct 4, 2025

However, I can add a monkey patch to this PR to backport the upstream sphinx fix and also have it properly support py:type in the same way

I feel that would only be needed if the implementation relies on the upstream fix. Otherwise, I'm content with waiting for Sphinx to go through their release process.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like mypy needs to be told to skip this file.

Using Python v3.12+

tests/python_apigen_test_modules/pep695.py:1: error: PEP 695 type aliases are
not yet supported  [valid-type]

Using Python <= v3.11

tests/python_apigen_test_modules/pep695.py:1: error: invalid syntax  [syntax]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants