Skip to content

Commit 0ed2830

Browse files
committed
Switch PROJECT_CONFIG.root with PROJECT_CONFIG.root_path
1 parent 23103c3 commit 0ed2830

File tree

14 files changed

+38
-35
lines changed

14 files changed

+38
-35
lines changed

doc/user_guide/migrating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ For example, if test execution isn't performed in the standard way (e.g., :code:
7474
# within the function to keep them isolated and simplify future removal or replacement.
7575
from exasol.toolbox.nox._shared import get_filtered_python_files
7676
77-
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
77+
py_files = get_filtered_python_files(PROJECT_CONFIG.root_path)
7878
print("The original 'format:fix' task has been taken hostage by this overwrite")
7979
print("Files:\n{files}".format(files="\n".join(py_files))
8080

exasol/toolbox/nox/_artifacts.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@
4545
@nox.session(name="artifacts:validate", python=False)
4646
def check_artifacts(session: Session) -> None:
4747
"""Validate that all project artifacts are available and consistent"""
48-
all_files = {f.name for f in PROJECT_CONFIG.root.iterdir() if f.is_file()}
48+
all_files = {f.name for f in PROJECT_CONFIG.root_path.iterdir() if f.is_file()}
4949
if missing_files := (ALL_LINT_FILES - all_files):
5050
print(f"files not available: {missing_files}", file=sys.stderr)
5151
sys.exit(1)
5252

5353
all_is_valid_checks = [
54-
_is_valid_lint_txt(Path(PROJECT_CONFIG.root, LINT_TXT)),
55-
_is_valid_lint_json(Path(PROJECT_CONFIG.root, LINT_JSON)),
56-
_is_valid_security_json(Path(PROJECT_CONFIG.root, SECURITY_JSON)),
57-
_is_valid_coverage(Path(PROJECT_CONFIG.root, COVERAGE_DB)),
54+
_is_valid_lint_txt(Path(PROJECT_CONFIG.root_path, LINT_TXT)),
55+
_is_valid_lint_json(Path(PROJECT_CONFIG.root_path, LINT_JSON)),
56+
_is_valid_security_json(Path(PROJECT_CONFIG.root_path, SECURITY_JSON)),
57+
_is_valid_coverage(Path(PROJECT_CONFIG.root_path, COVERAGE_DB)),
5858
]
5959
if not all(all_is_valid_checks):
6060
sys.exit(1)

exasol/toolbox/nox/_documentation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _git_diff_changes_main() -> int:
5151
"--quiet",
5252
"origin/main",
5353
"--",
54-
PROJECT_CONFIG.root / "doc/changes",
54+
PROJECT_CONFIG.documentation_path / "changes",
5555
],
5656
capture_output=True,
5757
)
@@ -73,7 +73,7 @@ def build_docs(session: Session) -> None:
7373
@nox.session(name="docs:open", python=False)
7474
def open_docs(session: Session) -> None:
7575
"""Opens the built project documentation"""
76-
docs_folder = PROJECT_CONFIG.root / DOCS_OUTPUT_DIR
76+
docs_folder = PROJECT_CONFIG.root_path / DOCS_OUTPUT_DIR
7777
if not docs_folder.exists():
7878
session.error(f"No documentation could be found. {docs_folder} is missing")
7979
index = docs_folder / "index.html"
@@ -83,7 +83,7 @@ def open_docs(session: Session) -> None:
8383
@nox.session(name="docs:clean", python=False)
8484
def clean_docs(_session: Session) -> None:
8585
"""Removes the documentations build folder"""
86-
docs_folder = PROJECT_CONFIG.root / DOCS_OUTPUT_DIR
86+
docs_folder = PROJECT_CONFIG.root_path / DOCS_OUTPUT_DIR
8787
if docs_folder.exists():
8888
shutil.rmtree(docs_folder)
8989

@@ -146,7 +146,7 @@ def _docs_links_check(doc_config: Path, args):
146146
@nox.session(name="links:list", python=False)
147147
def docs_list_links(session: Session) -> None:
148148
"""List all the links within the documentation."""
149-
r_code, text = _docs_list_links(PROJECT_CONFIG.doc)
149+
r_code, text = _docs_list_links(PROJECT_CONFIG.documentation_path)
150150
print(text)
151151
if r_code != 0:
152152
session.error()
@@ -164,7 +164,7 @@ def docs_links_check(session: Session) -> None:
164164
"-o", "--output", type=Path, help="path to copy the output json", default=None
165165
)
166166
args = parser.parse_args(session.posargs)
167-
r_code, problems = _docs_links_check(PROJECT_CONFIG.doc, args)
167+
r_code, problems = _docs_links_check(PROJECT_CONFIG.documentation_path, args)
168168
if r_code >= 2:
169169
session.error(2)
170170
if r_code == 1 or problems != "":

exasol/toolbox/nox/_format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def command(*args: str) -> Iterable[str]:
4545
@nox.session(name="format:fix", python=False)
4646
def fix_format(session: Session) -> None:
4747
"""Runs all automated format fixes on the code base"""
48-
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
48+
py_files = get_filtered_python_files(PROJECT_CONFIG.root_path)
4949
_version(session, Mode.Fix)
5050
_pyupgrade(session, config=PROJECT_CONFIG, files=py_files)
5151
_ruff(session, mode=Mode.Fix, files=py_files)
@@ -55,6 +55,6 @@ def fix_format(session: Session) -> None:
5555
@nox.session(name="format:check", python=False)
5656
def check_format(session: Session) -> None:
5757
"""Checks the project for correct formatting"""
58-
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
58+
py_files = get_filtered_python_files(PROJECT_CONFIG.root_path)
5959
_ruff(session, mode=Mode.Check, files=py_files)
6060
_code_format(session=session, mode=Mode.Check, files=py_files)

exasol/toolbox/nox/_lint.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717

1818
def _pylint(session: Session, files: Iterable[str]) -> None:
19-
json_file = PROJECT_CONFIG.root / ".lint.json"
20-
txt_file = PROJECT_CONFIG.root / ".lint.txt"
19+
json_file = PROJECT_CONFIG.root_path / ".lint.json"
20+
txt_file = PROJECT_CONFIG.root_path / ".lint.txt"
2121

2222
session.run(
2323
"pylint",
@@ -50,7 +50,7 @@ def _security_lint(session: Session, files: Iterable[str]) -> None:
5050
"--format",
5151
"json",
5252
"--output",
53-
PROJECT_CONFIG.root / ".security.json",
53+
PROJECT_CONFIG.root_path / ".security.json",
5454
"--exit-zero",
5555
*files,
5656
)
@@ -130,7 +130,7 @@ def lint(session: Session) -> None:
130130
@nox.session(name="lint:typing", python=False)
131131
def type_check(session: Session) -> None:
132132
"""Runs the type checker on the project"""
133-
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
133+
py_files = get_filtered_python_files(PROJECT_CONFIG.root_path)
134134
_type_check(session=session, files=py_files)
135135

136136

@@ -144,7 +144,7 @@ def security_lint(session: Session) -> None:
144144
@nox.session(name="lint:dependencies", python=False)
145145
def dependency_check(session: Session) -> None:
146146
"""Checks if only valid sources of dependencies are used"""
147-
content = Path(PROJECT_CONFIG.root, PoetryFiles.pyproject_toml).read_text()
147+
content = Path(PROJECT_CONFIG.root_path, PoetryFiles.pyproject_toml).read_text()
148148
dependencies = Dependencies.parse(content)
149149
console = rich.console.Console()
150150
if illegal := dependencies.illegal:

exasol/toolbox/nox/_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RequiredFile:
2323
"""
2424

2525
def __init__(self, file: Path | str, task: str):
26-
self.file = file if isinstance(file, Path) else PROJECT_CONFIG.root / file
26+
self.file = file if isinstance(file, Path) else PROJECT_CONFIG.root_path / file
2727
self.task = task
2828

2929
def __str__(self) -> str:

exasol/toolbox/nox/_package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ def package_check(session: Session) -> None:
1212
1313
This has more robust checks for rst documentation than markdown.
1414
"""
15-
session.run("poetry", "build", "--project", PROJECT_CONFIG.root)
16-
session.run("twine", "check", PROJECT_CONFIG.root / "./dist/*")
15+
session.run("poetry", "build", "--project", PROJECT_CONFIG.root_path)
16+
session.run("twine", "check", PROJECT_CONFIG.root_path / "./dist/*")

exasol/toolbox/nox/_release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def prepare_release(session: Session) -> None:
128128

129129
changelogs = Changelogs(
130130
changes_path=PROJECT_CONFIG.doc / "changes",
131-
root_path=PROJECT_CONFIG.root,
131+
root_path=PROJECT_CONFIG.root_path,
132132
version=new_version,
133133
)
134134
changelogs.update_changelogs_for_release()
@@ -143,7 +143,7 @@ def prepare_release(session: Session) -> None:
143143
return
144144

145145
changed_files += [
146-
PROJECT_CONFIG.root / PoetryFiles.pyproject_toml,
146+
PROJECT_CONFIG.root_path / PoetryFiles.pyproject_toml,
147147
PROJECT_CONFIG.version_file,
148148
]
149149
results = pm.hook.prepare_release_add_files(session=session, config=PROJECT_CONFIG)

exasol/toolbox/nox/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
def check(session: Session) -> None:
3535
"""Runs all available checks on the project"""
3636
context = _context(session, coverage=True)
37-
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
37+
py_files = get_filtered_python_files(PROJECT_CONFIG.root_path)
3838
_version(session, Mode.Check)
3939
_code_format(session, Mode.Check, py_files)
4040
_pylint(session, py_files)

exasol/toolbox/util/dependencies/shared_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def files(self) -> tuple[str, ...]:
6666
def poetry_files_from_latest_tag() -> Generator[Path]:
6767
"""Context manager to set up a temporary directory with poetry files from the latest tag"""
6868
latest_tag = Git.get_latest_tag()
69-
path = PROJECT_CONFIG.root.relative_to(Git.toplevel())
69+
path = PROJECT_CONFIG.root_path.relative_to(Git.toplevel())
7070
with tempfile.TemporaryDirectory() as tmpdir_str:
7171
tmp_dir = Path(tmpdir_str)
7272
for file in PoetryFiles().files:

0 commit comments

Comments
 (0)