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

Deprecate trio.__version__ #3190

Closed
wants to merge 5 commits into from

Conversation

A5rocks
Copy link
Contributor

@A5rocks A5rocks commented Jan 21, 2025

Follow up to #3186

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00000%. Comparing base (1c6a6a8) to head (6b625e4).
Report is 53 commits behind head on main.

Additional details and impacted files
@@               Coverage Diff               @@
##                 main        #3190   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files             124          124           
  Lines           18460        18538   +78     
  Branches         1216         1221    +5     
===============================================
+ Hits            18460        18538   +78     
Files with missing lines Coverage Δ
src/trio/__init__.py 100.00000% <100.00000%> (ø)
src/trio/_tests/test_trio.py 100.00000% <100.00000%> (ø)

... and 2 files with indirect coverage changes

@A5rocks A5rocks force-pushed the deprecate-dunder-version branch from 73e8a5f to cb3de6a Compare January 21, 2025 05:17
@A5rocks
Copy link
Contributor Author

A5rocks commented Jan 21, 2025

I didn't realize that deprecating an attribute means it can't exist as a type hint... If I did I would have just skipped #3186! But oh well.

@jakkdl
Copy link
Member

jakkdl commented Jan 21, 2025

it's a shame that https://typing.readthedocs.io/en/latest/spec/directives.html#deprecated (available in typing_extensions) is only meant for classes & functions, but with some messing around it might be possible to make it a @property. pyright looks to support it, but not yet mypy.

Also I guess conf.py can be a nice citizen and make use of importlib.metadata itself.

@A5rocks
Copy link
Contributor Author

A5rocks commented Jan 22, 2025

but with some messing around it might be possible to make it a @Property

This would require telling the type checker the module got replaced by a class (which I don't think is possible?)

Updating conf.py makes sense though.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@oremanj
Copy link
Member

oremanj commented Jan 22, 2025

This seems unnecessarily churn-y to me and I'm against it. What is the concrete benefit envisioned from removing this attribute? Due to the dynamic spec in pyproject.toml, we're already living in the world where we only need to update the version number in one place when making a release, so even fully removing __version__ won't make that any better than it is today.

@A5rocks
Copy link
Contributor Author

A5rocks commented Jan 22, 2025

It lets us be a bit more creative with the version (like using a git tag) but I made this PR due to it being a follow up rather than a concrete need. (So I'm fine closing it)

(Though IMO the RTD updates of this are actually good and I might cherry pick to another PR)

@jakkdl
Copy link
Member

jakkdl commented Jan 22, 2025

importlib.metadata just seems like The Better Way:tm: of doing this. I would love a linter rule that encouraged its use.. but I have a feeling that'd end up in a bunch of weird exceptions. idk let's see where astral-sh/ruff#15671 goes

But yeah the only benefit would be not having to comply with it in the future, in case we do want to mess around with it.

(so yeah I'd also be alright with not changing it)

@A5rocks
Copy link
Contributor Author

A5rocks commented Jan 30, 2025

Superseded by #3194 which doesn't deprecate trio.__version__.

@A5rocks A5rocks closed this Jan 30, 2025
@A5rocks A5rocks deleted the deprecate-dunder-version branch January 30, 2025 00:17
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.

None yet

3 participants