Skip to content

Drop support for py310 - #3594

Open
EmmanuelNiyonshuti wants to merge 16 commits into
python-trio:mainfrom
EmmanuelNiyonshuti:drop-py310
Open

EmmanuelNiyonshuti wants to merge 16 commits into
python-trio:mainfrom
EmmanuelNiyonshuti:drop-py310

Conversation

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor

Bumping minimum Python version to 3.11. LMK about anything I might have missed.

@codecov

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00000%. Comparing base (80fbe6b) to head (c838bc1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@               Coverage Diff               @@
##                 main        #3594   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files             128          128           
  Lines           19586        19541   -45     
  Branches         1334         1293   -41     
===============================================
- Hits            19586        19541   -45     
Files with missing lines Coverage Δ
src/trio/_abc.py 100.00000% <100.00000%> (ø)
src/trio/_channel.py 100.00000% <100.00000%> (ø)
src/trio/_core/_asyncgens.py 100.00000% <100.00000%> (ø)
src/trio/_core/_entry_queue.py 100.00000% <100.00000%> (ø)
src/trio/_core/_exceptions.py 100.00000% <100.00000%> (ø)
src/trio/_core/_ki.py 100.00000% <100.00000%> (ø)
src/trio/_core/_run.py 100.00000% <ø> (ø)
src/trio/_core/_tests/test_asyncgen.py 100.00000% <100.00000%> (ø)
src/trio/_core/_tests/test_exceptiongroup_gc.py 100.00000% <ø> (ø)
src/trio/_core/_tests/test_ki.py 100.00000% <100.00000%> (ø)
... and 26 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

All of these tests passes locally? I suspect one particular test failing.

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

All of these tests passes locally? I suspect one particular test failing.

Ah, I can reproduce! forgot --runs-slow

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

switching back to using Unpack in:

def run_sync_soon(
self,
sync_fn: Callable[[Unpack[PosArgsT]], object],
*args: Unpack[PosArgsT],
idempotent: bool = False,

does jedi not support * syntax?

@TeamSpen210

Copy link
Copy Markdown
Contributor

Not sure why you're mass-replacing NoReturn with Never - they are synonyms, but the former is more readable for function return values.

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Not sure why you're mass-replacing NoReturn with Never - they are synonyms, but the former is more readable for function return values.

Yes, but it's the preferred type to use moving forward for this.

Comment thread pyproject.toml

# conflicts with formatter (ruff recommends these be disabled)
"missing-trailing-comma", # COM812
"non-pep646-unpack" # (UP044) ignoring it for now(See: https://github.com/python-trio/trio/pull/3594#issuecomment-6898086470)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This should be removed once jedi supports * unpack operator.

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Not sure why you're mass-replacing NoReturn with Never - they are synonyms, but the former is more readable for function return values.

d097f18

- update requirements files
- remove tomli additional dependency in pre-commit config
- bump remaining python references to 3.11
@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Sorry, my commits history got a little messy on this one!

@A5rocks A5rocks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! I'm sure we will have a few follow ups (for example to process the strict exception groups deprecation), but this seems good.

Comment thread src/trio/_core/_run.py Resolved
Comment thread src/trio/_tests/test_repl.py Resolved
Comment thread src/trio/_tests/test_repl.py Resolved
Comment thread src/trio/_subprocess.py Resolved
Comment thread src/trio/_ssl.py Resolved
Comment thread tox.ini Resolved
@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Thanks! I'm sure we will have a few follow ups (for example to process the strict exception groups deprecation), but this seems good.

Yeah, probably.

Comment thread src/trio/_core/_tests/test_run.py Resolved
@A5rocks

A5rocks commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Looks like coverage dropped? codecov sucks and doesn't let me see which lines are bad but you can see a coverage report for each run in CI. For example the 1 missing line from trio/socket.py has to be one of these: https://github.com/python-trio/trio/actions/runs/46229863708/job/141243122529?pr=3594#step:4:2133

edit: actually, if you log into codecov w/ github, it starts working (at least it did for me)

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Yeah! and thank you for checking, I can also see it here:https://app.codecov.io/gh/python-trio/trio/tree/EmmanuelNiyonshuti%2Ftrio%3Adrop-py310?displayType=list. I just noticed there is an assertion I forgot to indent properly in a test and codecov got me :(
I am not entirely sure of trio/socket.py, though. I see same coverage misses on master too?

@EmmanuelNiyonshuti

EmmanuelNiyonshuti commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

coverage dropped even more!, I am going to re-run the full ci as some tests timed out. I am thinking coverage might be using incomplete reports?

edit: Well, I don't think that re-run code cov!

@A5rocks

A5rocks commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Yeah! and thank you for checking, I can also see it here:https://app.codecov.io/gh/python-trio/trio/tree/EmmanuelNiyonshuti%2Ftrio%3Adrop-py310?displayType=list. I just noticed there is an assertion I forgot to indent properly in a test and codecov got me :( I am not entirely sure of trio/socket.py, though. I see same coverage misses on master too?

I think the branch loss is simply because IP_BIND_ADDRESS_NO_PORT is always defined in Linux now. You should maybe investigate if that's just for the Linuxes we test on, or if it's maybe for all Python 3.11s. (You can probably just look at the CPython source and see if it's defined in an #ifdef?)

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Yeah! and thank you for checking, I can also see it here:https://app.codecov.io/gh/python-trio/trio/tree/EmmanuelNiyonshuti%2Ftrio%3Adrop-py310?displayType=list. I just noticed there is an assertion I forgot to indent properly in a test and codecov got me :( I am not entirely sure of trio/socket.py, though. I see same coverage misses on master too?

I think the branch loss is simply because IP_BIND_ADDRESS_NO_PORT is always defined in Linux now. You should maybe investigate if that's just for the Linuxes we test on, or if it's maybe for all Python 3.11s. (You can probably just look at the CPython source and see if it's defined in an #ifdef?)

For me it is only available on python3.14+, may be I can pragma: un cover it?

@A5rocks

A5rocks commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Yes, I think that is fine. Ideally, of course, we would actually be able to test that line in CI! (You can put # TODO: Test this line or something (it's documented somewhere) if you think it's possible/desirable to update our CI to actually test this)

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Yes, I think that is fine. Ideally, of course, we would actually be able to test that line in CI! (You can put # TODO: Test this line or something (it's documented somewhere) if you think it's possible/desirable to update our CI to actually test this)

I am thinking that the reason I only see this option on python3.14+ might be related to that I use uv managed python builds(I am not really sure, because I haven't looked into it deeply)!

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

Hmm.... looks like code coverage is not there yet! I am not sure which code is uncovered now, I will check.

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor Author

if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"):

if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"):

I think this is the partial miss coverage was complaining about.


SERVER_CTX = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"):
if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"): # pragma: no branch

@A5rocks A5rocks Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm. I'm not convinced this is necessary. Technically people could use a Python without openssl 3.0, but then they have an EOL openssl. Especially since this is just a test, IMO no need to be cautious.

ssl_context = ssl.create_default_context()

if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"):
if hasattr(ssl, "OP_IGNORE_UNEXPECTED_EOF"): # pragma: no branch

@A5rocks A5rocks Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Python 3.12 no longer has OP_IGNORE_UNEXPECTED_EOF in the options by default. Let's make this branch conditional on Python <3.12 and this hasattr, so we can remove this if statement in the future.

Comment thread src/trio/socket.py
Comment on lines +105 to +106
except NameError: # pragma: no cover
# TODO: Test this line

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
except NameError: # pragma: no cover
# TODO: Test this line
except NameError: # TODO: test this line

This branch has not been deployed

No deployments
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