Skip to content

Commit f7ab073

Browse files
authored
Merge pull request #2346 from PyCQA/ci/uv-replacement-for-poetry
UV replacement of Poetry
2 parents 878824b + e8b21ea commit f7ab073

30 files changed

+3191
-2876
lines changed

.github/workflows/constraints.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pip==23.2
2-
virtualenv==20.17.1
1+
pip==24.3.1
2+
virtualenv==20.29.1
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hatch==1.14.0

.github/workflows/integration.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ jobs:
2929
pip install --constraint=.github/workflows/constraints.txt pip
3030
pip --version
3131
32-
- name: Install Poetry
33-
run: |
34-
pipx install --pip-args=--constraint=.github/workflows/poetry-constraints.txt poetry
35-
poetry --version
32+
- name: Install UV
33+
uses: astral-sh/setup-uv@v5
3634

3735
- name: Install dependencies
38-
run: poetry install
36+
run: uv sync --all-extras --frozen
3937

4038
- name: Test integration
4139
run: ./scripts/test_integration.sh

.github/workflows/lint.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ jobs:
2929
pip install --constraint=.github/workflows/constraints.txt pip
3030
pip --version
3131
32-
- name: Install Poetry
33-
run: |
34-
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
35-
poetry --version
32+
- name: Install UV
33+
uses: astral-sh/setup-uv@v5
3634

3735
- name: Install dependencies
38-
run: poetry install
36+
run: uv sync --all-extras --frozen
3937

4038
- name: Lint
4139
run: ./scripts/lint.sh

.github/workflows/poetry-constraints.txt

-1
This file was deleted.

.github/workflows/release-dev.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Release Dev
3+
4+
"on":
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
if: github.repository_owner == 'PyCQA'
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 2
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.13"
24+
25+
- name: Install UV
26+
uses: astral-sh/setup-uv@v5
27+
28+
- name: Build package
29+
run: |
30+
uv build

.github/workflows/release.yml

+13-23
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Release
33

44
"on":
55
push:
6-
branches:
7-
- main
6+
tags:
7+
- "v[0-9]+.[0-9]+.[0-9]+"
88

99
jobs:
1010
release:
@@ -17,45 +17,35 @@ jobs:
1717
with:
1818
fetch-depth: 2
1919

20+
- name: Set Tag env
21+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
22+
2023
- name: Set up Python
2124
uses: actions/setup-python@v5
2225
with:
23-
python-version: "3.12"
26+
python-version: "3.13"
2427

2528
- name: Upgrade pip
2629
run: |
2730
pip install --constraint=.github/workflows/constraints.txt pip
2831
pip --version
2932
30-
- name: Install Poetry
33+
- name: Install Hatch
3134
run: |
32-
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
33-
poetry --version
35+
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
36+
hatch --version
37+
38+
- name: Install UV
39+
uses: astral-sh/setup-uv@v5
3440

3541
- name: Check if there is a parent commit
3642
id: check-parent-commit
3743
run: |
3844
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
3945
40-
- name: Detect and tag new version
41-
id: check-version
42-
if: steps.check-parent-commit.outputs.sha
43-
uses: salsify/action-detect-and-tag-new-version@v2
44-
with:
45-
tag-template: "{VERSION}"
46-
version-command: |
47-
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
48-
49-
- name: Bump version for developmental release
50-
if: "! steps.check-version.outputs.tag"
51-
run: |
52-
poetry version patch &&
53-
version=$(poetry version | awk '{ print $2 }') &&
54-
poetry version $version.dev.$(date +%s)
55-
5646
- name: Build package
5747
run: |
58-
poetry build --ansi
48+
uv build
5949
6050
- name: Publish package on PyPI
6151
if: steps.check-version.outputs.tag

.github/workflows/test.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ jobs:
3434
pip install --constraint=.github/workflows/constraints.txt pip
3535
pip --version
3636
37-
- name: Install Poetry
38-
run: |
39-
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
40-
poetry --version
37+
- name: Install UV
38+
uses: astral-sh/setup-uv@v5
4139

4240
- name: Install dependencies
43-
run: poetry install
41+
run: uv sync --all-extras --frozen
4442

4543
- name: Test
4644
shell: bash

Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARG VERSION=3
22
FROM python:$VERSION
33

4-
# Install pip and poetry
5-
RUN python -m pip install --upgrade pip && python -m pip install poetry
4+
# Install pip and uv
5+
RUN python -m pip install --upgrade pip && python -m pip install uv
66

77
# Setup as minimal a stub project as possible, simply to allow caching base dependencies
88
# between builds.
@@ -14,13 +14,13 @@ RUN touch /isort/isort/__init__.py
1414
RUN touch /isort/tests/__init__.py
1515
RUN touch /isort/README.md
1616
WORKDIR /isort
17-
COPY pyproject.toml poetry.lock /isort/
18-
RUN poetry install
17+
COPY pyproject.toml uv.lock /isort/
18+
RUN uv sync
1919

2020
# Install latest code for actual project
2121
RUN rm -rf /isort
2222
COPY . /isort
23-
RUN poetry install
23+
RUN uv sync
2424

2525
# Run full test suite
2626
CMD /isort/scripts/test.sh

docs/contributing/1.-contributing-guide.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Account Requirements:
1515
Base System Requirements:
1616

1717
- Python3.9+
18-
- poetry
18+
- uv
1919
- bash or a bash compatible shell (should be auto-installed on Linux / Mac)
2020
- WSL users running Ubuntu may need to install Python's venv module even after installing Python.
2121

@@ -25,8 +25,8 @@ Once you have verified that your system matches the base requirements you can st
2525
2. Clone your fork to your local file system:
2626
`git clone https://github.com/$GITHUB_ACCOUNT/isort.git`
2727
3. `cd isort`
28-
4. `poetry install`
29-
* Optionally, isolate poetry's installation from the rest of your system using the instructions on the poetry site here: https://python-poetry.org/docs/#installation
28+
4. `uv sync --all-extras --frozen`
29+
* Optionally, isolate uv's installation from the rest of your system using the instructions on the uv site here: https://docs.astral.sh/uv/
3030
5. `./scripts/test.sh` should yield Success: no issues found
3131
6. `./scripts/clean.sh` should yield a Safety report checking packages
3232

docs/quick_start/1.-install.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Install `isort` using your preferred Python package manager:
44

55
OR
66

7+
`uv add isort`
8+
9+
OR
10+
711
`poetry add isort`
812

913
OR

example_isort_formatting_plugin/poetry.lock

-174
This file was deleted.

0 commit comments

Comments
 (0)