Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging: Use uv to manage this project #2851

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ on:
- "singer_sdk/**"
- "tests/**"
- "noxfile.py"
- "poetry.lock"
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/codspeed.yml"
pull_request:
paths:
- "singer_sdk/**"
- "tests/**"
- "noxfile.py"
- "poetry.lock"
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/codspeed.yml"
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
Expand All @@ -41,20 +41,15 @@ jobs:
python-version: 3.x
architecture: x64

- name: Install poetry
run: |
curl -fsS https://install.python-poetry.org | python - -y

- name: Configure poetry
run: poetry config virtualenvs.create false
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ">=0.5.19"

- name: Install project
run: >
poetry install
-vvv
--with dev
--with benchmark
--all-extras
- name: Install dependencies
run: |
uv export --no-hashes --frozen --all-extras --group benchmark -o requirements.txt
uv pip install --system -r requirements.txt

- uses: CodSpeedHQ/action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
- "singer_sdk/**"
- "tests/**"
- "noxfile.py"
- "poetry.lock"
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/test.yml"
- ".github/workflows/resources/requirements.txt"
push:
Expand All @@ -21,8 +21,8 @@ on:
- "singer_sdk/**"
- "tests/**"
- "noxfile.py"
- "poetry.lock"
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/test.yml"
- ".github/workflows/resources/requirements.txt"
workflow_dispatch:
Expand Down
9 changes: 6 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ ci:
autofix_prs: true
autoupdate_schedule: weekly
autoupdate_commit_msg: 'chore: pre-commit autoupdate'
skip:
- uv-lock

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -58,7 +60,8 @@ repos:
cookiecutter/.*
)$

- repo: https://github.com/python-poetry/poetry
rev: 2.0.1
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.26
hooks:
- id: poetry-check
- id: uv-lock
- id: uv-sync
33 changes: 10 additions & 23 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,32 @@ Contributors are expected to follow our [Code of Conduct](https://docs.meltano.c

## Setting up Prereqs

Make sure [`poetry`](https://python-poetry.org/docs/),
Make sure [`uv`](https://docs.astral.sh/uv/),
[`pre-commit`](https://pre-commit.com/) and [`nox`](https://nox.thea.codes/en/stable/)
are installed. You can use [`pipx`](https://pypa.github.io/pipx/) to install
all of them. To install `pipx`:
are installed. Once you have installed `uv`, you can it to install other tools:
edgarrmondragon marked this conversation as resolved.
Show resolved Hide resolved

```bash
pip3 install pipx
pipx ensurepath
uv tool install pre-commit
uv tool install nox
```

With `pipx` installed, you globally add the required tools:

```bash
pipx install poetry
pipx install pre-commit
pipx install nox
```

Now you can use Poetry to install package dependencies:
Now you can use `uv` to install package dependencies:

```bash
cd sdk
```

```bash
# Install package and dependencies:
poetry install
# OR install in editable mode:
poetry install --no-root
uv sync --all-groups --all-extras
```

## Local Developer Setup

First clone, then...

1. Ensure you have the correct test library, formatters, and linters installed:
- `poetry install`
1. If you are going to update documentation, install the `docs` extras:
- `poetry install -E docs`
- `uv sync --all-groups --all-extras`
1. The project has `pre-commit` hooks. Install them with:
- `pre-commit install`
1. Most development tasks you might need should be covered by `nox` sessions. You can use `nox -l` to list all available tasks.
Expand All @@ -77,8 +64,8 @@ For example:
### If you are using VSCode

1. Make sure you have also installed the `Python` extension.
1. Set interpreter to match poetry's virtualenv: run
`Python: Select interpreter` and select the poetry interpreter.
1. Set interpreter to match uv's managed virtualenv: run
`Python: Select interpreter` and select the interpreter.
1. The [pre-commit extension](https://marketplace.visualstudio.com/items?itemName=MarkLarah.pre-commit-vscode)
will allow to run pre-commit hooks on the current file from the VSCode command palette.

Expand Down Expand Up @@ -151,7 +138,7 @@ nox -rs update_snapshots
or use the `--snapshot-update` flag

```bash
poetry run pytest --snapshot-update -m 'snapshot'
uv run pytest --snapshot-update -m 'snapshot'
```

This will run all tests with the `snapshot` marker and update any snapshots that have changed.
Expand Down
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

7 changes: 3 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import shutil
import sys
import tempfile
import typing as t
from pathlib import Path

import nox
Expand Down Expand Up @@ -41,9 +40,9 @@
"test_cookiecutter",
)

poetry_config = nox.project.load_toml("pyproject.toml")["tool"]["poetry"]
test_dependencies: dict[str, t.Any] = poetry_config["group"]["dev"]["dependencies"]
typing_dependencies = poetry_config["group"]["typing"]["dependencies"].keys()
dependency_groups = nox.project.load_toml("pyproject.toml")["dependency-groups"]
test_dependencies: list[str] = dependency_groups["dev"]
typing_dependencies: list[str] = dependency_groups["typing"]


@nox.session(python=main_python_version)
Expand Down
Loading