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

Removed breaking typing_extensions import #181

Merged

Conversation

BillSchumacher
Copy link
Contributor

Resolves #180

@BillSchumacher
Copy link
Contributor Author

Seems like mypy might require this package so I don't think it can be removed.

@wesleykendall
Copy link
Member

When you say "breaking", do you mean the code causes an error in Python 3.12? Do you not have typing-extensions installed in your environment?

I verified that I can pip install typing-extensions on Python 3.12, so it doesn't seem like there's a limitation of installing it with python 3.12 as mentioned in #180. It does seem like we don't automatically include this as a dependency.

I will defer this one to @max-muoto , but the better approach is probably conditionally installing typing-extensions in our package metadata and conditionally importing the types based on the Python version. Or perhaps its common for packages to just include this as a dependency. I think Self is likely the more accurate type here though

@BillSchumacher
Copy link
Contributor Author

Yes, exactly so when installing this as a dependency typing-extensions is not installed on 3.11 or 3.12 as it requires < 3.11 https://github.com/BillSchumacher/django-audimatic/actions/runs/11563973687/job/32188306870

@BillSchumacher
Copy link
Contributor Author

Either way I'm not sure that the import is actually needed.

@max-muoto
Copy link
Contributor

max-muoto commented Oct 29, 2024

Either way I'm not sure that the import is actually needed.

Do you think you could try moving the import under an if TYPE_CHECKING block?

from typing import TYPE_CHECKING


if TYPE_CHECKING:
   from typing_extensions import Self

The import is mainly needed for those relying on static type-checkers such as Pyright or MyPy.

Copy link
Contributor

@max-muoto max-muoto left a comment

Choose a reason for hiding this comment

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

LGTM!

@max-muoto
Copy link
Contributor

Thanks @BillSchumacher. Can merge this and bump the version.

@max-muoto max-muoto merged commit 901c9fe into AmbitionEng:main Oct 29, 2024
4 checks passed
@wesleykendall
Copy link
Member

@BillSchumacher this is being released in v4.13.0, thanks!

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.

typing_extensions breaks Python 3.12
3 participants