Skip to content

Commit

Permalink
python-3.11 compatibility
Browse files Browse the repository at this point in the history
Resolve #1021.
  • Loading branch information
ryneeverett committed Jan 3, 2024
1 parent a2d6016 commit d5ab94a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bugwarrior.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
timeout-minutes: 5
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", 3.11]
jira-version: [1.0.10, 2.0.0]
steps:
- name: Checkout code
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", 3.11]
jira-version: [1.0.10, 2.0.0]
architecture: [aarch64, ppc64le]

Expand Down
21 changes: 20 additions & 1 deletion bugwarrior/services/bts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import debianbts
import sys

import pydantic
import requests
import typing_extensions
Expand All @@ -9,6 +10,14 @@
import logging
log = logging.getLogger(__name__)

try:
import debianbts
except AttributeError as e:
# Suppress exception if we're just building docs in python-3.11+.
if 'sphinx' not in ''.join(sys.argv):
log.warning('debianbts does not support python-3.11+')
raise e

UDD_BUGS_SEARCH = "https://udd.debian.org/bugs/"


Expand Down Expand Up @@ -37,6 +46,16 @@ def udd_needs_email(cls, values):
raise ValueError("no 'email' but UDD search was requested")
return values

@pydantic.root_validator
def python_version_limited(cls, values):
log.warning(
'The Debian BTS service has a dependency that has not yet been '
'ported to python-3.11+. If this has not been resolved by October '
'2026, when python-3.10 hits EOL, this service is liable to be '
'removed. See '
'<https://github.com/venthur/python-debianbts/issues/59>.')
return values


class BTSIssue(Issue):
SUBJECT = 'btssubject'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

extras = {
"activecollab": ["pypandoc", "pyac>=0.1.5"],
"bts": ["PySimpleSOAP", "python-debianbts>=2.6.1"],
"bts": ["python-debianbts>=2.6.1"],
"bugzilla": ["python-bugzilla>=2.0.0"],
"gmail": ["google-api-python-client", "google-auth-oauthlib"],
"ini2toml": ["ini2toml[full]"],
Expand Down
8 changes: 7 additions & 1 deletion tests/test_bts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from unittest import mock
import sys
from unittest import mock, SkipTest

if sys.version_info >= (3, 11):
raise SkipTest(
"Python-3.11+ not supported. "
"See <https://github.com/venthur/python-debianbts/issues/59>.")

from bugwarrior.services import bts

Expand Down

0 comments on commit d5ab94a

Please sign in to comment.