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
6 changes: 3 additions & 3 deletions .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
steps:

- name: SCM Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/python-environment@v1
uses: exasol/python-toolbox/.github/actions/python-environment@v6
with:
python-version: "3.10"
poetry-version: "2.1.2"
poetry-version: "2.3.0"

- name: Build Artifacts
run: poetry build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
steps:

- name: SCM Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

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

- name: Run pytest
run: poetry run -- python3 -m pytest
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
default_stages: [ pre-commit, pre-push ]
repos:

- repo: local
hooks:
- id: code-format
name: code-format
types: [ python ]
pass_filenames: false
language: system
entry: poetry run -- nox -s format:fix
stages: [ pre-commit ]

- repo: local
hooks:
- id: type-check
name: type-check
types: [ python ]
pass_filenames: false
language: system
entry: poetry run -- nox -s lint:typing
stages: [ pre-push ]

- repo: local
hooks:
- id: lint
name: lint
types: [ python ]
pass_filenames: false
language: system
entry: poetry run -- nox -s lint:code
stages: [ pre-push ]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
stages: [ pre-commit ]
- id: end-of-file-fixer
stages: [ pre-commit ]
- id: trailing-whitespace
stages: [ pre-commit ]
89 changes: 0 additions & 89 deletions README.md

This file was deleted.

12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Add it to your ``tool.poetry.dependencies`` or ``tool.poetry.dev-dependencies``
How to use the Mock
^^^^^^^^^^^^^^^^^^^

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

Expand All @@ -73,7 +73,7 @@ The following example shows the general setup for a test with the Mock:
exa = MockExaEnvironment(meta)
result = executor.run([Group([(1,1.0,"1"), (5,5.0,"5"), (6,6.0,"6")])], exa)

**Checkout the `tests <tests>`_ for more information about, how to use the Mock.**
**Check out the `tests <tests>`_ for more information about, how to use the Mock.**

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

* Can use all python package available in the system running the Mock
* Can use all Python package available in the system running the Mock

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

* Does not emulate the ressource limitations which get a applied in the database
* Does not emulate the resource limitations which get a applied in the database

* Only one instance of the UDF gets executed
* No support for Python2, because Python2 is officially End of Life
4 changes: 4 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Unreleased

## Refactoring

* #78: Updated to PTB 6.1.0 and re-locked filelock, pip, urllib3, & virtualenv
46 changes: 35 additions & 11 deletions noxconfig.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
from collections.abc import Iterable
from dataclasses import dataclass
from pathlib import Path

from exasol.toolbox.config import BaseConfig

ROOT_DIR = Path(__file__).parent

from pydantic import computed_field


class Config(BaseConfig):
@computed_field # type: ignore[misc]
@property
def source_code_path(self) -> Path:
"""
Path to the source code of the project.

This needs to be overridden due to a custom directory setup. This will be
addressed in:
https://github.com/exasol/udf-mock-python/issues/80
"""
return self.root_path / 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``.

@dataclass(frozen=True)
class Config:
root: Path = ROOT_DIR
doc: Path = ROOT_DIR / "doc"
version_file: Path = ROOT_DIR / "version.py"
path_filters: Iterable[str] = ("dist", ".eggs", "venv", ".workspace")
python_versions = ["3.10", "3.11", "3.12", "3.13"]
source: Path = Path("exasol_udf_mock_python")
This needs to be overridden due to a custom directory setup & custom
`version.py` location. This will be addressed in:
https://github.com/exasol/udf-mock-python/issues/79
"""
return self.root_path / "version.py"


PROJECT_CONFIG = Config()
PROJECT_CONFIG = Config(
project_name="exasol-udf-mock-python",
root_path=ROOT_DIR,
python_versions=("3.10", "3.11", "3.12", "3.13"),
)
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from exasol.toolbox.nox.tasks import *

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