Skip to content

Commit 7992f0b

Browse files
Merge pull request #33 from mam-dev/py312
Support Python 3.12
2 parents b093f2f + dbf6a76 commit 7992f0b

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
python_version: ["3.8", "3.9", "3.10", "3.11"]
13+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1414
runs-on: "ubuntu-latest"
1515
steps:
1616
- uses: actions/checkout@v3

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ classifiers = [
1919
"Programming Language :: Python :: 3.9",
2020
"Programming Language :: Python :: 3.10",
2121
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
2223
"Topic :: Security",
2324
"License :: OSI Approved :: Apache Software License",
2425
]
@@ -73,7 +74,7 @@ disallow_untyped_decorators = true
7374
no_implicit_optional = true
7475
no_implicit_reexport = true
7576
strict_equality = true
76-
strict_concatenate = true
77+
extra_checks = true
7778

7879
[tool.ruff]
7980
src = ["src", "test"]

src/security_constraints/github_security_advisory.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def get_vulnerabilities(
125125
after = json_data["securityVulnerabilities"]["pageInfo"]["endCursor"]
126126
except KeyError as missing_key:
127127
error_msg = f"Key {missing_key} not found in: {json_response}"
128-
LOGGER.error(error_msg)
129128
raise FetchVulnerabilitiesError(error_msg) from None
130129

131130
return vulnerabilities
@@ -138,6 +137,8 @@ def _do_graphql_request(
138137
severities=",".join(sorted([str(severity) for severity in severities])),
139138
additional=f'after:"{after}"' if after is not None else "",
140139
)
140+
LOGGER.debug("GraphQL query: %s", query)
141+
LOGGER.debug("Sending request to %s", self.URL)
141142
response: requests.Response = self._session.post(
142143
url=self.URL,
143144
headers={"Authorization": f"bearer {self._token}"},
@@ -151,15 +152,17 @@ def _do_graphql_request(
151152
f"Unexpected json data format in response: {json_content}"
152153
)
153154
except requests.HTTPError as error:
154-
LOGGER.error(
155-
"HTTP error (status %s) received from URL %s: %s",
156-
response.status_code,
157-
self.URL,
158-
error,
155+
error_msg = (
156+
"HTTP error (status {status}) received from URL {url}: {err}".format(
157+
status=response.status_code,
158+
url=self.URL,
159+
err=error,
160+
)
159161
)
160-
raise FetchVulnerabilitiesError from error
162+
raise FetchVulnerabilitiesError(error_msg) from error
161163
except requests.JSONDecodeError as error:
162-
LOGGER.error("Could not decode json data in response: %s", response.text)
163-
raise FetchVulnerabilitiesError from error
164+
error_msg = f"Could not decode json data in response: {response.text}"
165+
raise FetchVulnerabilitiesError(error_msg) from error
164166
else:
167+
LOGGER.debug("Request to %s was successful", self.URL)
165168
return json_content

src/security_constraints/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ def main() -> int:
277277
output.write(
278278
f"{format_constraints_file_line(constraints, vulnerability)}\n"
279279
)
280-
except SecurityConstraintsError as error:
281-
LOGGER.error(error)
280+
except SecurityConstraintsError:
281+
LOGGER.exception("Program exited with an exception.")
282282
return 1
283283
except Exception as error:
284284
LOGGER.critical(

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py38,py39,py310,py311
2+
envlist = py38,py39,py310,py311,py312
33
isolated_build = True
44
minversion = 4.0.0
55

@@ -9,6 +9,7 @@ python =
99
3.9: py39
1010
3.10: py310
1111
3.11: py311
12+
3.12: py312
1213

1314
[testenv]
1415
deps =

0 commit comments

Comments
 (0)