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

Py39 support #5

Merged
merged 3 commits into from
Jun 10, 2024
Merged

Py39 support #5

merged 3 commits into from
Jun 10, 2024

Conversation

CharString
Copy link
Contributor

@CharString CharString commented Jun 5, 2024

The first commit is for the unlucky souls that still have a CI on py3.9

The latter 2 do the same as #2, but using the implementation that became the std lib one in 3.11

Closes #2

An empathic patch, for those poor souls whose CI still run on 3.9
It was already a sub-dependencies on some Python versions.
This adds it explicitly to the mypy CI, so we can import `Self` from it.
Does the same as #2, but by importing the "real" `Self` from
`typing_extensions`.

Does it in a `TYPE_CHECKING` block, so the typing_extensions requirement
can be just a typing one, not a runtime one.
Copy link
Member

@sergei-maertens sergei-maertens left a comment

Choose a reason for hiding this comment

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

I shall not ask any questions

@sergei-maertens sergei-maertens merged commit 295623d into main Jun 10, 2024
9 checks passed
@Viicos
Copy link

Viicos commented Jun 10, 2024

I saw this practice of not depending on typing_extensions and using an if TYPE_CHECKING: block a couple times on other projects but I don't know if it is wise.

I think there have been some discussions about it, saying it's fine because type checkers vendor typing_extensions anyway, but still 🤔

On a side note there's no need to explicitly annotate cls if using the typing.Self

@sergei-maertens
Copy link
Member

sergei-maertens commented Jun 10, 2024

the import guard is to not affect runtime behaviour, right now installing ape-pie does not pull in typing-extensions and I'd like to keep it that way. IMO typing-extensions is ideally a direct dependency.

We only install it in our CI pipeline through the optional dependency group for the type checker itself, run-time it's completely opt-in.

@Viicos Viicos deleted the py39-support branch June 10, 2024 16:21
@Viicos
Copy link

Viicos commented Jun 10, 2024

My concern was related to python-poetry/poetry#9251 (comment), but I think both approaches work pretty much the same

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.

3 participants