Skip to content

Commit d27bcdf

Browse files
authored
Merge pull request #427 from twisted/py311
Add first-class support for Python 3.11
2 parents 6c94dc2 + 013bf42 commit d27bcdf

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ jobs:
7171
- name: CPython 3.10
7272
tox: py310
7373
action: '3.10'
74+
- name: CPython 3.11
75+
tox: py311
76+
action: '3.11.0-beta - 3.11'
7477
- name: PyPy 3.7
7578
tox: pypy37
7679
action: pypy-3.7

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"Programming Language :: Python :: 3.8",
3333
"Programming Language :: Python :: 3.9",
3434
"Programming Language :: Python :: 3.10",
35+
"Programming Language :: Python :: 3.11",
3536
"Programming Language :: Python :: Implementation :: CPython",
3637
"Programming Language :: Python :: Implementation :: PyPy",
3738
],
@@ -43,7 +44,7 @@
4344
"incremental",
4445
"jinja2",
4546
"setuptools",
46-
"tomli",
47+
"tomli; python_version<'3.11'",
4748
],
4849
extras_require={
4950
"dev": [

src/towncrier/_settings/load.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@
44
from __future__ import annotations
55

66
import os
7+
import sys
78

89
from collections import OrderedDict
910
from typing import Any, Mapping
1011

1112
import pkg_resources
12-
import tomli
1313

1414
from .._settings import fragment_types as ft
1515

1616

17+
if sys.version_info < (3, 11):
18+
import tomli as tomllib
19+
else:
20+
import tomllib
21+
22+
1723
class ConfigError(Exception):
1824
def __init__(self, *args: str, **kwargs: str):
1925
self.failing_option = kwargs.get("failing_option")
@@ -66,7 +72,7 @@ def load_config(directory: str) -> Mapping[str, Any] | None:
6672

6773
def load_config_from_file(directory: str, config_file: str) -> Mapping[str, Any]:
6874
with open(config_file, "rb") as conffile:
69-
config = tomli.load(conffile)
75+
config = tomllib.load(conffile)
7076

7177
return parse_toml(directory, config)
7278

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Python 3.11 is now officially supported.

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = pre-commit, {pypy37,pypy38,py37,py38,py39,py310}-tests, check-manifest, check-newsfragment, typecheck
2+
envlist = pre-commit, {pypy37,pypy38,py37,py38,py39,py310,py311}-tests, check-manifest, check-newsfragment, typecheck
33
isolated_build=true
44
skip_missing_envs = true
55

0 commit comments

Comments
 (0)