Skip to content

Commit 69c2ca8

Browse files
committed
- support Python 3.13
1 parent 95f323c commit 69c2ca8

File tree

9 files changed

+209
-9
lines changed

9 files changed

+209
-9
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- ["3.10", "py310"]
3030
- ["3.11", "py311"]
3131
- ["3.12", "py312"]
32-
- ["3.13.0-alpha - 3.13.0", "py313"]
32+
- ["3.13", "py313"]
3333
- ["3.9", "docs"]
3434
- ["3.9", "coverage"]
3535
- ["3.9", "py39-datetime"]
@@ -48,6 +48,7 @@ jobs:
4848
uses: actions/setup-python@v4
4949
with:
5050
python-version: ${{ matrix.config[0] }}
51+
allow-prereleases: true
5152
- name: Pip cache
5253
uses: actions/cache@v3
5354
with:

.meta.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ testenv-additional = [
4747
" coverage combine",
4848
" coverage html",
4949
" coverage report -m --fail-under=100",
50-
"depends = py37,py38,py39,py39-datetime,py310,py311,py312,coverage",
50+
"depends = py37,py38,py39,py39-datetime,py310,py311,py312,py313,coverage",
5151
]
5252
coverage-basepython = "python3.8"
5353
coverage-command = "pytest --cov=src --cov=tests --cov-report= {posargs}"

CHANGES.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ Changes
44
7.4 (unreleased)
55
----------------
66

7-
- Allow to use the package with Python 3.13 -- Caution: No security
8-
audit has been done so far.
7+
- Allow to use the package with Python 3.13.
98

109

1110
7.3 (2024-09-30)

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# The suffix(es) of source filenames.
3838
# You can specify multiple suffix as a list of string:
3939
# source_suffix = ['.rst', '.md']
40-
source_suffix = '.rst'
40+
source_suffix = {'.rst': 'restructuredtext'}
4141

4242
# The encoding of source files.
4343
# source_encoding = 'utf-8-sig'
@@ -113,6 +113,7 @@
113113
'python310': ('https://docs.python.org/3.10', None),
114114
'python311': ('https://docs.python.org/3.11', None),
115115
'python312': ('https://docs.python.org/3.12', None),
116+
'python313': ('https://docs.python.org/3.13', None),
116117
}
117118

118119
# Options for sphinx.ext.todo:
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
-- Python 3.13 AST
2+
-- ASDL's 4 builtin types are:
3+
-- identifier, int, string, constant
4+
5+
module Python version "3.13"
6+
{
7+
mod = Module(stmt* body, type_ignore* type_ignores)
8+
| Interactive(stmt* body)
9+
| Expression(expr body)
10+
| FunctionType(expr* argtypes, expr returns)
11+
12+
stmt = FunctionDef(identifier name,
13+
arguments args,
14+
stmt* body,
15+
expr* decorator_list,
16+
expr? returns,
17+
string? type_comment,
18+
type_param* type_params)
19+
| AsyncFunctionDef(identifier name,
20+
arguments args,
21+
stmt* body,
22+
expr* decorator_list,
23+
expr? returns,
24+
string? type_comment,
25+
type_param* type_params)
26+
27+
| ClassDef(identifier name,
28+
expr* bases,
29+
keyword* keywords,
30+
stmt* body,
31+
expr* decorator_list,
32+
type_param* type_params)
33+
| Return(expr? value)
34+
35+
| Delete(expr* targets)
36+
| Assign(expr* targets, expr value, string? type_comment)
37+
| TypeAlias(expr name, type_param* type_params, expr value)
38+
| AugAssign(expr target, operator op, expr value)
39+
-- 'simple' indicates that we annotate simple name without parens
40+
| AnnAssign(expr target, expr annotation, expr? value, int simple)
41+
42+
-- use 'orelse' because else is a keyword in target languages
43+
| For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
44+
| AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
45+
| While(expr test, stmt* body, stmt* orelse)
46+
| If(expr test, stmt* body, stmt* orelse)
47+
| With(withitem* items, stmt* body, string? type_comment)
48+
| AsyncWith(withitem* items, stmt* body, string? type_comment)
49+
50+
| Match(expr subject, match_case* cases)
51+
52+
| Raise(expr? exc, expr? cause)
53+
| Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
54+
| TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
55+
| Assert(expr test, expr? msg)
56+
57+
| Import(alias* names)
58+
| ImportFrom(identifier? module, alias* names, int? level)
59+
60+
| Global(identifier* names)
61+
| Nonlocal(identifier* names)
62+
| Expr(expr value)
63+
| Pass
64+
| Break
65+
| Continue
66+
67+
-- col_offset is the byte offset in the utf8 string the parser uses
68+
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
69+
70+
-- BoolOp() can use left & right?
71+
expr = BoolOp(boolop op, expr* values)
72+
| NamedExpr(expr target, expr value)
73+
| BinOp(expr left, operator op, expr right)
74+
| UnaryOp(unaryop op, expr operand)
75+
| Lambda(arguments args, expr body)
76+
| IfExp(expr test, expr body, expr orelse)
77+
| Dict(expr* keys, expr* values)
78+
| Set(expr* elts)
79+
| ListComp(expr elt, comprehension* generators)
80+
| SetComp(expr elt, comprehension* generators)
81+
| DictComp(expr key, expr value, comprehension* generators)
82+
| GeneratorExp(expr elt, comprehension* generators)
83+
-- the grammar constrains where yield expressions can occur
84+
| Await(expr value)
85+
| Yield(expr? value)
86+
| YieldFrom(expr value)
87+
-- need sequences for compare to distinguish between
88+
-- x < 4 < 3 and (x < 4) < 3
89+
| Compare(expr left, cmpop* ops, expr* comparators)
90+
| Call(expr func, expr* args, keyword* keywords)
91+
| FormattedValue(expr value, int conversion, expr? format_spec)
92+
| JoinedStr(expr* values)
93+
| Constant(constant value, string? kind)
94+
95+
-- the following expression can appear in assignment context
96+
| Attribute(expr value, identifier attr, expr_context ctx)
97+
| Subscript(expr value, expr slice, expr_context ctx)
98+
| Starred(expr value, expr_context ctx)
99+
| Name(identifier id, expr_context ctx)
100+
| List(expr* elts, expr_context ctx)
101+
| Tuple(expr* elts, expr_context ctx)
102+
103+
-- can appear only in Subscript
104+
| Slice(expr? lower, expr? upper, expr? step)
105+
106+
-- col_offset is the byte offset in the utf8 string the parser uses
107+
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
108+
109+
expr_context = Load
110+
| Store
111+
| Del
112+
113+
boolop = And
114+
| Or
115+
116+
operator = Add
117+
| Sub
118+
| Mult
119+
| MatMult
120+
| Div
121+
| Mod
122+
| Pow
123+
| LShift
124+
| RShift
125+
| BitOr
126+
| BitXor
127+
| BitAnd
128+
| FloorDiv
129+
130+
unaryop = Invert
131+
| Not
132+
| UAdd
133+
| USub
134+
135+
cmpop = Eq
136+
| NotEq
137+
| Lt
138+
| LtE
139+
| Gt
140+
| GtE
141+
| Is
142+
| IsNot
143+
| In
144+
| NotIn
145+
146+
comprehension = (expr target, expr iter, expr* ifs, int is_async)
147+
148+
excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)
149+
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
150+
151+
arguments = (arg* posonlyargs,
152+
arg* args,
153+
arg? vararg,
154+
arg* kwonlyargs,
155+
expr* kw_defaults,
156+
arg? kwarg,
157+
expr* defaults)
158+
159+
arg = (identifier arg, expr? annotation, string? type_comment)
160+
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
161+
162+
-- keyword arguments supplied to call (NULL identifier for **kwargs)
163+
keyword = (identifier? arg, expr value)
164+
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
165+
166+
-- import name with optional 'as' alias.
167+
alias = (identifier name, identifier? asname)
168+
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
169+
170+
withitem = (expr context_expr, expr? optional_vars)
171+
172+
match_case = (pattern pattern, expr? guard, stmt* body)
173+
174+
pattern = MatchValue(expr value)
175+
| MatchSingleton(constant value)
176+
| MatchSequence(pattern* patterns)
177+
| MatchMapping(expr* keys, pattern* patterns, identifier? rest)
178+
| MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)
179+
180+
| MatchStar(identifier? name)
181+
-- The optional "rest" MatchMapping parameter handles capturing extra mapping keys
182+
183+
| MatchAs(pattern? pattern, identifier? name)
184+
| MatchOr(pattern* patterns)
185+
186+
attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
187+
188+
type_ignore = TypeIgnore(int lineno, string tag)
189+
190+
type_param = TypeVar(identifier name, expr? bound, expr? default_value)
191+
| ParamSpec(identifier name, expr? default_value)
192+
| TypeVarTuple(identifier name, expr? default_value)
193+
attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
194+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Changes from Python 3.12 to Python 3.13
2+
---------------------------------------
3+
4+
.. literalinclude:: ast/python3_13.ast
5+
:diff: ast/python3_12.ast

docs/contributing/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ A (modified style) Copy of all Abstract Grammar Definitions for the Python versi
105105
changes_from39to310
106106
changes_from310to311
107107
changes_from311to312
108+
changes_from312to313
108109

109110
.. _understand:
110111

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def read(*rnames):
5050
'Programming Language :: Python :: 3.10',
5151
'Programming Language :: Python :: 3.11',
5252
'Programming Language :: Python :: 3.12',
53+
'Programming Language :: Python :: 3.13',
5354
'Programming Language :: Python :: Implementation :: CPython',
5455
'Topic :: Security',
5556
],

tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ envlist =
2121
usedevelop = true
2222
package = wheel
2323
wheel_build_env = .pkg
24-
pip_pre = py313: true
2524
deps =
2625
datetime: DateTime
2726
-cconstraints.txt
2827
pytest-cov
2928
Sphinx
3029
setenv =
3130
COVERAGE_FILE=.coverage.{envname}
32-
py312: VIRTUALENV_PIP=23.1.2
33-
py312: PIP_REQUIRE_VIRTUALENV=0
3431
commands =
3532
python -V
3633
pytest --cov=src --cov=tests --cov-report= {posargs}
@@ -54,7 +51,8 @@ commands =
5451
coverage combine
5552
coverage html
5653
coverage report -m --fail-under=100
57-
depends = py37,py38,py39,py39-datetime,py310,py311,py312,coverage
54+
depends = py37,py38,py39,py39-datetime,py310,py311,py312,py313,coverage
55+
5856
[testenv:release-check]
5957
description = ensure that the distribution is ready to release
6058
basepython = python3

0 commit comments

Comments
 (0)