Skip to content

Commit 460ae3a

Browse files
authored
Refactoring/78 update to ptb 6.1.0 and bump vulnerable transitives (#81)
* Use uvx migrate-to-uv to update to be more PEP-compliant * Update to PTB 6.1.0 * Remove old README.md in favor of README.rst * Add pre-commit hook file * Modify config to work with PTB 6.1.0 * Update custom workflows to latest PTB action & checkout action * Relock vulnerable transitive dependencies
1 parent 927afb9 commit 460ae3a

File tree

10 files changed

+1224
-180
lines changed

10 files changed

+1224
-180
lines changed

.github/workflows/pypi_release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
steps:
1515

1616
- name: SCM Checkout
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818

1919
- name: Setup Python & Poetry Environment
20-
uses: exasol/python-toolbox/.github/actions/python-environment@v1
20+
uses: exasol/python-toolbox/.github/actions/python-environment@v6
2121
with:
2222
python-version: "3.10"
23-
poetry-version: "2.1.2"
23+
poetry-version: "2.3.0"
2424

2525
- name: Build Artifacts
2626
run: poetry build

.github/workflows/pytest.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
steps:
1414

1515
- name: SCM Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717

1818
- name: Setup Python & Poetry Environment
19-
uses: exasol/python-toolbox/.github/actions/python-environment@v1
19+
uses: exasol/python-toolbox/.github/actions/python-environment@v6
2020
with:
2121
python-version: ${{ matrix.python-version }}
22-
poetry-version: '2.1.2'
22+
poetry-version: '2.3.0'
2323

2424
- name: Run pytest
2525
run: poetry run -- python3 -m pytest

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
default_stages: [ pre-commit, pre-push ]
2+
repos:
3+
4+
- repo: local
5+
hooks:
6+
- id: code-format
7+
name: code-format
8+
types: [ python ]
9+
pass_filenames: false
10+
language: system
11+
entry: poetry run -- nox -s format:fix
12+
stages: [ pre-commit ]
13+
14+
- repo: local
15+
hooks:
16+
- id: type-check
17+
name: type-check
18+
types: [ python ]
19+
pass_filenames: false
20+
language: system
21+
entry: poetry run -- nox -s lint:typing
22+
stages: [ pre-push ]
23+
24+
- repo: local
25+
hooks:
26+
- id: lint
27+
name: lint
28+
types: [ python ]
29+
pass_filenames: false
30+
language: system
31+
entry: poetry run -- nox -s lint:code
32+
stages: [ pre-push ]
33+
34+
- repo: https://github.com/pre-commit/pre-commit-hooks
35+
rev: v5.0.0
36+
hooks:
37+
- id: check-yaml
38+
stages: [ pre-commit ]
39+
- id: end-of-file-fixer
40+
stages: [ pre-commit ]
41+
- id: trailing-whitespace
42+
stages: [ pre-commit ]

README.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Add it to your ``tool.poetry.dependencies`` or ``tool.poetry.dev-dependencies``
3636
How to use the Mock
3737
^^^^^^^^^^^^^^^^^^^
3838

39-
The mock runner runs your python UDF in a python environment in which
40-
no external variables, functions or classes are visble.
39+
The mock runner runs your Python UDF in a Python environment in which
40+
no external variables, functions or classes are visible.
4141
This means in practice, you can only use things you defined inside your
4242
UDF and what gets provided by the UDF frameworks,
4343
such as exa.meta and the context for the run function.
@@ -47,7 +47,7 @@ You define a UDF in this framework within in a wrapper function.
4747
This wrapper function then contains all necessary imports, functions,
4848
variables and classes.
4949
You then handover the wrapper function to the ``UDFMockExecutor``
50-
which runs the UDF inside if the isolated python environment.
50+
which runs the UDF inside if the isolated Python environment.
5151
The following example shows, how you use this framework:
5252
The following example shows the general setup for a test with the Mock:
5353

@@ -73,7 +73,7 @@ The following example shows the general setup for a test with the Mock:
7373
exa = MockExaEnvironment(meta)
7474
result = executor.run([Group([(1,1.0,"1"), (5,5.0,"5"), (6,6.0,"6")])], exa)
7575
76-
**Checkout the `tests <tests>`_ for more information about, how to use the Mock.**
76+
**Check out the `tests <tests>`_ for more information about, how to use the Mock.**
7777

7878
Limitations or missing features
7979
-------------------------------
@@ -94,12 +94,12 @@ feature and might get removed by later releases:
9494
* UDF inside of the database only can write /tmp to tmp and
9595
only see the file system of the script-language container and the mounted bucketfs
9696

97-
* Can use all python package available in the system running the Mock
97+
* Can use all Python package available in the system running the Mock
9898

9999
* If you use package which are currently not available in the script-language containers,
100100
you need create your own container for testing inside of the database
101101

102-
* Does not emulate the ressource limitations which get a applied in the database
102+
* Does not emulate the resource limitations which get a applied in the database
103103

104104
* Only one instance of the UDF gets executed
105105
* No support for Python2, because Python2 is officially End of Life

doc/changes/unreleased.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
# Unreleased
2+
3+
## Refactoring
4+
5+
* #78: Updated to PTB 6.1.0 and re-locked filelock, pip, urllib3, & virtualenv

noxconfig.py

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
1-
from collections.abc import Iterable
2-
from dataclasses import dataclass
31
from pathlib import Path
42

3+
from exasol.toolbox.config import BaseConfig
4+
55
ROOT_DIR = Path(__file__).parent
66

7+
from pydantic import computed_field
8+
9+
10+
class Config(BaseConfig):
11+
@computed_field # type: ignore[misc]
12+
@property
13+
def source_code_path(self) -> Path:
14+
"""
15+
Path to the source code of the project.
16+
17+
This needs to be overridden due to a custom directory setup. This will be
18+
addressed in:
19+
https://github.com/exasol/udf-mock-python/issues/80
20+
"""
21+
return self.root_path / self.project_name
22+
23+
@computed_field # type: ignore[misc]
24+
@property
25+
def version_filepath(self) -> Path:
26+
"""
27+
Path to the ``version.py`` file included in the project. This is an
28+
autogenerated file which contains the version of the code. It is maintained by
29+
the nox sessions ``version:check`` and ``release:prepare``.
730
8-
@dataclass(frozen=True)
9-
class Config:
10-
root: Path = ROOT_DIR
11-
doc: Path = ROOT_DIR / "doc"
12-
version_file: Path = ROOT_DIR / "version.py"
13-
path_filters: Iterable[str] = ("dist", ".eggs", "venv", ".workspace")
14-
python_versions = ["3.10", "3.11", "3.12", "3.13"]
15-
source: Path = Path("exasol_udf_mock_python")
31+
This needs to be overridden due to a custom directory setup & custom
32+
`version.py` location. This will be addressed in:
33+
https://github.com/exasol/udf-mock-python/issues/79
34+
"""
35+
return self.root_path / "version.py"
1636

1737

18-
PROJECT_CONFIG = Config()
38+
PROJECT_CONFIG = Config(
39+
project_name="exasol-udf-mock-python",
40+
root_path=ROOT_DIR,
41+
python_versions=("3.10", "3.11", "3.12", "3.13"),
42+
)

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from exasol.toolbox.nox.tasks import *
55

66
# default actions to be run if nothing is explicitly specified with the -s option
7-
nox.options.sessions = ["project:fix"]
7+
nox.options.sessions = ["format:fix"]

0 commit comments

Comments
 (0)