Skip to content

Commit 2d00730

Browse files
authored
Merge pull request #2349 from PyCQA/revert-2347-revert-2346-ci/uv-replacement-for-poetry
UV replacement of Poetry
2 parents b3760ab + 16bb0e2 commit 2d00730

29 files changed

+3512
-2896
lines changed

.github/workflows/constraints.txt

-2
This file was deleted.

.github/workflows/integration.yml

+5-10
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@ jobs:
2424
python-version: ${{ matrix.python-version }}
2525
cache: "pip"
2626

27-
- name: Upgrade pip
28-
run: |
29-
pip install --constraint=.github/workflows/constraints.txt pip
30-
pip --version
31-
32-
- name: Install Poetry
33-
run: |
34-
pipx install --pip-args=--constraint=.github/workflows/poetry-constraints.txt poetry
35-
poetry --version
27+
- name: Install UV
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
version: ">=0.5.24"
3631

3732
- name: Install dependencies
38-
run: poetry install
33+
run: uv sync --all-extras --frozen
3934

4035
- name: Test integration
4136
run: ./scripts/test_integration.sh

.github/workflows/lint.yml

+5-10
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@ jobs:
2424
python-version: ${{ matrix.python-version }}
2525
cache: "pip"
2626

27-
- name: Upgrade pip
28-
run: |
29-
pip install --constraint=.github/workflows/constraints.txt pip
30-
pip --version
31-
32-
- name: Install Poetry
33-
run: |
34-
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
35-
poetry --version
27+
- name: Install UV
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
version: ">=0.5.24"
3631

3732
- name: Install dependencies
38-
run: poetry install
33+
run: uv sync --all-extras --frozen
3934

4035
- name: Lint
4136
run: ./scripts/lint.sh

.github/workflows/poetry-constraints.txt

-1
This file was deleted.

.github/workflows/release-dev.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
with:
28+
version: ">=0.5.24"
29+
30+
- name: Build package
31+
run: |
32+
uv build

.github/workflows/release.yml

+13-27
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,31 @@ 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

25-
- name: Upgrade pip
28+
- name: Install dependencies
2629
run: |
27-
pip install --constraint=.github/workflows/constraints.txt pip
28-
pip --version
30+
uv sync --all-extras --frozen
2931
30-
- name: Install Poetry
31-
run: |
32-
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
33-
poetry --version
32+
- name: Install UV
33+
uses: astral-sh/setup-uv@v5
34+
with:
35+
version: ">=0.5.24"
3436

3537
- name: Check if there is a parent commit
3638
id: check-parent-commit
3739
run: |
3840
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
3941
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-
5642
- name: Build package
5743
run: |
58-
poetry build --ansi
44+
uv build
5945
6046
- name: Publish package on PyPI
6147
if: steps.check-version.outputs.tag

.github/workflows/test.yml

+5-10
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,13 @@ jobs:
2929
python-version: ${{ matrix.python-version }}
3030
cache: "pip"
3131

32-
- name: Upgrade pip
33-
run: |
34-
pip install --constraint=.github/workflows/constraints.txt pip
35-
pip --version
36-
37-
- name: Install Poetry
38-
run: |
39-
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
40-
poetry --version
32+
- name: Install UV
33+
uses: astral-sh/setup-uv@v5
34+
with:
35+
version: ">=0.5.24"
4136

4237
- name: Install dependencies
43-
run: poetry install
38+
run: uv sync --all-extras --frozen
4439

4540
- name: Test
4641
shell: bash

Dockerfile

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
ARG VERSION=3
2-
FROM python:$VERSION
1+
FROM python:3.13
32

4-
# Install pip and poetry
5-
RUN python -m pip install --upgrade pip && python -m pip install poetry
3+
WORKDIR /isort
4+
COPY pyproject.toml uv.lock /isort/
5+
6+
# Install uv
7+
COPY --from=ghcr.io/astral-sh/uv:0.5.24 /uv /uvx /bin/
68

79
# Setup as minimal a stub project as possible, simply to allow caching base dependencies
810
# between builds.
@@ -13,14 +15,11 @@ RUN mkdir -p /isort/tests
1315
RUN touch /isort/isort/__init__.py
1416
RUN touch /isort/tests/__init__.py
1517
RUN touch /isort/README.md
16-
WORKDIR /isort
17-
COPY pyproject.toml poetry.lock /isort/
18-
RUN poetry install
18+
COPY . /isort
19+
RUN SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0 uv sync --all-extras --frozen
1920

2021
# Install latest code for actual project
2122
RUN rm -rf /isort
22-
COPY . /isort
23-
RUN poetry install
2423

2524
# Run full test suite
2625
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

0 commit comments

Comments
 (0)