Skip to content

Commit

Permalink
Update mirror.py to a uv script (#110)
Browse files Browse the repository at this point in the history
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

From my reading of the [UV
docs](https://docs.astral.sh/uv/guides/scripts/), `mirror.py` would be a
good example of a standalone script. This PR updates `mirror.py` and the
`main.yml` workflow to be a UV script and makes use of UV in the update
process.

## Test Plan

- Update the uv version (currently 0.8.4) to an older version e.g. 0.8.3
in both `pyproject.toml` and `README.md`
- Run `uv run --no-project mirror.py` to check the update process still
works as expected
  • Loading branch information
calumy authored Dec 30, 2024
1 parent f0b5944 commit 6299d2c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 26 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,15 @@ jobs:

- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- run: uv pip install --system -r requirements-dev.txt
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: set git config
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- run: python mirror.py
- run: uv run --no-project mirror.py

- name: check for unpushed commits
id: check_unpushed
Expand Down
9 changes: 9 additions & 0 deletions mirror.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "packaging==23.1",
# "urllib3==2.0.5",
# ]
# ///
"""Update ruff-pre-commit to the latest version of ruff."""

import re
import subprocess
import tomllib
Expand Down
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@ version = "0.0.0"
dependencies = [
"ruff==0.8.4",
]

[project.optional-dependencies]
dev = [
"packaging~=23.1",
"urllib3>=2.0.5,<3.0.0",
]
11 changes: 0 additions & 11 deletions requirements-dev.txt

This file was deleted.

0 comments on commit 6299d2c

Please sign in to comment.