Skip to content

Commit

Permalink
Merge pull request #427 from twisted/py311
Browse files Browse the repository at this point in the history
Add first-class support for Python 3.11
  • Loading branch information
adiroiban committed Sep 12, 2022
2 parents 6c94dc2 + 013bf42 commit d27bcdf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ jobs:
- name: CPython 3.10
tox: py310
action: '3.10'
- name: CPython 3.11
tox: py311
action: '3.11.0-beta - 3.11'
- name: PyPy 3.7
tox: pypy37
action: pypy-3.7
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand All @@ -43,7 +44,7 @@
"incremental",
"jinja2",
"setuptools",
"tomli",
"tomli; python_version<'3.11'",
],
extras_require={
"dev": [
Expand Down
10 changes: 8 additions & 2 deletions src/towncrier/_settings/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@
from __future__ import annotations

import os
import sys

from collections import OrderedDict
from typing import Any, Mapping

import pkg_resources
import tomli

from .._settings import fragment_types as ft


if sys.version_info < (3, 11):
import tomli as tomllib
else:
import tomllib


class ConfigError(Exception):
def __init__(self, *args: str, **kwargs: str):
self.failing_option = kwargs.get("failing_option")
Expand Down Expand Up @@ -66,7 +72,7 @@ def load_config(directory: str) -> Mapping[str, Any] | None:

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

return parse_toml(directory, config)

Expand Down
1 change: 1 addition & 0 deletions src/towncrier/newsfragments/427.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python 3.11 is now officially supported.
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = pre-commit, {pypy37,pypy38,py37,py38,py39,py310}-tests, check-manifest, check-newsfragment, typecheck
envlist = pre-commit, {pypy37,pypy38,py37,py38,py39,py310,py311}-tests, check-manifest, check-newsfragment, typecheck
isolated_build=true
skip_missing_envs = true

Expand Down

0 comments on commit d27bcdf

Please sign in to comment.