Skip to content

Conversation

@cooperlees
Copy link
Collaborator

  • Update pyproject.toml etc.
  • Add to CI runs
  • Drop 3.9 as flake8 itself did

Test:

  • Run tox in 3.14
    • python3 -m venv /tmp/tf --upgrade-deps
    • /tmp/tf/bin/pip install tox
    • /tmp/tf/bin/tox -e py314

@cooperlees cooperlees requested a review from Copilot October 21, 2025 01:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR drops support for Python 3.9 and adds Python 3.14 to the CI pipeline, aligning with flake8's supported versions.

  • Removed Python 3.9 from all configuration files and CI workflows
  • Added Python 3.14 support to tox, pyproject.toml, and CI
  • Updated documentation to reflect the new minimum Python version (3.10)

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tox.ini Removed py39 from envlist and gh-actions mapping; added py314 support
pyproject.toml Updated Python version classifiers and minimum required version to 3.10
DEVELOPMENT.md Updated documentation to reflect Python 3.10 as the new minimum version
.github/workflows/flake8_py_version_check.yml Removed hardcoded Python 3.12 version to allow flexibility
.github/workflows/ci.yml Updated CI matrix to test Python 3.10-3.14 instead of 3.9-3.13
Comments suppressed due to low confidence (1)

tox.ini:4

  • The envlist still includes py39 but Python 3.9 support has been dropped. Remove py39 from this list to match the gh-actions configuration and project requirements.
envlist = py39, py310, py311, py312, py313, pep8_naming, mypy

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

DEVELOPMENT.md Outdated
/path/to/venv/bin/tox
```
will by default run all tests on python versions 3.9 through 3.13. If you only want to test a specific version you can specify the environment with `-e`
will by default run all tests on python versions 3.10 through 3.13. If you only want to test a specific version you can specify the environment with `-e`
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

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

The documentation states tests run on Python 3.10 through 3.13, but Python 3.14 support has been added. Update to '3.10 through 3.14' to reflect the current configuration.

Suggested change
will by default run all tests on python versions 3.10 through 3.13. If you only want to test a specific version you can specify the environment with `-e`
will by default run all tests on python versions 3.10 through 3.14. If you only want to test a specific version you can specify the environment with `-e`

Copilot uses AI. Check for mistakes.
- Update pyproject.toml etc.
- Add to CI runs
- Drop 3.9 as flake8 itself did
- Remove expected error in b912_py314.py ...
  Can we double check that makes sense ...

Test:
- Run tox in 3.14
  - `python3 -m venv /tmp/tf --upgrade-deps`
  - `/tmp/tf/bin/pip install tox`
  - `/tmp/tf/bin/tox -e py314`
- Repeat in 3.13
map(lambda x: x, "a", "b") # B912: 0
map(lambda x: x, "a", "b", *map("c")) # B912: 0
map(lambda x: x, "a", map(lambda x: x, "a"), strict=True) # B912: 22
map(lambda x: x, "a", map(lambda x: x, "a"), strict=True)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kasium - This makes sense right?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, seems like a mistake I did

@cooperlees
Copy link
Collaborator Author

cooperlees commented Oct 21, 2025

Seems we have new warnings to fix too:

tests/test_bugbear.py::test_eval[B012]
  <unknown>:5: SyntaxWarning: 'return' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:13: SyntaxWarning: 'return' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:21: SyntaxWarning: 'return' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:31: SyntaxWarning: 'return' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:44: SyntaxWarning: 'return' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:66: SyntaxWarning: 'break' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:78: SyntaxWarning: 'continue' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:101: SyntaxWarning: 'continue' in a 'finally' block

tests/test_bugbear.py::test_eval[B012]
  <unknown>:107: SyntaxWarning: 'break' in a 'finally' block

tests/test_bugbear.py::test_eval[B012_PY311]
  <unknown>:7: SyntaxWarning: 'return' in a 'finally' block

tests/test_bugbear.py::test_eval[B012_PY311]
  <unknown>:17: SyntaxWarning: 'return' in a 'finally' block

tests/test_bugbear.py::test_eval[B012_PY311]
  <unknown>:27: SyntaxWarning: 'return' in a 'finally' block
diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py
index 04835cf..1e34616 100644
--- a/tests/test_bugbear.py
+++ b/tests/test_bugbear.py
@@ -8,6 +8,7 @@ import site
 import subprocess
 import sys
 import unittest
+import warnings
 from argparse import Namespace
 from pathlib import Path

@@ -54,7 +55,12 @@ def test_eval(
     ]

     bbc = BugBearChecker(filename=str(path), options=options)
-    errors = [e for e in bbc.run() if (test == "B950" or not e[2].startswith("B950"))]
+    # Suppress SyntaxWarnings for B012 tests which intentionally contain
+    # return/break/continue in finally blocks (SyntaxWarning in Python 3.14+)
+    with warnings.catch_warnings():
+        if test.startswith("B012"):
+            warnings.filterwarnings("ignore", category=SyntaxWarning)
+        errors = [e for e in bbc.run() if (test == "B950" or not e[2].startswith("B950"))]
     errors.sort()
     assert errors == tuple_expected
  • Should we just supress B012 and eventually retire it once we're >=3.14 project? Is that the right thing to do?

@JelleZijlstra
Copy link
Collaborator

Should we just supress B012 and eventually retire it once we're >=3.14 project? Is that the right thing to do?

Catching this in linters is still going to be helpful; the SyntaxWarning has some practical issues that make it not work as well as it ideally should.

@cooperlees
Copy link
Collaborator Author

Ok, should we just suppress the warnings in the testing code or leave them?

@JelleZijlstra
Copy link
Collaborator

JelleZijlstra commented Oct 21, 2025

I'd suppress them.

@cooperlees cooperlees merged commit 4601fe6 into main Oct 22, 2025
11 checks passed
@cooperlees cooperlees deleted the 3_14 branch October 22, 2025 01: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.

4 participants