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/actions/security-issues/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ runs:
- name: Install Python Toolbox / Security tool
shell: bash
run: |
pip install exasol-toolbox==2.0.0
pip install exasol-toolbox==3.0.0

- name: Create Security Issue Report
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions doc/changes/changelog.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions doc/changes/changes_3.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 3.0.0 - 2025-11-20

## Summary

This is a major release with potentially breaking changes as nox session `project:fix` has been modified and potentially can create many unexpected changes.

This release adds [ruff](https://docs.astral.sh/ruff/) to Nox sessions `project:format` and `project:fix` to check for and remove unused imports.

As `ruff` potentially can also apply many other changes, we recommend updating the `pyproject.toml` file in your project as specified here: [Formatting Code Configuration](https://exasol.github.io/python-toolbox/main/user_guide/features/formatting_code/index.html#configuration).

Additionally, `isort` has been updated from `^6.0.0` to `^7.0.0`. In 7.x, `isort` has provided fixes for Python 3.14.

## Documentation

* #589: Corrected configuration for Sonar documentation for host.url
* #535: Added more information about Sonar's usage of ``exclusions``
* #596: Corrected and added more information regarding ``pyupgrade``

## Features

* #595: Created class `ResolvedVulnerabilities` to track resolved vulnerabilities between versions
* #544: Modified nox sessions `project:fix` and `project:format` to use ruff to remove unused imports

## Refactoring

* #596: Added newline after header in versioned changelog

## Dependency Updates

### `main`
* Updated dependency `bandit:1.8.6` to `1.9.1`
* Updated dependency `black:25.9.0` to `25.11.0`
* Updated dependency `coverage:7.11.0` to `7.12.0`
* Updated dependency `import-linter:2.5.2` to `2.7`
* Updated dependency `isort:6.1.0` to `7.0.0`
* Updated dependency `nox:2025.10.16` to `2025.11.12`
* Updated dependency `pre-commit:4.3.0` to `4.4.0`
* Updated dependency `pydantic:2.12.3` to `2.12.4`
* Updated dependency `pylint:4.0.2` to `4.0.3`
* Updated dependency `pytest:8.4.2` to `9.0.1`
* Updated dependency `pyupgrade:3.21.0` to `3.21.2`
* Added dependency `ruff:0.14.5`
* Updated dependency `shibuya:2025.11.4` to `2025.11.10`
14 changes: 0 additions & 14 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
# Unreleased

## Documentation

* #589: Corrected configuration for Sonar documentation for host.url
* #535: Added more information about Sonar's usage of ``exclusions``
* #596: Corrected and added more information regarding ``pyupgrade``

## Features

* #595: Created class `ResolvedVulnerabilities` to track resolved vulnerabilities between versions

## Refactoring

* #596: Added newline after header in versioned changelog
17 changes: 17 additions & 0 deletions doc/user_guide/features/formatting_code/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ For autoformatting, the following tools are used:
packages, third party packages, and local application imports).
* `pyupgrade <https://pypi.org/project/pyupgrade/>`__ - upgrades syntax for newer
versions of the Python language.
* `ruff <https://docs.astral.sh/ruff/>`__ - includes a plethora of tools to check and
automatically format code. In the PTB, only the following checks are active:

* `unused-import (F401) <https://docs.astral.sh/ruff/rules/unused-import/>`__ - removes unused imports

In the PTB, these tools are bundled into nox sessions to ensure that they are run in a
deterministic manner.
Expand Down Expand Up @@ -81,3 +85,16 @@ and is defined in the :meth:`exasol.toolbox.config.BaseConfig.pyupgrade_argument

For further configuration options, see the
`pyupgrade documentation <https://pypi.org/project/pyupgrade/>`__.

ruff
^^^^

Ensure ``ruff`` is configured like so:

.. literalinclude:: ../../../../project-template/{{cookiecutter.repo_name}}/pyproject.toml
:language: toml
:start-at: [tool.ruff.lint]
:end-before: [tool.mypy.overrides]

For further configuration options, see
`ruff options <https://docs.astral.sh/ruff/configuration>`__.
4 changes: 4 additions & 0 deletions doc/user_guide/features/formatting_code/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ might want to ignore automatically applied formatting.
| | | |
| | <line-to-ignore> # isort:skip| # isort:skip_file |
+-----------------------+--------------------------------+-----------------------+
| formatting from ruff | .. code-block:: python | .. code-block:: python|
| (example with F401) | | |
| | <line-to-ignore> # noqa: F401| # ruff: noqa F401 |
+-----------------------+--------------------------------+-----------------------+


In the ``checks.yml``, ``project:format`` wants me to reformat code I did not modify
Expand Down
4 changes: 0 additions & 4 deletions exasol/toolbox/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
from tempfile import TemporaryDirectory
from typing import (
Any,
Dict,
List,
Optional,
Union,
)


Expand Down
1 change: 0 additions & 1 deletion exasol/toolbox/nox/_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
from collections.abc import Iterable
from pathlib import Path
from typing import Optional

import nox
from nox import Session
Expand Down
9 changes: 9 additions & 0 deletions exasol/toolbox/nox/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,26 @@ def _pyupgrade(session: Session, config: Config, files: Iterable[str]) -> None:
)


def _ruff(session: Session, mode: Mode, files: Iterable[str]):
def command(*args: str) -> Iterable[str]:
return args if mode == Mode.Check else list(args) + ["--fix"]

session.run(*command("ruff", "check"), *files)


@nox.session(name="project:fix", python=False)
def fix(session: Session) -> None:
"""Runs all automated fixes on the code base"""
py_files = python_files(PROJECT_CONFIG.root)
_version(session, Mode.Fix)
_pyupgrade(session, config=PROJECT_CONFIG, files=py_files)
_ruff(session, mode=Mode.Fix, files=py_files)
_code_format(session, Mode.Fix, py_files)


@nox.session(name="project:format", python=False)
def fmt_check(session: Session) -> None:
"""Checks the project for correct formatting"""
py_files = python_files(PROJECT_CONFIG.root)
_ruff(session, mode=Mode.Check, files=py_files)
_code_format(session=session, mode=Mode.Check, files=py_files)
1 change: 1 addition & 0 deletions exasol/toolbox/nox/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import nox
from nox import Session

# ruff: noqa F401
from exasol.toolbox.nox._format import (
_code_format,
fix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Build Artifacts
run: poetry build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Check Tag Version
# make sure the pushed/created tag matched the project version
Expand Down
18 changes: 9 additions & 9 deletions exasol/toolbox/templates/github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fetch-depth: 0

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Check Version(s)
run: poetry run -- nox -s version:check
Expand All @@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Build Documentation
run: |
Expand All @@ -59,7 +59,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Run changelog update check
run: poetry run -- nox -s changelog:updated
Expand All @@ -78,7 +78,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -131,7 +131,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -155,7 +155,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Run format check
run: poetry run -- nox -s project:format
Expand All @@ -171,7 +171,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Run Distribution Check
run: poetry run -- nox -s package:check
Expand All @@ -191,7 +191,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 0

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Build Documentation
run: |
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/github/workflows/matrix-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Generate matrix
run: poetry run -- nox -s matrix:all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Generate matrix
run: poetry run -- nox -s matrix:exasol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Generate matrix
run: poetry run -- nox -s matrix:python
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 0

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Download Artifacts
uses: actions/download-artifact@v6
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/github/workflows/slow-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v5

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v2
uses: exasol/python-toolbox/.github/actions/python-environment@v3
with:
python-version: ${{ matrix.python-version }}

Expand Down
3 changes: 0 additions & 3 deletions exasol/toolbox/tools/replace_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import (
Optional,
)

from exasol.toolbox.util.version import Version

Expand Down
1 change: 0 additions & 1 deletion exasol/toolbox/tools/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from pathlib import Path
from typing import (
Any,
Union,
)

import importlib_resources as resources
Expand Down
1 change: 0 additions & 1 deletion exasol/toolbox/util/dependencies/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from dataclasses import dataclass
from inspect import cleandoc
from json import loads
from typing import Optional

from pydantic import field_validator

Expand Down
1 change: 0 additions & 1 deletion exasol/toolbox/util/git.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import subprocess # nosec
from functools import wraps
from pathlib import Path
from typing import Union


def run_command(func):
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/version.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading