Skip to content

Commit b222278

Browse files
committed
replace setup.py with pyproject.toml and use uv in CI
1 parent 923cf38 commit b222278

File tree

6 files changed

+52
-79
lines changed

6 files changed

+52
-79
lines changed

.github/workflows/push.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,18 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: ${{ matrix.python-version }}
25-
# Confirm that the `python` maps to the version we just installed.
26-
# PowerShell on Windows does this differently than the Unix shells.
27-
- run: which python ; python --version ; which pip ; pip --version
28-
if: matrix.os != 'windows-latest'
29-
- run: get-command python ; python --version ; get-command pip ; pip --version
30-
if: matrix.os == 'windows-latest'
21+
- uses: astral-sh/setup-uv@v5
3122
- run: git --version
3223
# Make sure Subversion and Mercurial are installed on Windows and macOS.
33-
- run: sudo apt-get update && sudo apt-get install -y subversion mercurial
24+
# I'd prefer `uv tool install mercurial`, but that crashes on Windows for
25+
# some reason. We don't need Mercurial to use the same Python version that
26+
# we're using.
27+
- run: pip install mercurial
28+
- run: sudo apt-get update && sudo apt-get install -y subversion
3429
if: matrix.os == 'ubuntu-latest'
35-
- run: brew install subversion mercurial
30+
- run: brew install subversion
3631
if: matrix.os == 'macOS-latest'
37-
- run: choco install -y --no-progress sliksvn && pip install mercurial
32+
- run: choco install -y --no-progress sliksvn
3833
if: matrix.os == 'windows-latest'
39-
# Install test dependencies, like flake8.
40-
- run: pip install -r ./requirements-dev.txt
4134
# Run tests.
42-
- run: python test.py -v
35+
- run: uv run --python ${{ matrix.python-version }} test.py -v

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ __pycache__
44
peru.egg-info
55
build/
66
dist/
7+
uv.lock

peru.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This script is for running peru directly from the repo, mainly for
44
# development. This isn't what gets installed when you install peru. That would
55
# be a script generated by setup.py, which calls peru.main.main().
6+
#
7+
# Update October 2025: `uv run peru` also works.
68

79
import os
810
import sys

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[project]
2+
name = "peru"
3+
version = "1.3.4"
4+
description = "a tool for fetching code"
5+
readme = "README.md"
6+
license = "MIT"
7+
authors = [
8+
{ name = "Jack O'Connor", email = "[email protected]" },
9+
{ name = "Sean Olson", email = "[email protected]" },
10+
]
11+
requires-python = ">=3.8"
12+
dependencies = [
13+
"PyYAML",
14+
]
15+
16+
[project.urls]
17+
Repository = "https://github.com/buildinspace/peru"
18+
19+
[project.scripts]
20+
peru = "peru.main:main"
21+
22+
[build-system]
23+
requires = ["hatchling"]
24+
build-backend = "hatchling.build"
25+
26+
[tool.hatch.build]
27+
include = [
28+
"peru/**/*.py",
29+
"peru/VERSION",
30+
"peru/resources/**/*",
31+
]
32+
33+
[tool.hatch.version]
34+
path = "peru/VERSION"
35+
pattern = "(?P<version>.+)"
36+
37+
[dependency-groups]
38+
dev = [
39+
"flake8",
40+
]

requirements-dev.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)