Skip to content

Commit 04494e6

Browse files
authored
Merge pull request #78 from Doist/jacobo/uv
Migrate from poetry to uv
2 parents 6e42bc5 + 194e41d commit 04494e6

File tree

7 files changed

+579
-719
lines changed

7 files changed

+579
-719
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@ jobs:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 60
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515

16-
- name: Set up Python
17-
uses: actions/setup-python@v4
16+
- name: Install the latest version of uv
17+
uses: astral-sh/setup-uv@v6
1818
with:
19+
version: "latest"
1920
python-version: "3.9"
2021

21-
- name: Install dependencies
22+
- name: Build package
2223
run: |
23-
python -m pip install poetry
24+
uv build
2425
25-
- name: Build and publish to PyPI
26+
- name: Publish to PyPI
2627
env:
27-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
28+
# Possibly not necessary once the repo is a trusted publisher in PyPI
29+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
2830
run: |
29-
poetry publish --build
31+
uv publish
32+
33+
- name: Check published package
34+
run: |
35+
uv run --with bitmapist==$(uv version --short) --no-project -- python -c "import bitmapist"

.github/workflows/tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ jobs:
1616
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
1717
steps:
1818
- name: Checkout Repo
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020

21-
- name: Set up Python
22-
uses: actions/setup-python@v4
21+
- name: Install the latest version of uv
22+
uses: astral-sh/setup-uv@v6
2323
with:
24+
version: "latest"
2425
python-version: ${{ matrix.python-version }}
2526

2627
- name: Install dependencies
2728
run: |
28-
python -m pip install poetry
29-
poetry install
29+
uv sync --locked --all-extras --dev
3030
3131
- name: Install redis
3232
run: |
3333
sudo apt-get install redis -y
3434
3535
- name: Run tests
36-
run: poetry run pytest -vv
36+
run: uv run pytest -vv

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
repos:
2+
- repo: https://github.com/astral-sh/uv-pre-commit
3+
rev: 0.8.17
4+
hooks:
5+
- id: uv-lock
6+
27
- repo: https://github.com/astral-sh/ruff-pre-commit
38
rev: v0.13.0
49
hooks:

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Can be installed very easily via:
4343

4444
$ pip install bitmapist
4545

46+
Or, if you use `uv`:
47+
48+
$ uv add bitmapist
49+
4650

4751
# Ports
4852

@@ -331,12 +335,12 @@ Please see our guide [here](./CONTRIBUTING.md)
331335

332336
## Local Development
333337

334-
We use Poetry for dependency management & packaging. Please see [here for setup instructions](https://python-poetry.org/docs/#installation).
338+
We use `uv` for dependency management & packaging. Please see [here for setup instructions](https://docs.astral.sh/uv/getting-started/).
335339

336-
Once you have Poetry installed, you can run the following to install the dependencies in a virtual environment:
340+
Once you have `uv` installed, you can run the following to install the dependencies in a virtual environment:
337341

338342
```bash
339-
poetry install
343+
uv sync
340344
```
341345

342346
## Testing
@@ -348,20 +352,20 @@ You can use these environment variables to tell the tests about Redis:
348352
* `BITMAPIST_REDIS_SERVER_PATH`: Path to the Redis server executable (defaults to the first one in the path or `/usr/bin/redis-server`)
349353
* `BITMAPIST_REDIS_PORT`: Port number for the Redis server (defaults to 6399)
350354

351-
We use pytest to run unittests which you can run in a poetry shell with
355+
We use `pytest` to run unit tests, which you can run with:
352356

353357
```bash
354-
poetry run pytest
358+
uv run pytest
355359
```
356360

357361
## Releasing new versions
358362

359-
- Bump version in `pyproject.toml`
363+
- Bump version in `pyproject.toml` (or use `uv version`)
360364
- Update the CHANGELOG
361365
- Commit the changes with a commit message "Version X.X.X"
362366
- Tag the current commit with `vX.X.X`
363367
- Create a new release on GitHub named `vX.X.X`
364-
- GitHub Actions will publish the new version to PIP for you
368+
- GitHub Actions will publish the new version to PyPI for you
365369

366370
## Legal
367371

0 commit comments

Comments
 (0)