Skip to content

Commit

Permalink
UV replacement of Poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
staticdev committed Jan 21, 2025
1 parent 878824b commit 75f243e
Show file tree
Hide file tree
Showing 18 changed files with 3,105 additions and 2,796 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install
run: uv sync

- name: Test integration
run: ./scripts/test_integration.sh
8 changes: 3 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install
run: uv sync

- name: Lint
run: ./scripts/lint.sh
1 change: 0 additions & 1 deletion .github/workflows/poetry-constraints.txt

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Check if there is a parent commit
id: check-parent-commit
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install
run: uv sync

- name: Test
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG VERSION=3
FROM python:$VERSION

# Install pip and poetry
RUN python -m pip install --upgrade pip && python -m pip install poetry
# Install pip and uv
RUN python -m pip install --upgrade pip && python -m pip install uv

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

# Install latest code for actual project
RUN rm -rf /isort
COPY . /isort
RUN poetry install
RUN uv sync

# Run full test suite
CMD /isort/scripts/test.sh
6 changes: 3 additions & 3 deletions docs/contributing/1.-contributing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Account Requirements:
Base System Requirements:

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

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

Expand Down
4 changes: 4 additions & 0 deletions docs/quick_start/1.-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Install `isort` using your preferred Python package manager:

OR

`uv add isort`

OR

`poetry add isort`

OR
Expand Down
174 changes: 0 additions & 174 deletions example_isort_formatting_plugin/poetry.lock

This file was deleted.

20 changes: 9 additions & 11 deletions example_isort_formatting_plugin/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
[tool.poetry]
[project]
name = "example_isort_formatting_plugin"
version = "0.1.1"
description = "An example plugin that modifies isort formatting using black."
authors = ["Timothy Crosley <timothy.crosley@gmail.com>"]
authors = [{name = "Timothy Crosley", email = "timothy.crosley@gmail.com"}, {name = "staticdev", email = "staticdev-support@proton.me"}]
license = "MIT"
requires-python = ">=3.9.0"
dependencies = [
"isort>=5.13.2",
"black>=24.3.0",
]

[tool.poetry.plugins."isort.formatters"]
example = "example_isort_formatting_plugin:black_format_import_section"

[tool.poetry.dependencies]
python = ">=3.10.0"
isort = ">=5.12.0"
black = ">=24.3.0"

[tool.poetry.group.dev.dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
Loading

0 comments on commit 75f243e

Please sign in to comment.