Skip to content

Commit 3f3c8ff

Browse files
authored
feat: Support for Python 3.11 (#349)
* feat: officially test and support Python 3.11 Signed-off-by: Paul Horton <paul.horton@owasp.org> * removed unused imports Signed-off-by: Paul Horton <paul.horton@owasp.org> * bump `poetry` to `1.1.12` in CI Signed-off-by: Paul Horton <paul.horton@owasp.org> * fix: remove `toml` as dependency as not used and seems to be breaking Python 3.11 CI Signed-off-by: Paul Horton <paul.horton@owasp.org> * fix: removed `types-toml` from dependencies - not used Signed-off-by: Paul Horton <paul.horton@owasp.org> --------- Signed-off-by: Paul Horton <paul.horton@owasp.org>
1 parent 40145ce commit 3f3c8ff

File tree

7 files changed

+39
-68
lines changed

7 files changed

+39
-68
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
push:
55
branches: [ 'main' ]
66
workflow_dispatch:
7-
7+
88
env:
9-
PYTHON_VERSION_DEFAULT: "3.10"
9+
PYTHON_VERSION_DEFAULT: "3.11"
1010
POETRY_VERSION: "1.1.12"
1111

1212
jobs:
@@ -22,14 +22,14 @@ jobs:
2222
uses: actions/checkout@v3
2323
with:
2424
fetch-depth: 0
25-
25+
2626
- name: Setup python
2727
# see https://github.com/actions/setup-python
2828
uses: actions/setup-python@v4
2929
with:
3030
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
3131
architecture: 'x64'
32-
32+
3333
- name: Install and configure Poetry
3434
# See https://github.com/marketplace/actions/install-poetry-action
3535
uses: snok/install-poetry@v1
@@ -38,17 +38,17 @@ jobs:
3838
virtualenvs-create: true
3939
virtualenvs-in-project: true
4040
installer-parallel: true
41-
41+
4242
- name: Install dependencies
4343
run: poetry install --no-root
4444

4545
- name: View poetry version
4646
run: poetry --version
47-
47+
4848
- name: Python Semantic Release
4949
# see https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html
5050
# see https://github.com/relekang/python-semantic-release
51-
uses: relekang/python-semantic-release@v7.31.2
51+
uses: relekang/python-semantic-release@v7.33.2
5252
with:
5353
github_token: ${{ secrets.GITHUB_TOKEN }}
5454
repository_username: __token__

.github/workflows/poetry.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Python CI
44

55
on:
66
push:
7-
branches: ["master", "main"]
7+
branches: ["main"]
88
pull_request:
99
branches-ignore: ['dependabot/**']
1010
workflow_dispatch:
@@ -15,8 +15,8 @@ on:
1515

1616
env:
1717
REPORTS_DIR: CI_reports
18-
PYTHON_VERISON_DEFAULT: "3.10"
19-
POETRY_VERSION: "1.1.11"
18+
PYTHON_VERSION_DEFAULT: "3.11"
19+
POETRY_VERSION: "1.1.12"
2020

2121
jobs:
2222
coding-standards:
@@ -27,19 +27,23 @@ jobs:
2727
- name: Checkout
2828
# see https://github.com/actions/checkout
2929
uses: actions/checkout@v3
30+
3031
- name: Setup Python Environment
3132
# see https://github.com/actions/setup-python
3233
uses: actions/setup-python@v4
3334
with:
34-
python-version: ${{ env.PYTHON_VERISON_DEFAULT }}
35+
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
3536
architecture: 'x64'
37+
3638
- name: Install poetry
3739
# see https://github.com/marketplace/actions/setup-poetry
3840
uses: Gr1N/setup-poetry@v8
3941
with:
4042
poetry-version: ${{ env.POETRY_VERSION }}
43+
4144
- name: Install dependencies
4245
run: poetry install --no-root
46+
4347
- name: Run tox
4448
run: poetry run tox -e flake8 -s false
4549

@@ -53,7 +57,7 @@ jobs:
5357
include:
5458
- # test with the locked dependencies
5559
os: ubuntu-latest
56-
python-version: '3.10'
60+
python-version: '3.11'
5761
toxenv-factor: 'locked'
5862
- # test with the lowest dependencies
5963
os: ubuntu-latest
@@ -63,19 +67,23 @@ jobs:
6367
- name: Checkout
6468
# see https://github.com/actions/checkout
6569
uses: actions/checkout@v3
70+
6671
- name: Setup Python Environment
6772
# see https://github.com/actions/setup-python
6873
uses: actions/setup-python@v4
6974
with:
7075
python-version: ${{ matrix.python-version }}
7176
architecture: 'x64'
77+
7278
- name: Install poetry
7379
# see https://github.com/marketplace/actions/setup-poetry
7480
uses: Gr1N/setup-poetry@v8
7581
with:
7682
poetry-version: ${{ env.POETRY_VERSION }}
83+
7784
- name: Install dependencies
7885
run: poetry install --no-root
86+
7987
- name: Run tox
8088
run: poetry run tox -e mypy-${{ matrix.toxenv-factor }} -s false
8189

@@ -90,7 +98,8 @@ jobs:
9098
matrix:
9199
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
92100
python-version:
93-
- "3.10" # highest supported
101+
- "3.11" # highest supported
102+
- "3.10"
94103
- "3.9"
95104
- "3.8"
96105
- "3.7" # lowest supported
@@ -105,35 +114,45 @@ jobs:
105114
run: |
106115
git config --global core.autocrlf false
107116
git config --global core.eol lf
117+
108118
- name: Checkout
109119
# see https://github.com/actions/checkout
110120
uses: actions/checkout@v3
121+
111122
- name: Create reports directory
112123
run: mkdir ${{ env.REPORTS_DIR }}
124+
113125
- name: Setup Python Environment
114126
# see https://github.com/actions/setup-python
115127
uses: actions/setup-python@v4
116128
with:
117129
python-version: ${{ matrix.python-version }}
118130
architecture: 'x64'
131+
119132
- name: Validate Python Environment
120133
run: echo "import sys; print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding()))" | python
134+
121135
- name: Install poetry
122136
# see https://github.com/marketplace/actions/setup-poetry
123137
uses: Gr1N/setup-poetry@v8
124138
with:
125139
poetry-version: ${{ env.POETRY_VERSION }}
140+
126141
- name: Install dependencies
127142
run: poetry install --no-root
143+
128144
- name: Ensure build successful
129145
run: poetry build
146+
130147
- name: Run tox
131148
run: poetry run tox -e py-${{ matrix.toxenv-factor }} -s false
149+
132150
- name: Generate coverage reports
133151
run: >
134152
poetry run coverage report &&
135153
poetry run coverage xml -o ${{ env.REPORTS_DIR }}/coverage-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.toxenv-factor }}.xml &&
136154
poetry run coverage html -d ${{ env.REPORTS_DIR }}
155+
137156
- name: Artifact reports
138157
if: ${{ ! cancelled() }}
139158
# see https://github.com/actions/upload-artifact

poetry.lock

Lines changed: 5 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ classifiers = [
3434
'Programming Language :: Python :: 3.8',
3535
'Programming Language :: Python :: 3.9',
3636
'Programming Language :: Python :: 3.10',
37+
'Programming Language :: Python :: 3.11',
3738
'Typing :: Typed',
3839
]
3940
keywords = [
@@ -50,7 +51,6 @@ importlib-metadata = { version = ">= 3.4", python = "< 3.8" }
5051
packageurl-python = ">= 0.9"
5152
py-serializable = "^0.11.1"
5253
setuptools = ">= 47.0.0"
53-
toml = "^0.10.0"
5454
sortedcontainers = "^2.4.0"
5555

5656
[tool.poetry.dev-dependencies]
@@ -68,8 +68,6 @@ jsonschema = ">= 4.4.0"
6868
lxml = ">=4.7.0"
6969
# `types-setuptools` need to stay in sync with version of `setuptools` - but 47 was not typed...
7070
types-setuptools = ">= 57.0.0"
71-
# `types-toml` need to stay in sync with version of `toml`
72-
types-toml = "^0.10.0"
7371
xmldiff = ">=2.4"
7472

7573
[build-system]

requirements.lowest.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ py-serializable == 0.11.1
66
importlib-metadata == 3.4.0 # ; python_version < '3.8'
77
setuptools == 47.0.0
88
types-setuptools == 57.0.0
9-
toml == 0.10.0
10-
types-toml == 0.10.0

tests/test_output_xml.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
#
1717
# SPDX-License-Identifier: Apache-2.0
1818
# Copyright (c) OWASP Foundation. All Rights Reserved.
19-
import unittest
2019
from os.path import dirname, join
2120
from unittest.mock import Mock, patch
2221
from uuid import UUID
2322

24-
from cyclonedx.exception.model import UnknownComponentDependencyException
2523
from cyclonedx.model.bom import Bom
2624
from cyclonedx.output import get_instance
2725
from cyclonedx.schema import SchemaVersion
@@ -43,7 +41,6 @@
4341
get_bom_with_component_setuptools_with_release_notes,
4442
get_bom_with_component_setuptools_with_vulnerability,
4543
get_bom_with_component_toml_1,
46-
get_bom_with_dependencies_invalid,
4744
get_bom_with_dependencies_valid,
4845
get_bom_with_external_references,
4946
get_bom_with_metadata_component_and_dependencies,
@@ -262,27 +259,6 @@ def test_bom_v1_4_component_with_vulnerability(self) -> None:
262259
fixture='bom_setuptools_with_vulnerabilities.xml'
263260
)
264261

265-
@unittest.skip('Required Vulnerability Extension Schema - dropping support')
266-
def test_bom_v1_3_component_with_vulnerability(self) -> None:
267-
self._validate_xml_bom(
268-
bom=get_bom_with_component_setuptools_with_vulnerability(), schema_version=SchemaVersion.V1_3,
269-
fixture='bom_setuptools_with_vulnerabilities.xml'
270-
)
271-
272-
@unittest.skip('Required Vulnerability Extension Schema - dropping support')
273-
def test_bom_v1_2_component_with_vulnerability(self) -> None:
274-
self._validate_xml_bom(
275-
bom=get_bom_with_component_setuptools_with_vulnerability(), schema_version=SchemaVersion.V1_2,
276-
fixture='bom_setuptools_with_vulnerabilities.xml'
277-
)
278-
279-
@unittest.skip('Required Vulnerability Extension Schema - dropping support')
280-
def test_bom_v1_1_component_with_vulnerability(self) -> None:
281-
self._validate_xml_bom(
282-
bom=get_bom_with_component_setuptools_with_vulnerability(), schema_version=SchemaVersion.V1_1,
283-
fixture='bom_setuptools_with_vulnerabilities.xml'
284-
)
285-
286262
def test_bom_v1_0_component_with_vulnerability(self) -> None:
287263
self._validate_xml_bom(
288264
bom=get_bom_with_component_setuptools_with_vulnerability(), schema_version=SchemaVersion.V1_0,
@@ -511,14 +487,6 @@ def test_bom_v1_2_dependencies_for_bom_component(self) -> None:
511487
fixture='bom_dependencies_component.xml'
512488
)
513489

514-
@unittest.skip
515-
def test_bom_v1_4_dependencies_invalid(self) -> None:
516-
with self.assertRaises(UnknownComponentDependencyException):
517-
self._validate_xml_bom(
518-
bom=get_bom_with_dependencies_invalid(), schema_version=SchemaVersion.V1_4,
519-
fixture='bom_dependencies.xml'
520-
)
521-
522490
def test_bom_v1_4_issue_275_components(self) -> None:
523491
with self.assertWarns(UserWarning):
524492
self._validate_xml_bom(

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ minversion = 3.10
88
envlist =
99
flake8
1010
mypy-{locked,lowest}
11-
py{310,39,38,37}-{locked,lowest}
11+
py{311,310,39,38,37}-{locked,lowest}
1212
isolated_build = True
1313
skip_missing_interpreters = True
1414
usedevelop = False

0 commit comments

Comments
 (0)