|
1 | | -from collections.abc import Iterable |
2 | | -from dataclasses import dataclass |
3 | 1 | from pathlib import Path |
4 | 2 |
|
| 3 | +from exasol.toolbox.config import BaseConfig |
| 4 | + |
5 | 5 | ROOT_DIR = Path(__file__).parent |
6 | 6 |
|
| 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 | + In transformers-extension, this needs to be overridden due to a custom directory |
| 18 | + setup. This will be 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``. |
7 | 30 |
|
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 | + In transformers-extension, this needs to be overridden due to a custom directory |
| 32 | + setup & custom `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" |
16 | 36 |
|
17 | 37 |
|
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 | +) |
0 commit comments