Commit e21a5b5
authored
Drop Python 3.11, require Python 3.12+ and update to modern type parameter syntax (#2842)
* Drop Python 3.11, require Python 3.12+, test Python 3.14
This commit drops Python 3.11 support and require Python 3.12+ following SPEC 0.
See the Python 3.12 release notes: https://docs.python.org/3/whatsnew/3.12.html
The Mesa 3.3.x release series will keep supporting Python 3.11.
* Upgrade to Python 3.12 and apply type parameter syntax
With the minimum Python version now at 3.12, we can use the modern type parameter syntax (PEP 695) instead of the legacy Generic[T] pattern. This change improves code readability and aligns with current Python typing best practices.
Changes:
- CellCollection: Convert from Generic[T] to type parameter syntax with Cell bound
- DiscreteSpace: Convert from Generic[T] to type parameter syntax with Cell bound
- Grid: Remove redundant Generic[T] inheritance (already inherits from DiscreteSpace[T])
- accept_tuple_argument: Convert function type variable to use type parameter syntax
- Remove unused Generic imports from typing module
These changes are purely syntactic modernizations with no functional impact. The type parameter syntax is more concise and better integrated with Python's type system.
Fixes ruff UP046 and UP047 violations.
* Remove redundant Generic inheritance from Grid class
The Grid class inherits from DiscreteSpace[T], which already provides generic type support. The additional Generic[T] inheritance is redundant and triggers a ruff UP046 violation.
Changes:
- Remove Generic[T] from Grid class inheritance
- Remove unused Generic import from typing module
- Keep TypeVar T definition as it's still needed for DiscreteSpace[T] parameterization
Fixes ruff UP046 violation in grid.py.
* CI: Remove Python 3.11 run1 parent e1f9780 commit e21a5b5
File tree
8 files changed
+12
-15
lines changed- .github/workflows
- docs/tutorials
- mesa
- discrete_space
8 files changed
+12
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | | - | |
| 100 | + | |
102 | 101 | | |
103 | | - | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
0 commit comments