Skip to content

Commit 1d09cee

Browse files
committed
build: migrate from poetry to uv
1 parent d0d15ad commit 1d09cee

File tree

7 files changed

+1970
-1375
lines changed

7 files changed

+1970
-1375
lines changed

.github/workflows/check.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,21 @@ jobs:
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131

32-
- name: Setup poetry
33-
uses: abatilo/actions-poetry@v4
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v4
3434
with:
35-
poetry-version: '2.1.4'
36-
37-
- name: Setup a local virtual environment
38-
run: |
39-
poetry env use ${{ steps.setup-python.outputs.python-path }}
40-
poetry run python --version
41-
poetry config virtualenvs.create true --local
42-
poetry config virtualenvs.in-project true --local
35+
enable-cache: true
4336

4437
- uses: actions/cache@v4
4538
name: Define a cache for the virtual environment based on the dependencies lock file
4639
id: cache
4740
with:
4841
path: ./.venv
49-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
50-
51-
- name: Ensure cache is healthy
52-
if: steps.cache.outputs.cache-hit == 'true'
53-
shell: bash
54-
run: poetry run pip --version >/dev/null 2>&1 || (echo "Cache is broken, skip it" && rm -rf .venv)
42+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
5543

5644
- name: Install dependencies
57-
run: poetry install -E crypto
45+
run: uv sync --extra crypto --extra dev
5846
- name: Generate rest sync code and tests
59-
run: poetry run unasync
47+
run: uv run unasync
6048
- name: Test with pytest
61-
run: poetry run pytest --verbose --tb=short --reruns 3
49+
run: uv run pytest --verbose --tb=short --reruns 3

.github/workflows/lint.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,19 @@ jobs:
1919
with:
2020
python-version: '3.9'
2121

22-
- name: Setup poetry
23-
uses: abatilo/actions-poetry@v4
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v4
2424
with:
25-
poetry-version: '2.1.4'
26-
27-
- name: Setup a local virtual environment
28-
run: |
29-
poetry env use ${{ steps.setup-python.outputs.python-path }}
30-
poetry run python --version
31-
poetry config virtualenvs.create true --local
32-
poetry config virtualenvs.in-project true --local
25+
enable-cache: true
3326

3427
- uses: actions/cache@v4
3528
name: Define a cache for the virtual environment based on the dependencies lock file
3629
id: cache
3730
with:
3831
path: ./.venv
39-
key: venv-${{ runner.os }}-3.9-${{ hashFiles('poetry.lock') }}
40-
41-
- name: Ensure cache is healthy
42-
if: steps.cache.outputs.cache-hit == 'true'
43-
shell: bash
44-
run: poetry run pip --version >/dev/null 2>&1 || (echo "Cache is broken, skip it." && rm -rf .venv)
32+
key: venv-${{ runner.os }}-3.9-${{ hashFiles('uv.lock') }}
4533

4634
- name: Install dependencies
47-
run: poetry install
35+
run: uv sync --extra dev
4836
- name: Lint with flake8
49-
run: poetry run flake8
37+
run: uv run flake8

.github/workflows/release.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,24 @@ jobs:
2121
with:
2222
python-version: 3.12
2323

24-
- name: Setup poetry
25-
uses: abatilo/actions-poetry@v4
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v4
2626
with:
27-
poetry-version: '1.8.5'
28-
29-
- name: Setup a local virtual environment
30-
run: |
31-
poetry env use ${{ steps.setup-python.outputs.python-path }}
32-
poetry run python --version
33-
poetry config virtualenvs.create true --local
34-
poetry config virtualenvs.in-project true --local
27+
enable-cache: true
3528

3629
- uses: actions/cache@v4
3730
name: Define a cache for the virtual environment based on the dependencies lock file
3831
id: cache
3932
with:
4033
path: ./.venv
41-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
42-
43-
- name: Ensure cache is healthy
44-
if: steps.cache.outputs.cache-hit == 'true'
45-
shell: bash
46-
run: poetry run pip --version >/dev/null 2>&1 || (echo "Cache is broken, skip it" && rm -rf .venv)
34+
key: venv-${{ runner.os }}-3.12-${{ hashFiles('uv.lock') }}
4735

4836
- name: Install dependencies
49-
run: poetry install -E crypto
37+
run: uv sync --extra crypto --extra dev
5038
- name: Generate rest sync code and tests
51-
run: poetry run unasync
39+
run: uv run unasync
5240
- name: Build a binary wheel and a source tarball
53-
run: poetry build
41+
run: uv build
5442
- name: Store the distribution packages
5543
uses: actions/upload-artifact@v4
5644
with:

CONTRIBUTING.md

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

55
### Initialising
66

7-
ably-python uses [Poetry](https://python-poetry.org/) for packaging and dependency management. Please refer to the [Poetry documentation](https://python-poetry.org/docs/#installation) for up to date instructions on how to install Poetry.
7+
ably-python uses [uv](https://docs.astral.sh/uv/) for packaging and dependency management. Please refer to the [uv documentation](https://docs.astral.sh/uv/getting-started/installation/) for up to date instructions on how to install uv.
88

99
Perform the following operations after cloning the repository contents:
1010

1111
```shell
1212
git submodule init
1313
git submodule update
1414
# Install the crypto extra if you wish to be able to run all of the tests
15-
poetry install -E crypto
15+
uv sync --extra crypto
1616
```
1717

1818
### Running the test suite
1919

2020
```shell
21-
poetry run pytest
21+
uv run pytest
2222
```
2323

2424
## Release Process
@@ -38,8 +38,8 @@ The release process must include the following steps:
3838
5. Commit this change: `git add CHANGELOG.md && git commit -m "Update change log."`
3939
6. Push the release branch to GitHub
4040
7. Create a release PR (ensure you include an SDK Team Engineering Lead and the SDK Team Product Manager as reviewers) and gain approvals for it, then merge that to `main`
41-
8. Build the synchronous REST client by running `poetry run unasync`
42-
9. From the `main` branch, run `poetry build && poetry publish` (will require you to have a PyPi API token, see [guide](https://www.digitalocean.com/community/tutorials/how-to-publish-python-packages-to-pypi-using-poetry-on-ubuntu-22-04)) to build and upload this new package to PyPi
41+
8. Build the synchronous REST client by running `uv run unasync`
42+
9. From the `main` branch, run `uv build && uv publish` (will require you to have a PyPi API token, see [guide](https://docs.astral.sh/uv/guides/publish/)) to build and upload this new package to PyPi
4343
10. Create a tag named like `v2.0.1` and push it to GitHub - e.g. `git tag v2.0.1 && git push origin v2.0.1`
4444
11. Create the release on GitHub including populating the release notes
4545
12. Update the [Ably Changelog](https://changelog.ably.com/) (via [headwayapp](https://headwayapp.co/)) with these changes

0 commit comments

Comments
 (0)