Skip to content

Commit d51e287

Browse files
authored
Merge pull request #671 from opsmill/wvd-20251201-release-1.16
Prep release v1.16.0
2 parents 085e87b + 4952028 commit d51e287

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4941
-4503
lines changed

.github/file-filters.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ development_files: &development_files
1313
- "development/**"
1414
- "tasks/**"
1515

16-
poetry_files: &poetry_files
16+
uv_files: &uv_files
1717
- "pyproject.toml"
18-
- "poetry.lock"
18+
- "uv.lock"
1919

2020
doc_files: &doc_files
2121
- "docs/**"
@@ -24,7 +24,7 @@ doc_files: &doc_files
2424

2525
python_all: &python_all
2626
- "**/*.py"
27-
- *poetry_files
27+
- *uv_files
2828
- *ci_config
2929
- *coverage_config
3030

.github/workflows/ci.yml

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
helm: ${{ steps.changes.outputs.helm_all }}
4343
python: ${{ steps.changes.outputs.python_all }}
4444
yaml: ${{ steps.changes.outputs.yaml_all }}
45-
poetry_files: ${{ steps.changes.outputs.poetry_files }}
45+
uv_files: ${{ steps.changes.outputs.uv_files }}
4646
github_workflows: ${{ steps.changes.outputs.github_workflows }}
4747
steps:
4848
- name: "Check out repository code"
@@ -71,18 +71,26 @@ jobs:
7171

7272
python-lint:
7373
if: needs.files-changed.outputs.python == 'true'
74-
needs: ["files-changed"]
74+
needs: ["files-changed", "prepare-environment"]
7575
runs-on: "ubuntu-latest"
7676
timeout-minutes: 5
7777
steps:
7878
- name: "Check out repository code"
79-
uses: "actions/checkout@v6"
80-
- name: "Setup environment"
81-
run: "pip install ruff==0.11.0"
79+
uses: "actions/checkout@v5"
80+
- name: Set up Python
81+
uses: actions/setup-python@v6
82+
with:
83+
python-version: "3.12"
84+
- name: Install UV
85+
uses: astral-sh/setup-uv@v7
86+
with:
87+
version: "${{ needs.prepare-environment.outputs.UV_VERSION }}"
88+
- name: Install dependencies
89+
run: uv sync --group lint
8290
- name: "Linting: ruff check"
83-
run: "ruff check ."
91+
run: "uv run ruff check ."
8492
- name: "Linting: ruff format"
85-
run: "ruff format --check --diff ."
93+
run: "uv run ruff format --check --diff ."
8694

8795

8896
markdown-lint:
@@ -129,7 +137,7 @@ jobs:
129137
!contains(needs.*.result, 'failure') &&
130138
!contains(needs.*.result, 'cancelled') &&
131139
needs.files-changed.outputs.documentation == 'true'
132-
needs: ["files-changed", "yaml-lint", "python-lint"]
140+
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
133141
runs-on: "ubuntu-22.04"
134142
timeout-minutes: 5
135143
steps:
@@ -145,10 +153,18 @@ jobs:
145153
cache-dependency-path: docs/package-lock.json
146154
- name: "Install dependencies"
147155
run: npm install
148-
- name: "Setup Python environment"
149-
run: "pip install invoke"
156+
- name: Set up Python
157+
uses: actions/setup-python@v6
158+
with:
159+
python-version: "3.12"
160+
- name: Install UV
161+
uses: astral-sh/setup-uv@v7
162+
with:
163+
version: "${{ needs.prepare-environment.outputs.UV_VERSION }}"
164+
- name: Install dependencies
165+
run: uv sync --all-groups --all-extras
150166
- name: "Build docs website"
151-
run: "invoke docs"
167+
run: "uv run invoke docs"
152168

153169
validate-generated-documentation:
154170
if: |
@@ -168,17 +184,14 @@ jobs:
168184
uses: actions/setup-python@v6
169185
with:
170186
python-version: "3.12"
171-
- name: "Setup Python environment"
172-
run: |
173-
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
174-
poetry config virtualenvs.create true --local
175-
poetry env use 3.12
176-
- name: "Install dependencies"
177-
run: "poetry install --no-interaction --no-ansi --extras ctl"
178-
- name: "Setup environment"
179-
run: "poetry run pip install invoke"
180-
- name: "Validate generated documentation"
181-
run: "poetry run invoke docs-validate"
187+
- name: Install UV
188+
uses: astral-sh/setup-uv@v7
189+
with:
190+
version: "${{ needs.prepare-environment.outputs.UV_VERSION }}"
191+
- name: Install dependencies
192+
run: uv sync --all-groups --all-extras
193+
- name: Validate generated documentation
194+
run: uv run invoke docs-validate
182195

183196
validate-documentation-style:
184197
if: |
@@ -212,7 +225,6 @@ jobs:
212225
strategy:
213226
matrix:
214227
python-version:
215-
- "3.9"
216228
- "3.10"
217229
- "3.11"
218230
- "3.12"
@@ -232,24 +244,20 @@ jobs:
232244
uses: actions/setup-python@v6
233245
with:
234246
python-version: ${{ matrix.python-version }}
235-
- name: "Setup environment"
236-
run: |
237-
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }} --python python${{ matrix.python-version }}
238-
poetry config virtualenvs.create true --local
239-
pip install invoke codecov
240-
- name: "Install tomli for Python < 3.11"
241-
if: matrix.python-version == '3.9' || matrix.python-version == '3.10'
242-
run: |
243-
pip install tomli
244-
- name: "Install Package"
245-
run: "poetry install --all-extras"
246-
- name: "Mypy Tests"
247-
run: "poetry run mypy --show-error-codes infrahub_sdk/"
248-
- name: "Unit Tests"
249-
run: "poetry run pytest --cov infrahub_sdk tests/unit/"
247+
- name: Install UV
248+
uses: astral-sh/setup-uv@v7
249+
with:
250+
version: "${{ needs.prepare-environment.outputs.UV_VERSION }}"
251+
python-version: ${{ matrix.python-version }}
252+
- name: Install dependencies
253+
run: uv sync --all-groups --all-extras
254+
- name: Mypy Tests
255+
run: uv run mypy --show-error-codes infrahub_sdk/
256+
- name: Unit Tests
257+
run: uv run pytest --cov infrahub_sdk tests/unit/
250258
- name: "Upload coverage to Codecov"
251259
run: |
252-
codecov --flags python-${{ matrix.python-version }}
260+
uv run codecov --flags python-${{ matrix.python-version }}
253261
env:
254262
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
255263

@@ -259,11 +267,10 @@ jobs:
259267
- name: "Report coverage for pytest-plugin"
260268
if: matrix.python-version == '3.12'
261269
run: |
262-
source $(poetry env info --path)/bin/activate
263-
coverage run --source=infrahub_sdk -m pytest tests/unit/pytest_plugin
264-
coverage report -m
265-
coverage xml
266-
codecov --flags python-filler-${{ matrix.python-version }}
270+
uv run coverage run --source=infrahub_sdk -m pytest tests/unit/pytest_plugin
271+
uv run coverage report -m
272+
uv run coverage xml
273+
uv run codecov --flags python-filler-${{ matrix.python-version }}
267274
env:
268275
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
269276

@@ -289,19 +296,17 @@ jobs:
289296
run: |
290297
RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/')
291298
echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
292-
- name: "Setup environment"
293-
run: |
294-
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
295-
poetry config virtualenvs.create true --local
296-
pip install invoke codecov
297-
- name: "Install Package"
298-
run: "poetry install --all-extras"
299-
- name: "Integration Tests"
300-
run: |
301-
poetry run pytest --cov infrahub_sdk tests/integration/
299+
- name: Install UV
300+
uses: astral-sh/setup-uv@v7
301+
with:
302+
version: "${{ needs.prepare-environment.outputs.UV_VERSION }}"
303+
- name: Install dependencies
304+
run: uv sync --all-groups --all-extras
305+
- name: Integration Tests
306+
run: uv run pytest --cov infrahub_sdk tests/integration/
302307
- name: "Upload coverage to Codecov"
303308
run: |
304-
codecov --flags integration-tests
309+
uv run codecov --flags integration-tests
305310
env:
306311
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
307312

.github/workflows/define-versions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ name: "Define versions"
44
on:
55
workflow_call:
66
outputs:
7-
POETRY_VERSION:
8-
value: "2.1.3"
7+
UV_VERSION:
8+
value: "0.9.8"
99

1010
jobs:
1111
prepare:

.github/workflows/publish-pypi.yml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,39 +41,35 @@ jobs:
4141
with:
4242
python-version: "3.12"
4343

44-
- name: "Install Poetry"
45-
uses: "snok/install-poetry@v1"
44+
- name: Install UV
45+
uses: astral-sh/setup-uv@v4
4646
with:
47-
version: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
48-
virtualenvs-create: true
49-
virtualenvs-in-project: true
50-
installer-parallel: true
47+
version: ${{ needs.prepare-environment.outputs.UV_VERSION }}
5148

5249
- name: "Check out repository code"
5350
uses: "actions/checkout@v6"
5451
with:
5552
submodules: true
5653

57-
- name: "Cache poetry venv"
54+
- name: Cache UV dependencies
5855
uses: "actions/cache@v4"
59-
id: "cached-poetry-dependencies"
56+
id: "cached-uv-dependencies"
6057
with:
61-
path: "./python_sdk/.venv"
62-
key: "venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}"
58+
path: ".venv"
59+
key: "venv-${{ runner.os }}-${{ hashFiles('uv.lock') }}"
6360

64-
- name: "Install Dependencies"
65-
run: "poetry install"
66-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
61+
- name: Install Dependencies
62+
run: uv sync --all-groups --all-extras
63+
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true'
6764

68-
- name: "Add PyPI secret"
69-
run: "poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}"
65+
- name: Build package
66+
run: uv build
7067

71-
- name: "Poetry build"
72-
run: "poetry build"
68+
- name: Show output
69+
run: ls -la dist/
7370

74-
- name: "show output"
75-
run: "ls -la dist/"
76-
77-
- name: "Poetry push PyPI"
71+
- name: Publish to PyPI
7872
if: ${{ inputs.publish }}
79-
run: "poetry publish"
73+
env:
74+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
75+
run: uv publish

.github/workflows/release.yml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,22 @@ jobs:
3030
with:
3131
python-version: "3.12"
3232

33-
- name: "Install Poetry"
34-
uses: "snok/install-poetry@v1"
33+
- name: Install UV
34+
uses: astral-sh/setup-uv@v4
3535
with:
36-
version: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
37-
virtualenvs-create: true
38-
virtualenvs-in-project: true
39-
installer-parallel: true
36+
version: "${{ needs.prepare-environment.outputs.UV_VERSION }}"
4037

41-
- name: "Setup Python environment"
42-
run: |
43-
poetry config virtualenvs.create true --local
44-
poetry env use 3.12
45-
- name: "Install dependencies"
46-
run: "poetry install --no-interaction --no-ansi"
38+
- name: Install dependencies
39+
run: uv sync --all-groups --all-extras
4740

48-
- name: "Check prerelease type"
41+
- name: Check prerelease type
4942
id: release
5043
run: |
51-
echo is_prerelease=$(poetry run python -c "from packaging.version import Version; print(int(Version('$(poetry version -s)').is_prerelease))") >> "$GITHUB_OUTPUT"
52-
echo is_devrelease=$(poetry run python -c "from packaging.version import Version; print(int(Version('$(poetry version -s)').is_devrelease))") >> "$GITHUB_OUTPUT"
53-
echo "version=$(poetry version -s)" >> "$GITHUB_OUTPUT"
54-
echo major_minor_version=$(poetry run python -c "from packaging.version import Version; print(f\"{Version('$(poetry version -s)').major}.{Version('$(poetry version -s)').minor}\")") >> "$GITHUB_OUTPUT"
44+
VERSION=$(uv version --short)
45+
echo is_prerelease=$(uv run python -c "from packaging.version import Version; print(int(Version('$VERSION').is_prerelease))") >> "$GITHUB_OUTPUT"
46+
echo is_devrelease=$(uv run python -c "from packaging.version import Version; print(int(Version('$VERSION').is_devrelease))") >> "$GITHUB_OUTPUT"
47+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
48+
echo major_minor_version=$(uv run python -c "from packaging.version import Version; v = Version('$VERSION'); print(f'{v.major}.{v.minor}')") >> "$GITHUB_OUTPUT"
5549
echo latest_tag=$(curl -L \
5650
-H "Accept: application/vnd.github+json" \
5751
-H "Authorization: Bearer ${{ github.token }}" \
@@ -60,10 +54,14 @@ jobs:
6054
| jq -r '.tag_name') >> "$GITHUB_OUTPUT"
6155
6256
- name: Check tag version
63-
if: github.event.release.tag_name != format('v{0}', steps.release.outputs.version)
6457
run: |
65-
echo "Tag version does not match python project version"
66-
exit 1
58+
EXPECTED_TAG="v${{ steps.release.outputs.version }}"
59+
if [ "${{ github.event.release.tag_name }}" != "$EXPECTED_TAG" ]; then
60+
echo "Tag version does not match python project version"
61+
echo "Expected: $EXPECTED_TAG"
62+
echo "Got: ${{ github.event.release.tag_name }}"
63+
exit 1
64+
fi
6765
6866
- name: Check prerelease and project version
6967
if: github.event.release.prerelease == true && steps.release.outputs.is_prerelease == 0 && steps.release.outputs.is_devrelease == 0

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ script.py
88
.vscode/settings.json
99
.DS_Store
1010
.python-version
11+
.venv/
12+
.venv
1113
.ruff_cache
1214
**/.ruff_cache
1315
**/.idea/**

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang
1111

1212
<!-- towncrier release notes start -->
1313

14+
## [1.16.0](https://github.com/opsmill/infrahub-sdk-python/tree/v1.16.0) - 2025-12-01
15+
16+
### Added
17+
18+
- Added infrahubctl branch report command to help with cleaning up branches in Infrahub.
19+
20+
### Changed
21+
22+
- Updated behaviour for recursive lookups for the conversion of nested relationships. Note that this change could cause issues in transforms or generators that use the convert_query_response feature if "id" or "__typename" isn't requested for nested related objects. ([#389](https://github.com/opsmill/infrahub-sdk-python/issues/389))
23+
- The project now uses `uv` instead of `poetry` for package and dependency management.
24+
25+
### Removed
26+
27+
- Remove `is_visible` property from infrahub
28+
- Removed support for Python 3.9 (end of life)
29+
1430
## [1.15.1](https://github.com/opsmill/infrahub-sdk-python/tree/v1.15.1) - 2025-11-13
1531

1632
### Fixed

0 commit comments

Comments
 (0)