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
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Core Data and Locks
poetry.lock linguist-generated=true
exasol/toolbox/version.py linguist-generated=true
doc/changes/changelog.md linguist-generated=true
.github/actions/python-environment/ext/get_poetry.py linguist-generated=true

Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@ on:
workflow_call:

jobs:
check-version:
name: Check Version
runs-on: "ubuntu-24.04"
permissions:
contents: read
steps:
- name: Check out Repository
id: check-out-repository
uses: actions/checkout@v6

- name: Set up Python & Poetry Environment
id: set-up-python-and-poetry-environment
uses: exasol/python-toolbox/.github/actions/python-environment@v6
with:
python-version: "3.10"
poetry-version: "2.3.0"

- name: Check Version
id: check-version
run: poetry run -- nox -s version:check

build-documentation-and-check-links:
name: Docs
runs-on: "ubuntu-24.04"
Expand Down
13 changes: 13 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@

## Summary

In this major release, support for the `version.py`file has been removed. Users should:
- delete the `version.py` file
- add in their project's `__init__.py` module

```python
from importlib.metadata import version
__version__ = version("<package_name>")
```
This is required for the nox session `docs:multiversion` to successfully complete,
and it is a Python standard for users to check in the terminal which version they are
using.

Comment thread
ArBridgeman marked this conversation as resolved.
## Refactoring

* #800: Removed tbx security pretty-print, tbx lint pretty-print, and creation of .lint.txt, as superseded by Sonar and .lint.json usage
* #791: Resolved Sonar concerns: accepted specific `subprocess` import usage & improved minor maintainability items
* #629: Replace `version.py` with version from the `__init__.py`
6 changes: 3 additions & 3 deletions doc/user_guide/features/creating_a_release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Preparing a Release

nox -s release:prepare -- --type {major,minor,patch}

The ``release:prepare`` nox session affects the ``pyproject.toml``,
``version.py``, and files in the ``doc/changes`` directory:
The ``release:prepare`` nox session affects the ``pyproject.toml`` and files in the
``doc/changes`` directory:

* Creates & switches to a release branch (can be skipped with ``--no-branch``)
* Updates the version in the ``pyproject.toml`` and ``version.py``
* Updates the version in the ``pyproject.toml``
* Moves the content of unreleased changes file ``unreleased.md`` to a
versioned changes file ``changes_<version>.md``
* Describes additional changes in the versioned changes file by comparing
Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/features/metrics/sonar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ In the Code
projectKey = "<sonar-project-key>"
host.url = "https://sonarcloud.io"
organization = "exasol"
exclusions = "<source_code_directory>/version.py,<source_code_directory>/<directory-to-ignore>/*"
exclusions = "<source_code_directory>/<directory-to-ignore>/*"

.. note::
For more information, see the :ref:`General remarks <configuration_general_remarks>` section.
Expand Down
3 changes: 3 additions & 0 deletions exasol/toolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
from importlib.metadata import version

import structlog
from structlog.dev import ConsoleRenderer
Expand All @@ -9,6 +10,8 @@
format_exc_info,
)

__version__ = version("exasol-toolbox")

log_level = os.getenv("LOG_LEVEL", "INFO").upper()

structlog.configure(
Expand Down
11 changes: 0 additions & 11 deletions exasol/toolbox/cli.py

This file was deleted.

10 changes: 0 additions & 10 deletions exasol/toolbox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,6 @@ def source_code_path(self) -> Path:
"""
return self.root_path / "exasol" / self.project_name

@computed_field # type: ignore[misc]
@property
def version_filepath(self) -> Path:
"""
Path to the ``version.py`` file included in the project. This is an
autogenerated file which contains the version of the code. It is maintained by
the nox sessions ``version:check`` and ``release:prepare``.
"""
return self.source_code_path / "version.py"

@computed_field # type: ignore[misc]
@property
def github_workflow_directory(self) -> Path:
Expand Down
2 changes: 0 additions & 2 deletions exasol/toolbox/nox/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from exasol.toolbox.config import BaseConfig
from exasol.toolbox.nox._shared import (
Mode,
_version,
get_filtered_python_files,
)
from noxconfig import (
Expand Down Expand Up @@ -44,7 +43,6 @@ def command(*args: str) -> Iterable[str]:
def fix_format(session: Session) -> None:
"""Runs all automated format fixes on the code base"""
py_files = get_filtered_python_files(PROJECT_CONFIG.root_path)
_version(session, Mode.Fix)
Comment thread
ArBridgeman marked this conversation as resolved.
_pyupgrade(session, config=PROJECT_CONFIG, files=py_files)
_ruff(session, mode=Mode.Fix, files=py_files)
_code_format(session, Mode.Fix, py_files)
Expand Down
103 changes: 0 additions & 103 deletions exasol/toolbox/nox/_package_version.py

This file was deleted.

13 changes: 0 additions & 13 deletions exasol/toolbox/nox/_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import nox
from nox import Session

from exasol.toolbox.nox._shared import (
Mode,
_version,
)
from exasol.toolbox.nox.plugin import NoxTasks
from exasol.toolbox.util.dependencies.shared_models import PoetryFiles
from exasol.toolbox.util.git import Git
Expand Down Expand Up @@ -58,12 +54,6 @@ def _create_parser() -> argparse.ArgumentParser:
return parser


def _update_project_version(session: Session, version: Version) -> Version:
session.run("poetry", "version", f"{version}")
_version(session, Mode.Fix)
return version


def _get_changelogs(version: Version) -> Changelog:
return Changelog(
changes_path=PROJECT_CONFIG.documentation_path / "changes",
Expand Down Expand Up @@ -130,8 +120,6 @@ def prepare_release(session: Session) -> None:
if not args.no_branch and not args.no_add:
Git.create_and_switch_to_branch(f"release/prepare-{new_version}")

_ = _update_project_version(session, new_version)

changed_files = (
_get_changelogs(version=new_version).prepare_release().get_changed_files()
)
Expand All @@ -146,7 +134,6 @@ def prepare_release(session: Session) -> None:

changed_files += [
PROJECT_CONFIG.root_path / PoetryFiles.pyproject_toml,
PROJECT_CONFIG.version_filepath,
]
results = pm.hook.prepare_release_add_files(session=session, config=PROJECT_CONFIG)
changed_files += [f for plugin_response in results for f in plugin_response]
Expand Down
6 changes: 0 additions & 6 deletions exasol/toolbox/nox/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ def exclude(path: Path):
return [f"{path}" for path in files if not exclude(path)]


def _version(session: Session, mode: Mode) -> None:
command = ["nox", "-s", "version:check", "--"]
command = command if mode == Mode.Check else command + ["--fix"]
session.run(*command)


def _context_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
Expand Down
4 changes: 0 additions & 4 deletions exasol/toolbox/nox/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def check(session: Session) -> None:
"""Runs all available checks on the project"""
context = _context(session, coverage=True)
py_files = get_filtered_python_files(PROJECT_CONFIG.root_path)
_version(session, Mode.Check)
_code_format(session, Mode.Check, py_files)
_pylint(session, py_files)
_type_check(session, py_files)
Expand Down Expand Up @@ -63,7 +62,6 @@ def check(session: Session) -> None:
from exasol.toolbox.nox._shared import (
Mode,
_context,
_version,
get_filtered_python_files,
)

Expand All @@ -86,8 +84,6 @@ def check(session: Session) -> None:
audit
)

from exasol.toolbox.nox._package_version import version_check

from exasol.toolbox.nox._package import package_check
from exasol.toolbox.nox._workflow import generate_workflow

Expand Down
6 changes: 3 additions & 3 deletions exasol/toolbox/sphinx/multiversion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Git based multi version support for sphinx.

This module/plugin provides support for creating a multi version output for the documented project.
Version's are defined using git tags and branches, the only supported output format is html.
Versions are defined using git tags and branches, the only supported output format is HTML.

NOTICE:
The original version of this package was published under the BSD license and can be found `here <https://github.com/Holzhaus/sphinx-multiversion>`_.
Expand All @@ -15,11 +15,11 @@
The original version and its defaults were minimally adjusted to work in Exasol's projects with the defaults and without adding an extra template. The [Shibuya](https://github.com/lepture/shibuya) theme is expected to be used for HTML, which already evaluates the versions field in the HTML context and generates an appropriate selector for the versions.
"""

from exasol.toolbox import __version__ as plugin_version
from exasol.toolbox.sphinx.multiversion.main import main
from exasol.toolbox.sphinx.multiversion.sphinx import setup
from exasol.toolbox.version import VERSION

__version__ = VERSION
__version__ = plugin_version

__all__ = [
"setup",
Expand Down
4 changes: 2 additions & 2 deletions exasol/toolbox/sphinx/multiversion/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from sphinx.locale import _
from sphinx.util import i18n as sphinx_i18n

from exasol.toolbox import __version__ as plugin_version
from exasol.toolbox.util.version import Version as ExasolVersion
from exasol.toolbox.version import VERSION as PLUGIN_VERSION

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -253,7 +253,7 @@ def setup(app):
app.connect("config-inited", config_inited)

return {
"version": PLUGIN_VERSION,
"version": plugin_version,
"parallel_read_safe": True,
"parallel_write_safe": True,
}
21 changes: 0 additions & 21 deletions exasol/toolbox/templates/github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@ on:
workflow_call:

jobs:
check-version:
name: Check Version
runs-on: "(( os_version ))"
permissions:
contents: read
steps:
- name: Check out Repository
id: check-out-repository
uses: actions/checkout@v6

- name: Set up Python & Poetry Environment
id: set-up-python-and-poetry-environment
uses: exasol/python-toolbox/.github/actions/python-environment@v6
with:
python-version: "(( minimum_python_version ))"
poetry-version: "(( dependency_manager_version ))"

- name: Check Version
id: check-version
run: poetry run -- nox -s version:check

build-documentation-and-check-links:
name: Docs
runs-on: "(( os_version ))"
Expand Down
Loading