Skip to content

Commit 6c3e2aa

Browse files
authored
Refactoring/406 add poetry to formatting ignore list (#418)
* Fix poetry pyproject.toml to pass poetry check & resolve minor type issue instead of ignoring whole file * Fix unreleased.md to point to issue not PR * Add `.poetry` to ignore list for formmatting tasks & consolidate code & tests * Remove matrix.exasol from unit tests as matrix set only with matrix-python & unit tests shouldn't work with db * Update dependencies * Add working directory to python-environment action * Fix typos in getting_started.rst * Modify nox `docs:multiversion` to add `.nojekyll` file * Fix formatting on files * Resolve lint:typing and rst issues * Update test per review comments * Fix formatting on test file
1 parent 586d220 commit 6c3e2aa

File tree

14 files changed

+463
-443
lines changed

14 files changed

+463
-443
lines changed

.github/actions/python-environment/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ inputs:
1313
required: true
1414
default: "2.1.2"
1515

16+
working-directory:
17+
description: 'Working directory to use'
18+
required: true
19+
default: "."
20+
1621
runs:
1722

1823
using: "composite"
1924
steps:
2025

2126
- name: Setup Poetry (${{ inputs.poetry-version }})
22-
run: pipx install poetry==${{ inputs.poetry-version }}
2327
shell: bash
28+
run: pipx install poetry==${{ inputs.poetry-version }}
2429

2530
- name: Setup Python (${{ inputs.python-version}})
2631
uses: actions/setup-python@v5
@@ -29,5 +34,6 @@ runs:
2934
cache: 'poetry'
3035

3136
- name: Poetry install
32-
run: poetry install
37+
working-directory: ${{ inputs.working-directory }}
3338
shell: bash
39+
run: poetry install

.github/workflows/report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: ./.github/actions/python-environment
2121

2222
- name: Download Artifacts
23-
uses: actions/download-artifact@v4.2.1
23+
uses: actions/download-artifact@v4.3.0
2424
with:
2525
path: ./artifacts
2626

doc/changes/unreleased.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22

33
## ✨ Features
44

5-
* [#378](https://github.com/exasol/python-toolbox/pull/378/files): Add Nox task to trigger a release
5+
* [#362](https://github.com/exasol/python-toolbox/issues/362): Added Nox task to trigger a release
6+
* [#406](https://github.com/exasol/python-toolbox/issues/406): Added `.poetry` to ignore list for formatting
7+
* [#417](https://github.com/exasol/python-toolbox/issues/417): Added `working-directory` to `python-environment` action for a different `pyproject.toml` location
8+
9+
## Bugfixes
10+
11+
* [#401](https://github.com/exasol/python-toolbox/issues/401): Modified nox `docs:multiversion` to add `.nojekyll` file

doc/user_guide/getting_started.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Use the following command to create a new project:
3939
4040
**2. Follow the interactive project setup prompt**
4141

42-
**3. Bootstrapp the development environment**
42+
**3. Bootstrap the development environment**
4343

4444
Navigate to the directory of the newly created project:
4545

@@ -127,7 +127,7 @@ Alternatively you can use the *noxconfig.py* file bellow and adjust the value of
127127

128128
4. Configure the tooling
129129
++++++++++++++++++++++++
130-
In order to make all standard task work properly you need add the configuration settings bellow to your *pyproject.toml*,
130+
In order to make all standard task work properly, you need add the configuration settings below to your *pyproject.toml*,
131131
and adjust the following settings to your project needs:
132132

133133
* coverage
@@ -145,8 +145,8 @@ and adjust the following settings to your project needs:
145145
5. Make the toolbox tasks available
146146
+++++++++++++++++++++++++++++++++++
147147
In order to use the standard toolbox task via nox, just import them in your *noxfile.py*.
148-
If you only need the standard tasks provided by the toolbox your *noxfile.py* is straight
149-
forward and you just can use the example *noxfile.py* bellow.
148+
If you only need the standard tasks provided by the toolbox, your *noxfile.py* is straight
149+
forward, and you just can use the example *noxfile.py* below.
150150

151151
.. literalinclude:: ../../noxfile.py
152152
:language: python3
@@ -161,8 +161,8 @@ forward and you just can use the example *noxfile.py* bellow.
161161

162162

163163

164-
6. Setup the pre-commit hooks [optional]
165-
++++++++++++++++++++++++++++++++++++++++
164+
6. Set up the pre-commit hooks [optional]
165+
+++++++++++++++++++++++++++++++++++++++++
166166

167167
#. Add a :code:`.pre-commit-config.yaml` file to your project root
168168

@@ -171,7 +171,7 @@ forward and you just can use the example *noxfile.py* bellow.
171171
.. literalinclude:: ../../.pre-commit-config.yaml
172172
:language: yaml
173173

174-
#. Enable pre commit hooks for your workspace
174+
#. Enable pre-commit hooks for your workspace
175175

176176
.. code-block:: shell
177177

exasol/toolbox/nox/_documentation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def _build_multiversion_docs(session: nox.Session, config: Config) -> None:
3636
f"{config.doc}",
3737
DOCS_OUTPUT_DIR,
3838
)
39+
session.run("touch", f"{DOCS_OUTPUT_DIR}/.nojekyll")
3940

4041

4142
def _git_diff_changes_main() -> int:

exasol/toolbox/nox/_shared.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from noxconfig import PROJECT_CONFIG
1919

20+
DEFAULT_PATH_FILTERS = {"dist", ".eggs", "venv", ".poetry"}
2021
DOCS_OUTPUT_DIR = ".html-documentation"
2122

2223

@@ -26,24 +27,13 @@ class Mode(Enum):
2627

2728

2829
def python_files(project_root: Path) -> Iterable[Path]:
29-
path_filters = tuple(["dist", ".eggs", "venv"] + list(PROJECT_CONFIG.path_filters))
30-
return _python_files(project_root, path_filters)
31-
32-
33-
def _python_files(
34-
project_root: Path, path_filters: Iterable[str] = ("dist", ".eggs", "venv")
35-
) -> Iterable[Path]:
36-
"""Returns all relevant"""
37-
return _deny_filter(project_root.glob("**/*.py"), deny_list=path_filters)
38-
39-
40-
def _deny_filter(files: Iterable[Path], deny_list: Iterable[str]) -> Iterable[Path]:
4130
"""
42-
Adds a filter to remove unwanted paths containing python files from the iterator.
31+
Returns iterable of python files after removing unwanted paths
4332
"""
44-
for entry in deny_list:
45-
files = list(filter(lambda path: entry not in path.parts, files))
46-
return files
33+
deny_list = DEFAULT_PATH_FILTERS.union(set(PROJECT_CONFIG.path_filters))
34+
35+
files = project_root.glob("**/*.py")
36+
return [path for path in files if not set(path.parts).intersection(deny_list)]
4737

4838

4939
def _version(session: Session, mode: Mode, version_file: Path) -> None:

exasol/toolbox/sphinx/multiversion/git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import tempfile
99

1010
GitRef = collections.namedtuple(
11-
"VersionRef",
11+
"GitRef",
1212
[
1313
"name",
1414
"commit",

exasol/toolbox/templates/github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
run: poetry run -- nox -s project:format
154154

155155
Tests:
156-
name: Unit-Tests (Python-${{ matrix.python-version }}, Exasol-${{ matrix.exasol-version}})
156+
name: Unit-Tests (Python-${{ matrix.python-version }})
157157
needs: [ Documentation, Lint, Type-Check, Security, Format, build-matrix ]
158158
runs-on: ubuntu-24.04
159159
env:

noxconfig.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ class Config:
4646
importlinter: Path = Path(__file__).parent / ".import_linter_config"
4747
version_file: Path = Path(__file__).parent / "exasol" / "toolbox" / "version.py"
4848
path_filters: Iterable[str] = (
49-
"dist",
50-
".eggs",
51-
"venv",
5249
"metrics-schema",
5350
"project-template",
5451
"idioms",

0 commit comments

Comments
 (0)