|
1 | 1 | # Unreleased |
2 | 2 |
|
| 3 | +## Summary |
| 4 | + |
3 | 5 | This major release removes `project:fix` and `project:format` |
4 | 6 | and replaces them with `format:fix` and `format:check`. |
5 | 7 |
|
| 8 | +The `BaseConfig` has been extended to handle the commonly provided paths: |
| 9 | +* `root` is now `root_path` |
| 10 | +* `source` is now covered by `project_name` and `source_code_path`, which uses `root_path` and `project_name` |
| 11 | +* `doc` is now `documentation_path` |
| 12 | +* `version_file` is now `version_filepath` |
| 13 | + |
| 14 | +If your project was previously defining these values, your **before** would look like: |
| 15 | + |
| 16 | +```python |
| 17 | +from __future__ import annotations |
| 18 | + |
| 19 | +from pathlib import Path |
| 20 | +from typing import Iterable |
| 21 | + |
| 22 | +from exasol.toolbox.config import BaseConfig |
| 23 | + |
| 24 | + |
| 25 | +class Config(BaseConfig): |
| 26 | + root: Path = Path(__file__).parent |
| 27 | + doc: Path = Path(__file__).parent / "doc" |
| 28 | + source: Path = Path("exasol/{{cookiecutter.package_name}}") |
| 29 | + version_file: Path = ( |
| 30 | + Path(__file__).parent |
| 31 | + / "exasol" |
| 32 | + / "{{cookiecutter.package_name}}" |
| 33 | + / "version.py" |
| 34 | + ) |
| 35 | + plugins: Iterable[object] = () |
| 36 | + |
| 37 | +PROJECT_CONFIG = Config() |
| 38 | +``` |
| 39 | + |
| 40 | +With this major release, you **should modify** your project's `noxconfig.py` to look like: |
| 41 | +```python |
| 42 | +from __future__ import annotations |
| 43 | + |
| 44 | +from pathlib import Path |
| 45 | +from typing import Iterable |
| 46 | + |
| 47 | +from exasol.toolbox.config import BaseConfig |
| 48 | + |
| 49 | + |
| 50 | +class Config(BaseConfig): |
| 51 | + plugins: Iterable[object] = () |
| 52 | + |
| 53 | +""" |
| 54 | +These values do NOT need to be defined if your project follows the convention |
| 55 | +expected from the PTB: |
| 56 | +- documentation_path |
| 57 | +- source_code_path |
| 58 | +- version_filepath |
| 59 | +
|
| 60 | +If your values differ, you can override these properties with the needed values when |
| 61 | +you define `class Config(BaseConfig)`. We highly recommend that you create an issue |
| 62 | +to remove this override in the future by aligning your project's structure with |
| 63 | +that expected by the PTB. |
| 64 | +
|
| 65 | +If you have additional Paths that used one of these values (i.e. `root_path`), then |
| 66 | +you can define your own property in `class Config(BaseConfig)`, which accesses the |
| 67 | +class values |
| 68 | +""" |
| 69 | + |
| 70 | +PROJECT_CONFIG = Config( |
| 71 | + project_name="{{cookiecutter.package_name}}", |
| 72 | + root_path=Path(__file__).parent, |
| 73 | +) |
| 74 | +``` |
| 75 | + |
6 | 76 | ## Refactoring |
7 | 77 |
|
8 | 78 | * #606: Renamed nox session `project:fix` more aptly to `format:fix` and `project:format` to `format:check` |
|
0 commit comments