Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build-cross-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
host:
- x86_64
- aarch64
Expand Down Expand Up @@ -116,6 +117,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- x86_64

Expand Down Expand Up @@ -178,6 +180,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- amd64
- x86
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-native-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
host:
- x86_64
- aarch64
Expand Down Expand Up @@ -131,6 +132,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- x86_64
outputs:
Expand Down Expand Up @@ -201,6 +203,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- arm64
outputs:
Expand Down Expand Up @@ -269,6 +272,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- amd64
- x86
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
- platform: linux-gnu
arch: x86_64
python: '3.13'
- platform: linux-gnu
arch: x86_64
python: '3.14'
- platform: linux-gnu
arch: aarch64
python: '3.10'
Expand All @@ -99,6 +102,9 @@ jobs:
- platform: linux-gnu
arch: aarch64
python: '3.13'
- platform: linux-gnu
arch: aarch64
python: '3.14'

- platform: win
arch: x86
Expand All @@ -112,6 +118,9 @@ jobs:
- platform: win
arch: x86
python: '3.13'
- platform: win
arch: x86
python: '3.14'
- platform: win
arch: amd64
python: '3.10'
Expand All @@ -124,6 +133,9 @@ jobs:
- platform: win
arch: amd64
python: '3.13'
- platform: win
arch: amd64
python: '3.14'

- platform: macos
arch: x86_64
Expand All @@ -137,6 +149,9 @@ jobs:
- platform: macos
arch: x86_64
python: '3.13'
- platform: macos
arch: x86_64
python: '3.14'
- platform: macos
arch: arm64
python: '3.10'
Expand All @@ -149,6 +164,9 @@ jobs:
- platform: macos
arch: arm64
python: '3.13'
- platform: macos
arch: arm64
python: '3.14'
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-fips-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- x86_64
outputs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/verify-build-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
host:
- x86_64
- aarch64
Expand Down Expand Up @@ -94,6 +95,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- x86_64

Expand Down Expand Up @@ -154,6 +156,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- arm64

Expand Down Expand Up @@ -219,6 +222,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
arch:
- amd64
- x86
Expand Down
21 changes: 5 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,12 @@ repos:
exclude: setup\.py
entry: python3 .pre-commit-hooks/copyright_headers.py
language: system
- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
exclude: ^(\.pre-commit-hooks/.*\.py)$
additional_dependencies:
- flake8-mypy-fork
- flake8-docstrings
- flake8-typing-imports
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
Expand Down
56 changes: 22 additions & 34 deletions .pre-commit-hooks/check_changelog_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


def check_changelog_entries(files):

exitcode = 0
for entry in files:
path = pathlib.Path(entry).resolve()
Expand All @@ -40,13 +39,10 @@ def check_changelog_entries(files):
# Does it end in .rst
if path.suffix != ".rst":
exitcode = 1
print(
"The changelog entry '{}' should have '.rst' as it's file extension".format(
path.relative_to(CODE_ROOT),
),
file=sys.stderr,
flush=True,
msg = (
f"The changelog entry '{path.relative_to(CODE_ROOT)}' should have '.rst' as it's file extension"
)
print(msg, file=sys.stderr, flush=True)
continue
print(
"The changelog entry '{}' should have one of the following extensions: {}.".format(
Expand All @@ -65,19 +61,14 @@ def check_changelog_entries(files):
if CHANGELOG_ENTRY_RE.match(path.name):
# So, this IS a changelog entry, but it's misplaced....
exitcode = 1
print(
"The changelog entry '{}' should be placed under '{}/', not '{}'".format(
path.relative_to(CODE_ROOT),
CHANGELOG_ENTRIES_PATH.relative_to(CODE_ROOT),
path.relative_to(CODE_ROOT).parent,
),
file=sys.stderr,
flush=True,
msg = (
f"The changelog entry '{path.relative_to(CODE_ROOT)}' "
f"should be placed under '{CHANGELOG_ENTRIES_PATH.relative_to(CODE_ROOT)}/', "
f"not '{path.relative_to(CODE_ROOT).parent}'"
)
print(msg, file=sys.stderr, flush=True)
continue
elif CHANGELOG_LIKE_RE.match(path.name) and not CHANGELOG_ENTRY_RE.match(
path.name
):
elif CHANGELOG_LIKE_RE.match(path.name) and not CHANGELOG_ENTRY_RE.match(path.name):
# Does it look like a changelog entry
print(
"The changelog entry '{}' should have one of the following extensions: {}.".format(
Expand All @@ -90,18 +81,14 @@ def check_changelog_entries(files):
exitcode = 1
continue

elif not CHANGELOG_LIKE_RE.match(
path.name
) and not CHANGELOG_ENTRY_RE.match(path.name):
elif not CHANGELOG_LIKE_RE.match(path.name) and not CHANGELOG_ENTRY_RE.match(path.name):
# Does not look like, and it's not a changelog entry
continue
# Does it end in .rst
if path.suffix != ".rst":
exitcode = 1
print(
"The changelog entry '{}' should have '.rst' as it's file extension".format(
path.relative_to(CODE_ROOT),
),
f"The changelog entry '{path.relative_to(CODE_ROOT)}' should have '.rst' as it's file extension",
file=sys.stderr,
flush=True,
)
Expand All @@ -111,21 +98,22 @@ def check_changelog_entries(files):
def check_changelog_entry_contents(entry):
contents = entry.read_text().splitlines()
if len(contents) > 1:
# More than one line.
# If the second line starts with '*' it's a bullet list and we need to add an
# empty line before it.
if contents[1].strip().startswith("*"):
contents.insert(1, "")
entry.write_text("{}\n".format("\n".join(contents)))
if contents[1].strip() and contents[1].strip()[0] not in ("-", "=", "~", "^", "*", "+", "#", "<", ">"):
# This is not a heading
print(
f"The changelog entry '{entry.relative_to(CODE_ROOT)}' should have a heading.",
file=sys.stderr,
flush=True,
)
sys.exit(1)


def main(argv):
parser = argparse.ArgumentParser(prog=__name__)
parser.add_argument("files", nargs="+")

options = parser.parse_args(argv)
return check_changelog_entries(options.files)
args = parser.parse_args(argv)
return check_changelog_entries(args.files)


if __name__ == "__main__":
sys.exit(main(sys.argv))
sys.exit(main(sys.argv[1:]))
4 changes: 1 addition & 3 deletions .pre-commit-hooks/copyright_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
CODE_ROOT = pathlib.Path(__file__).resolve().parent.parent
SPDX_HEADER = "# SPDX-License-Identifier: Apache-2.0"
COPYRIGHT_HEADER = "# Copyright {year} Broadcom."
COPYRIGHT_REGEX = re.compile(
r"# Copyright (?:(?P<start_year>[0-9]{4})(?:-(?P<cur_year>[0-9]{4}))?) Broadcom\."
)
COPYRIGHT_REGEX = re.compile(r"# Copyright (?:(?P<start_year>[0-9]{4})(?:-(?P<cur_year>[0-9]{4}))?) Broadcom\.")
SPDX_REGEX = re.compile(r"# SPDX-License-Identifier:.*")


Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Nox session definitions.
"""

import datetime
import os
import pathlib
Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,44 @@ ensure_newline_before_comments=true
[tool.pylint]
max-line-length=120

[tool.ruff]
line-length = 120
target-version = "py310"

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"D", # pydocstyle
"I", # isort
"UP", # pyupgrade
"TCH", # flake8-type-checking
]
ignore = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in __init__
"D200", # One-line docstring should fit on one line with quotes
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"D401", # First line should be in imperative mood
"D415", # First line should end with a period, question mark, or exclamation point
"F403", # 'from <name> import *' used
"F405", # '*' may be undefined, or defined from star imports
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"noxfile.py" = ["E501"]

[tool.ruff.lint.pydocstyle]
convention = "pep257"

[tool.mypy]
python_version = "3.10"
explicit_package_bases = true
Expand Down
Loading
Loading