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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: astral-sh/setup-uv@v5
with:
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/commit_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
workflow_dispatch:
pull_request:
paths-ignore:
- "**.md"
- '**.md'
push:
branches: [main]

Expand All @@ -33,23 +33,24 @@ jobs:
- uses: actions/checkout@v4
- uses: webiny/action-conventional-commits@v1.3.0

mypy:
ty:
needs: commitlint
name: MyPy Python linter
name: Ty Python linter
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install mypy
run: pip install mypy
- name: Run mypy
uses: sasanquaneuf/mypy-github-action@releases/v1.3
python-version: '3.10'

- uses: astral-sh/setup-uv@v5
with:
checkName: "mypy" # NOTE: this needs to be the same as the job name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true

- name: Run ty
shell: bash
run: |
uv run ty check --output-format github

ruff:
needs: commitlint
Expand All @@ -60,8 +61,8 @@ jobs:
- name: Ruff Check
uses: astral-sh/ruff-action@v3
with:
args: "check --config pyproject.toml"
args: 'check --config pyproject.toml'
- name: Ruff Format
uses: astral-sh/ruff-action@v3
with:
args: "format --check --config pyproject.toml"
args: 'format --check --config pyproject.toml'
66 changes: 32 additions & 34 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: examples
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-symlinks
- id: mixed-line-ending
args:
- '--fix=lf'

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
- pydantic
- types-PyYaml==6.0
- types-toml
- types-requests
args: [--config, pyproject.toml]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.14.3'
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.9.1"
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/compilerla/conventional-pre-commit
rev: 'v4.3.0'
hooks:
- id: conventional-pre-commit
stages: [commit-msg]

- repo: https://github.com/compilerla/conventional-pre-commit
rev: "v4.0.0"
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.9.7
hooks:
- id: uv-lock

- repo: https://github.com/astral-sh/uv-pre-commit
rev: "0.5.18"
hooks:
- id: uv-lock
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
exclude: 'examples'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For example:
- Simplifies common ORT scan review tasks such as clearing found licenses.
- Offers easy to remember CLI commands (but should you forget, run `orthw` with no arguments to see a complete list).
- Includes commands to format, sort, clean up and generate ORT config files such as [.ort.yml][ort-yml] and [package configuration][ort-package-configurations].
- Is pre-configured to work with the [ort-config] repository allowing you to re-use the work of other ORT users.
- Is pre-configured to work with the [ort-config] repository allowing you to reuse the work of other ORT users.

## Installation

Expand Down
111 changes: 29 additions & 82 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
requires = ["uv_build>=0.8.12,<0.9.21"]
build-backend = "uv_build"

[project]
name = "orthw"
version = "0.2.0"
version = "0.3.0"
description = "orthw is a python app designed to simplify and speed up common tasks performed when processing ort scan results. It supports a number of commands, which can be run in the terminal."
authors = [
{ name = "The ORTHW Project Authors" } ]
Expand All @@ -30,40 +30,38 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.8"
requires-python = ">=3.13"
dependencies = [
"appdirs>=1.4.4",
"click>=8.1.8",
"dict2obj>=1.2.0",
"docker>=7.1.0",
"gitpython>=3.1.44",
"gitpython>=3.1.46",
"importlib-metadata>=8.5.0",
"jinja2>=3.1.5",
"jinja2>=3.1.6",
"platformdirs>=4.5.1",
"psycopg2-binary>=2.9.10",
"pydantic>=2.10.5",
"pydantic-settings>=2.7.1",
"pydantic>=2.10.6",
"pydantic-settings>=2.8.1",
"pydantic-yaml>=1.6.0",
"python-dotenv>=1.0.1",
"pyyaml>=6.0.2",
"requests>=2.32.3",
"rich>=13.9.4",
"pyyaml>=6.0.3",
"requests>=2.32.4",
"rich>=14.2.0",
"toml>=0.10.2",
"yaml-settings-pydantic>=2.2.0",
"tomli-w>=1.2.0",
]

[dependency-groups]
dev = [
"mkdocs-material>=9.5.49",
"mypy>=1.14.1",
"mkdocs-material>=9.7.1",
"pre-commit>=3.5.0",
"pycodestyle>=2.12.1",
"pytest-cov>=5.0.0",
"pytest-mypy>=0.10.3",
"ruff>=0.9.1",
"ruff>=0.14.10",
"ty>=0.0.9",
"types-pyyaml>=6.0.12.20241230",
"types-requests>=2.32.0.20241016",
"types-toml>=0.10.8.20240310",
Expand All @@ -78,48 +76,6 @@ log_cli = true
log_cli_level = "INFO"
pythonpath = "src"

[tool.pylint.messages_control]
disable = [
"abstract-method",
"arguments-differ",
"attribute-defined-outside-init",
"blacklisted-name",
"chained-comparison",
"duplicate-code",
"eval-used",
"exec-used",
"expression-not-assigned",
"fixme",
"global-statement",
"invalid-name",
"import-error",
"logging-fstring-interpolation",
"missing-docstring",
"no-member",
"no-name-in-module",
"protected-access",
"redefined-argument-from-local",
"redefined-outer-name",
"reimported",
"stop-iteration-return",
"too-few-public-methods",
"too-many-ancestors",
"too-many-arguments",
"too-many-branches",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-return-statements",
"too-many-statements",
"unexpected-special-method-signature",
"unspecified-encoding",
]

[tool.mypy]
plugins = [
"pydantic.mypy",
]

check_untyped_defs = true
disallow_any_generics = true
disallow_untyped_defs = true
Expand All @@ -131,12 +87,6 @@ strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true

[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true


[tool.ruff]
fix = true
line-length = 120
Expand Down Expand Up @@ -164,16 +114,15 @@ extend-exclude = [
"venv",
]

# Assume Python 3.10.
target-version = "py310"
# Assume Python 3.13.
target-version = "py313"

[tool.ruff.lint]
extend-select = [
"E", # pycodestyle error
"W", # pycodestyle warning
"F", # pyflakes
"A", # flakes8-builtins
"COM", # flakes8-commas
"C4", # flake8-comprehensions
"Q", # flake8-quotes
"SIM", # flake8-simplify
Expand All @@ -182,24 +131,22 @@ extend-select = [
"N", # pep8 naming
"UP", # pyupgrade
"S", # bandit
"D", # pydocstyle
]
ignore = [
'N802', # function name should be lowercase
'SIM105', # Suggest contextlib instead of try/except with pass
'A004', # Python shadow builtins
'COM812',
'A005', # Python shadow
'D100', # pydocstring public module
'D104', # pydocstring public package
'D107', # pydocstring init
'D203', # incorrect-blank-line-before-class
'D213', # multi-line-summary-second-line
]
# Unlike Flake8, default to a complexity level of 10.
mccabe.max-complexity = 10
per-file-ignores = {}
flake8-tidy-imports.ban-relative-imports = "all"
isort.required-imports = ["from __future__ import annotations"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
flake8-tidy-imports.ban-relative-imports = "all"

[tool.ruff.format]
quote-style = "double"
indent-style = "space"

[tool.pyright]
reportUnboundVariable = false
5 changes: 2 additions & 3 deletions src/orthw/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE
from __future__ import annotations

from orthw.utils.settings import Settings
from orthw.utils.settings import Settings, load_settings

"""Make config object global
"""
settings: Settings = Settings()
settings: Settings = load_settings()
1 change: 0 additions & 1 deletion src/orthw/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

from __future__ import annotations

import sys

Expand Down
20 changes: 4 additions & 16 deletions src/orthw/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,15 @@
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

from __future__ import annotations

from typing import TYPE_CHECKING

import importlib_metadata as metadata

if TYPE_CHECKING:
from collections.abc import Callable


# The metadata.version that we import for Python 3.7 is untyped, work around
# that.
version: Callable[[str], str] = metadata.version
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("orthw")
except metadata.PackageNotFoundError:
__version__ = version("optima")
except PackageNotFoundError:
# We are running from a git checkout, so we don't have metada
from pathlib import Path

import toml

pyproject = toml.loads((Path(__file__).parent.parent.parent / "pyproject.toml").read_text())
__version__ = pyproject["tool"]["poetry"]["version"]
__version__ = pyproject["project"]["version"]
Loading