Skip to content

Commit e1e8f1f

Browse files
chore: Migrate to uv
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent 4cf4d84 commit e1e8f1f

13 files changed

Lines changed: 1310 additions & 1728 deletions

File tree

.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: pip
8+
- package-ecosystem: uv
99
directory: "/"
1010
schedule:
11-
interval: "daily"
11+
interval: weekly
1212
commit-message:
1313
prefix: "feat(deps): "
1414
prefix-development: "chore(deps-dev): "
@@ -23,7 +23,7 @@ updates:
2323
- package-ecosystem: pip
2424
directory: "/.github/workflows"
2525
schedule:
26-
interval: "daily"
26+
interval: monthly
2727
commit-message:
2828
prefix: "ci: "
2929
groups:
@@ -33,7 +33,7 @@ updates:
3333
- package-ecosystem: github-actions
3434
directory: "/"
3535
schedule:
36-
interval: "weekly"
36+
interval: monthly
3737
commit-message:
3838
prefix: "ci: "
3939
groups:

.github/workflows/constraints.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
nox==2025.11.12
2-
nox-poetry==1.2.0
3-
pip==25.3
4-
poetry==2.3.1
5-
poetry-dynamic-versioning==1.9.1
6-
poetry-plugin-export==1.10.0

.github/workflows/release.yaml

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,45 @@
1-
name: Publish with Dynamic Versioning
1+
name: Build and Publish
22

33
on:
4-
release:
5-
types: [published]
4+
push:
65

7-
permissions:
8-
contents: write
9-
id-token: write
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8+
cancel-in-progress: true
9+
10+
permissions: {}
1011

1112
jobs:
12-
publish:
13-
name: Publish to PyPI
13+
build:
14+
name: Build Wheel and SDist
1415
runs-on: ubuntu-latest
15-
environment: publishing
16-
env:
17-
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
16+
outputs:
17+
name: ${{ steps.baipp.outputs.package_name }}
18+
version: ${{ steps.baipp.outputs.package_version }}
19+
permissions:
20+
contents: read
1821
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
21-
with:
22-
fetch-depth: 0
23-
24-
- name: Set up Python
25-
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
26-
with:
27-
python-version: "3.10"
28-
29-
- name: Upgrade pip
30-
run: |
31-
pip install pip
32-
pip --version
33-
34-
- name: Install Poetry
35-
run: |
36-
pipx install poetry
37-
pipx inject poetry poetry-dynamic-versioning[plugin]
38-
poetry --version
39-
poetry self show plugins
22+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
23+
with:
24+
fetch-depth: 0
25+
persist-credentials: false
26+
- uses: hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0
27+
id: baipp
4028

41-
- name: Build
42-
run: poetry build
43-
44-
- name: Upload wheel to release
45-
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # 2.11.3
46-
with:
47-
file: dist/*.whl
48-
tag: ${{ github.ref }}
49-
overwrite: true
50-
file_glob: true
51-
52-
- name: Publish
53-
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
29+
publish:
30+
name: PyPI
31+
needs: [build]
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: publishing
35+
url: https://pypi.org/p/${{ needs.build.outputs.name }}/${{ needs.build.outputs.version }}/
36+
if: startsWith(github.ref, 'refs/tags/')
37+
permissions:
38+
id-token: write # Needed for OIDC PyPI publishing
39+
steps:
40+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
41+
with:
42+
name: Packages
43+
path: dist
44+
- name: Publish
45+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

.github/workflows/test.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
- tap_pulumi_cloud/**
1010
- tests/**
1111
- noxfile.py
12-
- poetry.lock
1312
- pyproject.toml
13+
- uv.lock
1414
pull_request:
1515
branches: [main]
1616
types: [opened, synchronize, reopened]
@@ -20,16 +20,17 @@ on:
2020
- tap_pulumi_cloud/**
2121
- tests/**
2222
- noxfile.py
23-
- poetry.lock
2423
- pyproject.toml
24+
- uv.lock
2525

2626
jobs:
2727
test:
2828
runs-on: ubuntu-latest
2929
env:
3030
FORCE_COLOR: "1"
3131
NOXSESSION: tests-${{ matrix.python-version }}
32-
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
32+
UV_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
33+
UV_PYTHON: ${{ matrix.python-version }}
3334
strategy:
3435
fail-fast: false
3536
matrix:
@@ -52,23 +53,12 @@ jobs:
5253
python-version: ${{ matrix.python-version }}
5354
allow-prereleases: true
5455

55-
- name: Upgrade pip
56-
run: |
57-
pip install pip
58-
pip --version
59-
60-
- name: Install Poetry
61-
run: |
62-
pipx install poetry
63-
pipx inject poetry poetry-dynamic-versioning[plugin]
64-
pipx inject poetry poetry-plugin-export
65-
poetry --version
66-
poetry self show plugins
56+
- name: Install uv
57+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
6758

6859
- name: Install Nox
6960
run: |
70-
pipx install nox
71-
pipx inject nox nox-poetry
61+
uv tool install nox
7262
nox --version
7363
7464
- name: Run tests

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ profile_default/
9090
ipython_config.py
9191

9292
# pyenv
93-
.python-version
93+
# .python-version
9494

9595
# pipenv
9696
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.

.pre-commit-config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ci:
22
autofix_prs: true
33
autofix_commit_msg: '[pre-commit.ci] auto fixes'
4-
autoupdate_schedule: monthly
4+
autoupdate_schedule: quarterly
55
autoupdate_commit_msg: 'chore(deps): pre-commit autoupdate'
66

77
repos:
@@ -26,3 +26,9 @@ repos:
2626
- id: ruff-check
2727
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
2828
- id: ruff-format
29+
30+
- repo: https://github.com/astral-sh/uv-pre-commit
31+
rev: 0.9.26
32+
hooks:
33+
- id: uv-lock
34+
- id: uv-sync

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,22 @@ tap-pulumi-cloud --config CONFIG --discover > ./catalog.json
5151
### Initialize your Development Environment
5252

5353
```bash
54-
pipx install poetry
55-
poetry install
54+
curl -LsSf https://astral.sh/uv/install.sh | sh # https://docs.astral.sh/uv/getting-started/installation/
55+
uv sync
5656
```
5757

5858
### Create and Run Tests
5959

6060
Create tests within the `tests` subfolder and then run:
6161

6262
```bash
63-
poetry run pytest
63+
uv run pytest
6464
```
6565

66-
You can also test the `tap-pulumi-cloud` CLI interface directly using `poetry run`:
66+
You can also test the `tap-pulumi-cloud` CLI interface directly using `uv run`:
6767

6868
```bash
69-
poetry run tap-pulumi-cloud --help
69+
uv run tap-pulumi-cloud --help
7070
```
7171

7272
### Testing with [Meltano](https://www.meltano.com)
@@ -81,7 +81,7 @@ Next, install Meltano (if you haven't already) and any needed plugins:
8181

8282
```bash
8383
# Install meltano
84-
pipx install meltano
84+
uv tool install meltano
8585
# Initialize meltano within this directory
8686
cd tap-pulumi-cloud
8787
meltano install

noxfile.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,38 @@
22

33
from __future__ import annotations
44

5-
import os
6-
import sys
7-
from textwrap import dedent
5+
from pathlib import Path
86

97
import nox
108

11-
try:
12-
from nox_poetry import Session, session
13-
except ImportError:
14-
message = f"""\
15-
Nox failed to import the 'nox-poetry' package.
16-
Please install it using the following command:
17-
{sys.executable} -m pip install nox-poetry"""
18-
raise SystemExit(dedent(message)) from None
9+
nox.needs_version = ">=2025.2.9"
10+
nox.options.default_venv_backend = "uv"
11+
nox.options.reuse_venv = "yes"
1912

2013
package = "tap-pulumi-cloud"
2114
src_dir = "tap_pulumi_cloud"
2215
tests_dir = "tests"
2316

24-
python_versions = [
25-
"3.14",
26-
"3.13",
27-
"3.12",
28-
"3.11",
29-
"3.10",
30-
]
31-
main_python_version = "3.13"
17+
PYPROJECT = nox.project.load_toml()
18+
python_versions = nox.project.python_versions(PYPROJECT)
19+
main_python = Path(".python-version").read_text(encoding="utf-8").rstrip()
3220
locations = src_dir, tests_dir, "noxfile.py"
3321
nox.options.sessions = ("tests",)
3422

3523

36-
@session(python=python_versions)
37-
def tests(session: Session) -> None:
24+
@nox.session(python=python_versions)
25+
def tests(session: nox.Session) -> None:
3826
"""Execute pytest tests and compute coverage."""
39-
deps = ["pytest", "pytest-durations"]
40-
if "GITHUB_ACTIONS" in os.environ:
41-
deps.append("pytest-github-actions-annotate-failures")
27+
session.run_install(
28+
"uv",
29+
"sync",
30+
"--locked",
31+
"--no-dev",
32+
"--group=test",
33+
env={
34+
"UV_PROJECT_ENVIRONMENT": session.virtualenv.location,
35+
"UV_PYTHON": session.python,
36+
},
37+
)
4238

43-
session.install(".")
44-
session.install(*deps)
4539
session.run("pytest", *session.posargs)

0 commit comments

Comments
 (0)