Skip to content

Commit f19adfb

Browse files
committed
Friendship ended with poetry, uv is my new best friend
Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: 7eaabd7 ghstack-comment-id: 2725364353 Pull Request resolved: ezyang#275
1 parent 6f32174 commit f19adfb

34 files changed

+1932
-1369
lines changed

.github/workflows/lint.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v3
19-
- name: Install Poetry
20-
run: pipx install poetry==1.7.1
21-
- name: Install Python
22-
uses: actions/setup-python@v4
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
2321
with:
2422
python-version: ${{ matrix.python-version }}
25-
cache: poetry
26-
- name: Install dependencies
27-
run: poetry install
23+
enable-cache: true
24+
cache-suffix: "optional-suffix"
2825
- name: Run lint
2926
run: |
3027
RC=0
3128
# Run lintrunner on all files
32-
if ! poetry run lintrunner --force-color --all-files --tee-json=lint.json 2> /dev/null; then
29+
if ! uv run --frozen lintrunner --force-color --all-files --tee-json=lint.json 2> /dev/null; then
3330
echo ""
3431
echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner\`. (If you don't get the same results, run \'lintrunner init\' to update your local linter)\e[0m"
3532
RC=1

.github/workflows/test.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v3
19-
- name: Install Poetry
20-
run: pipx install poetry==1.7.1
21-
- name: Install Python
22-
uses: actions/setup-python@v4
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
2321
with:
2422
python-version: ${{ matrix.python-version }}
25-
cache: poetry
26-
- name: Install dependencies
27-
run: poetry install
23+
enable-cache: true
24+
cache-suffix: "optional-suffix"
2825
- name: Run tests
29-
run: poetry run pytest --verbose
26+
run: uv run --frozen pytest --verbose

README.md

-45
Original file line numberDiff line numberDiff line change
@@ -74,51 +74,6 @@ pull request and pushes commits onto three branches:
7474
want to work on the commits from another machine, this is the best way
7575
to get it.
7676

77-
## Developer notes
78-
79-
This project uses [Poetry](https://python-poetry.org/docs/#installation), so
80-
after you've installed Poetry itself, run this command in your clone of this
81-
repo to install all the dependencies you need for working on `ghstack`:
82-
```
83-
poetry install
84-
```
85-
Note that this installs the dependencies (and `ghstack` itself) in an isolated
86-
Python virtual environment rather than globally. If your cwd is in your clone of
87-
this repo then you can run your locally-built `ghstack` using `poetry run
88-
ghstack $ARGS`, but if you want to run it from somewhere else, you probably want
89-
[`poetry shell`](https://python-poetry.org/docs/cli/#shell) instead:
90-
```
91-
poetry shell
92-
cd $SOMEWHERE
93-
ghstack $ARGS
94-
```
95-
96-
### Testing
97-
98-
We have tests, using a mock GitHub GraphQL server! How cool is that?
99-
```
100-
poetry run python test_ghstack.py
101-
```
102-
That runs most of the tests; you can run all tests (including lints) like this:
103-
```
104-
poetry run python run_tests.py
105-
```
106-
107-
### Publishing
108-
109-
You can also [use Poetry to
110-
publish](https://python-poetry.org/docs/cli/#publish) to a package repository.
111-
For instance, if you've configured your [Poetry
112-
repositories](https://python-poetry.org/docs/repositories/) like this:
113-
```
114-
poetry config repositories.testpypi https://test.pypi.org/legacy/
115-
```
116-
Then you can publish to TestPyPI like this:
117-
```
118-
poetry publish --build --repository testpypi
119-
```
120-
To publish to PyPI itself, just omit the `--repository` argument.
121-
12277
## Design constraints
12378

12479
There are some weird aspects about GitHub's design which lead to unusual

poetry.lock

-1,273
This file was deleted.

pyproject.toml

+35-30
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,49 @@
1-
[tool.poetry]
1+
[project]
2+
authors = [
3+
{name = "Edward Z. Yang", email = "[email protected]"},
4+
]
5+
license = {text = "MIT"}
6+
requires-python = "<4.0.0,>=3.8.1"
7+
dependencies = [
8+
"aiohttp<4,>=3",
9+
"importlib-metadata>=1.4; python_version < \"3.8\"",
10+
"requests<3,>=2",
11+
"typing-extensions>=3",
12+
"click<9,>=8",
13+
"flake8<8.0.0,>=7.0.0",
14+
]
215
name = "ghstack"
316
version = "0.9.4"
4-
authors = ["Edward Z. Yang <[email protected]>"]
517
description = "Stack diff support for GitHub"
618
readme = "README.md"
7-
repository = "https://github.com/ezyang/ghstack"
8-
include = ["ghstack/py.typed"]
9-
license = "MIT"
1019
classifiers = [
1120
"Programming Language :: Python :: 3",
1221
"License :: OSI Approved :: MIT License",
1322
"Operating System :: OS Independent",
1423
]
1524

16-
[tool.poetry.scripts]
17-
ghstack = "ghstack.cli:main"
25+
[project.urls]
26+
repository = "https://github.com/ezyang/ghstack"
1827

19-
[tool.poetry.dependencies]
20-
aiohttp = "^3"
21-
importlib-metadata = { version = ">=1.4", python = "<3.8" }
22-
python = "^3.8.1"
23-
requests = "^2"
24-
typing-extensions = ">=3 <5"
25-
click = "^8"
26-
flake8 = "^7.0.0"
28+
[project.scripts]
29+
ghstack = "ghstack.cli:main"
2730

28-
[tool.poetry.dev-dependencies]
29-
black = "^24.3.0"
30-
flake8 = "^7"
31-
graphql-core = "^3"
32-
hypothesis = "^6"
33-
mypy = "^1"
34-
pytest = "^7"
35-
usort = "^1"
36-
ufmt = "^2"
37-
lintrunner = "^0.11.0"
38-
types-requests = "^2.31.0.10"
39-
pytest-xdist = "^3.5.0"
40-
expecttest = "^0.2.0"
31+
[dependency-groups]
32+
dev = [
33+
"black<25.0.0,>=24.3.0",
34+
"flake8<8,>=7",
35+
"graphql-core<4,>=3",
36+
"hypothesis<7,>=6",
37+
"mypy<2,>=1",
38+
"pytest<8,>=7",
39+
"usort<2,>=1",
40+
"ufmt<3,>=2",
41+
"lintrunner<1.0.0,>=0.11.0",
42+
"types-requests<3.0.0.0,>=2.31.0.10",
43+
"pytest-xdist<4.0.0,>=3.5.0",
44+
"expecttest<1.0.0,>=0.2.0",
45+
]
4146

4247
[build-system]
43-
requires = ["poetry-core>=1.0.0"]
44-
build-backend = "poetry.core.masonry.api"
48+
requires = ["uv_build>=0.6,<0.7"]
49+
build-backend = "uv_build"
File renamed without changes.
File renamed without changes.

ghstack/action.py renamed to src/ghstack/action.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def main(
2626
}
2727
}
2828
""",
29-
**params
29+
**params,
3030
)
3131
pr_id = pr_result["data"]["repository"]["pullRequest"]["id"]
3232

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ghstack/forensics.py renamed to src/ghstack/forensics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async def main(
7373
}
7474
}
7575
""",
76-
**params
76+
**params,
7777
)
7878
nodes = r["data"]["repository"]["pullRequest"]["commits"]["nodes"]
7979

File renamed without changes.

ghstack/github.py renamed to src/ghstack/github.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_head_ref(self, **params: Any) -> str:
3838
}
3939
}
4040
""",
41-
**params
41+
**params,
4242
)
4343
r = pr_result["data"]["repository"]["pullRequest"]["headRefName"]
4444
assert isinstance(r, str), type(r)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ghstack/shell.py renamed to src/ghstack/shell.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def sh(
9292
stdin: _HANDLE = None,
9393
stdout: _HANDLE = subprocess.PIPE,
9494
exitcode: bool = False,
95-
tick: bool = False
95+
tick: bool = False,
9696
) -> _SHELL_RET:
9797
"""
9898
Run a command specified by args, and return string representing

ghstack/status.py renamed to src/ghstack/status.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def main(
7777
}
7878
}
7979
""",
80-
**params
80+
**params,
8181
)
8282
contexts = r["data"]["repository"]["pullRequest"]["commits"]["nodes"][0]["commit"][
8383
"status"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)