Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: v5.0.0 #440

Merged
merged 45 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0a3ae26
chore: init 5.0.0-dev
jkowalleck Sep 19, 2023
1571d21
Drop py37 (#441)
jkowalleck Sep 19, 2023
5cb695e
chore(build): test before release
jkowalleck Sep 19, 2023
a4f5ec5
feat: add CycloneDX document validators to public API (#433)
jkowalleck Sep 19, 2023
3de2493
typo
jkowalleck Sep 20, 2023
06b5eb0
proper enums (#447)
jkowalleck Sep 21, 2023
39e0eb9
chore: absolute tet imports
jkowalleck Sep 21, 2023
1c9ea9e
feat: easy access validators (#448)
jkowalleck Sep 21, 2023
18b4eca
chore: sem-release config
jkowalleck Sep 23, 2023
839fe11
chore: config sem-release
jkowalleck Sep 23, 2023
7186b52
tests: use internal json strict validation
jkowalleck Sep 23, 2023
6adc98f
docs: fix typo
jkowalleck Sep 25, 2023
9d49280
docs: fix hilighter
jkowalleck Sep 25, 2023
16843b2
fix: `bom.validate()` detects invalid license constellations (#452)
jkowalleck Sep 25, 2023
3bcd9e9
feat: options for beautiful output (#458)
jkowalleck Oct 4, 2023
c8c2183
Merge branch 'main' into 5.0.0-dev
jkowalleck Oct 4, 2023
5d7b86c
perf: make validation more secure
jkowalleck Oct 4, 2023
37219c3
chore: remove encoding hint (#459)
jkowalleck Oct 4, 2023
eaba7a0
feat: support python 3.12 (#460)
jkowalleck Oct 4, 2023
ac6ad0e
chore: clean deps
jkowalleck Oct 5, 2023
84c6504
fix: tuple stuff (#461)
jkowalleck Oct 5, 2023
2240b4d
fix: typing for `kwargs` (#462)
jkowalleck Oct 5, 2023
a68ae24
Feat: typing, typehints, & overload (#463)
jkowalleck Oct 6, 2023
7543789
tests: snapshots and complete deep comparison, instead of pseudo-comp…
jkowalleck Oct 8, 2023
1e963bd
chore: revisit license headers
jkowalleck Oct 9, 2023
6770786
fix: multiple licenses issue #365 (#466)
jkowalleck Oct 10, 2023
4c2ef14
tests for backwards compatibility of #365 (#467)
jkowalleck Oct 11, 2023
bae8a84
chore!: bump major version to v5
jkowalleck Oct 11, 2023
4d65b10
chore(release): 5.0.0-rc.1
Oct 11, 2023
a911106
chore: revert changelog
jkowalleck Oct 11, 2023
65e79cf
refactor: schema based validator (#468)
jkowalleck Oct 13, 2023
2a2b2dd
refactor(DX): rename `get_instance()` (#469)
jkowalleck Oct 14, 2023
55f6f4d
Merge branch 'main' into 5.0.0-dev
jkowalleck Oct 16, 2023
6316f09
tidy
jkowalleck Oct 16, 2023
9373afc
docs: update title
jkowalleck Oct 18, 2023
2967f28
ci: revisit coverage reporting
jkowalleck Oct 19, 2023
bc8e30b
ci: revisit coverage reporting
jkowalleck Oct 19, 2023
c4f7281
Merge remote-tracking branch 'origin/main' into 5.0.0-dev
jkowalleck Oct 19, 2023
d09ac36
reduce imports
jkowalleck Oct 20, 2023
bb0f7a5
style: streamline code quality (#472)
jkowalleck Oct 20, 2023
a2af2ed
style: qa
jkowalleck Oct 20, 2023
e298726
feat: v5.0.0-rc.2
jkowalleck Oct 20, 2023
ccbb01b
chore(release): 5.0.0-rc.2
Oct 20, 2023
744c095
chore: revert Chanelog
jkowalleck Oct 20, 2023
14d1185
tests: find common security issues (#473)
jkowalleck Oct 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trim_trailing_whitespace = false
indent_style = space
indent_size = 4

[*.ini]
[{*.ini,.bandit,.flake8}]
charset = latin1
indent_style = space
indent_size = 4
20 changes: 20 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[flake8]
## https://flake8.pycqa.org/en/latest/user/configuration.html
## keep in sync with isort config - in `isort.cfg` file

exclude =
build,dist,__pycache__,.eggs,*.egg-info*,
*_cache,*.cache,
.git,.tox,.venv,venv,.venv*,venv*,
_OLD,_TEST,
docs

max-line-length = 120

max-complexity = 10

ignore =
# ignore `self`, `cls` markers of flake8-annotations>=2.0
ANN101,ANN102
# ignore ANN401 for dynamically typed *args and **kwargs
ANN401
82 changes: 55 additions & 27 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,48 @@ jobs:
- name: Install dependencies
run: poetry install --no-root
- name: Run tox
run: poetry run tox -e flake8 -s false
run: poetry run tox run -e flake8 -s false

security-issues:
name: find Security Issues
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Setup Python Environment
# see https://github.com/actions/setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
architecture: 'x64'
- name: Install poetry
# see https://github.com/marketplace/actions/setup-poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --no-root
- name: Run tox
run: poetry run tox run -e bandit -s false

static-code-analysis:
name: StaticCodingAnalysis (py${{ matrix.python-version}} ${{ matrix.toxenv-factor }})
name: StaticCodingAnalysis (py${{ matrix.python-version}} ${{ matrix.toxenv-factors }})
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- # test with the locked dependencies
- # test with the latest dependencies
os: ubuntu-latest
python-version: '3.11'
toxenv-factor: 'locked'
python-version: '3.12'
toxenv-factors: '-current'
- # test with the lowest dependencies
os: ubuntu-latest
python-version: '3.7'
toxenv-factor: 'lowest'
python-version: '3.8'
toxenv-factors: '-lowest'
steps:
- name: Checkout
# see https://github.com/actions/checkout
Expand All @@ -82,28 +106,25 @@ jobs:
- name: Install dependencies
run: poetry install --no-root
- name: Run tox
run: poetry run tox -e mypy-${{ matrix.toxenv-factor }} -s false
run: poetry run tox run -e mypy${{ matrix.toxenv-factors }} -s false

build-and-test:
name: Test (${{ matrix.os }} py${{ matrix.python-version }} ${{ matrix.toxenv-factor }})
name: Test (${{ matrix.os }} py${{ matrix.python-version }} ${{ matrix.toxenv-factors }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
python-version:
- "3.11" # highest supported
- "3.12" # highest supported
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7" # lowest supported
toxenv-factor: ['locked']
include:
- # test with the lowest dependencies
os: ubuntu-latest
python-version: '3.7'
toxenv-factor: 'lowest'
- "3.8" # lowest supported
toxenv-factors:
- '-allExtras'
- '-noExtras'
steps:
- name: Disabled Git auto EOL CRLF transforms
run: |
Expand Down Expand Up @@ -135,14 +156,14 @@ jobs:
- name: Ensure build successful
run: poetry build
- name: Run tox
run: poetry run tox -e py-${{ matrix.toxenv-factor }} -s false
run: poetry run tox run -e py${{ matrix.toxenv-factors }} -s false
- name: Generate coverage reports
if: ${{ failure() || success() }}
shell: bash
run: |
set -eux
poetry run coverage report
poetry run coverage xml -o "$REPORTS_DIR/coverage.${{ matrix.os }}_py${{ matrix.python-version }}_${{ matrix.toxenv-factor }}.cobertura.xml"
# poetry run coverage lcov -o "$REPORTS_DIR/coverage.${{ matrix.os }}_py${{ matrix.python-version }}_${{ matrix.toxenv-factor }}.lcov.xml"
poetry run coverage report -m
poetry run coverage xml -o '${{ env.REPORTS_DIR }}/coverage/${{ matrix.os }}_py${{ matrix.python-version }}_${{ matrix.toxenv-factors }}.cobertura.xml'
- name: Artifact reports
if: ${{ ! cancelled() }}
# see https://github.com/actions/upload-artifact
Expand Down Expand Up @@ -172,12 +193,19 @@ jobs:
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ env.CODACY_PROJECT_TOKEN }}
coverage-reports: ${{ env.REPORTS_DIR }}/coverage.*
coverage-reports: ${{ env.REPORTS_DIR }}/coverage/*

examples:
name: Examples
name: Examples E:${{ matrix.install-extras || '<none>' }}
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
install-extras:
- '' # none
- json-validation
- xml-validation
steps:
- name: Checkout
# see https://github.com/actions/checkout
Expand All @@ -186,7 +214,7 @@ jobs:
# see https://github.com/actions/setup-python
uses: actions/setup-python@v4
with:
python-version: '>=3.7 <=3.11' # supported version range
python-version: '>=3.8 <=3.12' # supported version range
- name: Validate Python Environment
shell: python
run: |
Expand All @@ -198,7 +226,7 @@ jobs:
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install package and prod dependencies
run: poetry install --only=main -vvv
run: poetry install --only=main --extras='${{ matrix.install-extras }}' -vvv
- name: run all examples
run: >
find examples -type f -name '*.py' -print0
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,31 @@ env:
POETRY_VERSION: "1.4.1"

jobs:
quicktest:
runs-on: ubuntu-latest
steps:
- name: Checkout code
# see https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Setup Python Environment
# see https://github.com/actions/setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
architecture: 'x64'
- name: Install poetry
# see https://github.com/marketplace/actions/setup-poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --no-root
- name: Run tox
run: poetry run tox run -e py -s false

release:
needs:
- quicktest
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
# limit this to being run on regular commits, not the commits that semantic-release will create
# but also allow manual workflow dispatch
Expand Down
4 changes: 3 additions & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[settings]
## read the docs: https://pycqa.github.io/isort/docs/configuration/options.html
## keep in sync with flake8 config - in `tox.ini` file
## keep in sync with flake8 config - in `.flake8` file
known_first_party = cyclonedx
skip_gitignore = false
skip_glob =
Expand All @@ -20,3 +20,5 @@ src_paths =
cyclonedx
tests
typings
examples
tools
6 changes: 2 additions & 4 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[mypy]

files = cyclonedx/
files = cyclonedx/, examples/
mypy_path = $MYPY_CONFIG_FILE_DIR/typings

show_error_codes = True
Expand All @@ -26,9 +26,7 @@ no_implicit_optional = True
warn_redundant_casts = True
warn_return_any = True
no_implicit_reexport = True

# needed to silence some py37|py38 differences
warn_unused_ignores = False
warn_unused_ignores = True

[mypy-pytest.*]
ignore_missing_imports = True
Expand Down
4 changes: 1 addition & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -42,4 +40,4 @@ python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
- requirements: docs/requirements.txt
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project uses [poetry]. Have it installed and setup first.
To install dev-dependencies and tools:

```shell
poetry install
poetry install --all-extras
```

## Code style
Expand All @@ -23,9 +23,13 @@ Get it all applied via:

```shell
poetry run isort .
poetry run flake8 cyclonedx/ tests/ typings/
poetry run autopep8 -ir cyclonedx/ tests/ typings/ examples/
```

This project prefers `f'strings'` over `'string'.format()`.
This project prefers `'single quotes'` over `"double quotes"`.
This project prefers `lower_snake_case` variable names.

## Documentation

This project uses [Sphinx] to generate documentation which is automatically published to [readthedocs.io].
Expand All @@ -45,7 +49,7 @@ make html
Run all tests in dedicated environments, via:

```shell
poetry run tox
poetry run tox run
```

## Sign off your commits
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Python Library for generating CycloneDX
# CycloneDX Python Library

[![shield_pypi-version]][link_pypi]
[![shield_conda-forge-version]][link_conda-forge]
Expand Down
9 changes: 9 additions & 0 deletions bandit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://bandit.readthedocs.io
# filename must be like this, so codacy can pick it up: https://github.com/codacy/codacy-bandit/blob/master/src/main/scala/codacy/bandit/Bandit.scala#L35C49-L35C59

exclude_dirs:
- docs
- .venv

skips:
- B101
7 changes: 4 additions & 3 deletions cyclonedx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -13,11 +11,14 @@
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.


"""
Python library for generating and representing CycloneDX software bill-of-materials.
"""

# !! version is managed by semantic_release
# do not use typing here, or else `semantic_release` might have issues finding the variable
__version__ = "4.2.3"
# flake8: noqa
__version__ = "5.0.0-rc.2"
12 changes: 8 additions & 4 deletions cyclonedx/exception/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -13,15 +11,21 @@
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) OWASP Foundation. All Rights Reserved.


"""
Exceptions that are specific to the CycloneDX library implementation.
"""


class CycloneDxException(Exception):
class CycloneDxException(Exception): # noqa: N818
"""
Root exception thrown by this library.
"""
pass


class MissingOptionalDependencyException(CycloneDxException): # noqa: N818
"""Validation did not happen, due to missing dependencies."""
pass
5 changes: 2 additions & 3 deletions cyclonedx/exception/factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -13,7 +11,8 @@
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) OWASP Foundation. All Rights Reserved.


"""
Exceptions relating to specific conditions that occur when factoring a model.
Expand Down
Loading