Skip to content

Commit d6701cc

Browse files
Migrate Python projects from poetry to uv
- Replace poetry with uv for dependency management - Update CI workflow to use uv instead of poetry - Add setuptools configuration for example-pytest-selfie - Update documentation with uv installation and usage - Maintain all existing dependencies and versions - Verify all tests pass across all Python projects Co-Authored-By: [email protected] <[email protected]>
1 parent 13bb0f3 commit d6701cc

File tree

21 files changed

+350
-53
lines changed

21 files changed

+350
-53
lines changed

.github/workflows/python-ci.yml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,46 @@ jobs:
1818
steps:
1919
- name: Checkout
2020
uses: actions/checkout@v4
21-
- run: pipx install poetry
2221
- name: Set up Python
2322
uses: actions/setup-python@v5
2423
with:
2524
python-version: ${{ matrix.python-version }}
26-
cache: "poetry"
27-
- name: selfie-lib - poetry install
28-
run: poetry install
25+
- name: Install uv
26+
shell: bash
27+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
28+
- name: Add uv to PATH
29+
shell: bash
30+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
31+
- name: selfie-lib - install dependencies
32+
run: uv pip install -r requirements.txt -r dev-requirements.txt
2933
working-directory: python/selfie-lib
3034
- name: selfie-lib - pytest
31-
run: poetry run pytest -vv
35+
run: python -m pytest -vv
3236
working-directory: python/selfie-lib
3337
- name: selfie-lib - pyright
34-
run: poetry run pyright
38+
run: python -m pyright
3539
working-directory: python/selfie-lib
3640
- name: selfie-lib - ruff
37-
run: poetry run ruff format --check && poetry run ruff check
41+
run: python -m ruff format --check && python -m ruff check
3842
working-directory: python/selfie-lib
39-
- name: pytest-selfie - poetry install
40-
run: poetry install
43+
- name: pytest-selfie - install dependencies
44+
run: uv pip install -r requirements.txt -r dev-requirements.txt
4145
working-directory: python/pytest-selfie
4246
- name: pytest-selfie - pyright
43-
run: poetry run pyright
47+
run: python -m pyright
4448
working-directory: python/pytest-selfie
4549
- name: pytest-selfie - ruff
46-
run: poetry run ruff format --check && poetry run ruff check
50+
run: python -m ruff format --check && python -m ruff check
4751
working-directory: python/pytest-selfie
48-
- name: example-pytest-selfie - poetry install
49-
run: poetry install
52+
- name: example-pytest-selfie - install dependencies
53+
run: uv pip install -r requirements.txt -r dev-requirements.txt
5054
working-directory: python/example-pytest-selfie
51-
- run: poetry run pytest -vv
55+
- name: example-pytest-selfie - pytest
56+
run: python -m pytest -vv
5257
working-directory: python/example-pytest-selfie
5358
- name: example-pytest-selfie - pyright
54-
run: poetry run pyright
59+
run: python -m pyright
5560
working-directory: python/example-pytest-selfie
5661
- name: example-pytest-selfie - ruff
57-
run: poetry run ruff format --check && poetry run ruff check
62+
run: python -m ruff format --check && python -m ruff check
5863
working-directory: python/example-pytest-selfie

python/README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@
44

55
## Contributing
66

7-
Dependencies are managed using poetry:
8-
9-
- https://python-poetry.org/docs/#installing-with-the-official-installer
10-
- then cd into `selfie-lib` and run `poetry install`
11-
12-
Our CI server runs three checks in the `selfie-lib` directory.
13-
14-
- `poetry run pytest` - run tests
15-
- `poetry run pyright` - type checking
16-
- `poetry run ruff format --check && poetry run ruff check` - code lint & formatting
17-
- `poetry run ruff format && poetry run ruff check --fix` to fix
18-
19-
The same setup is used for `pytest-selfie` and `example-pytest-selfie`.
7+
Dependencies are managed using uv:
8+
- Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh
9+
- Then cd into each directory and run:
10+
- Install: uv pip install -r requirements.txt -r dev-requirements.txt
11+
- Tests: ./scripts/run-tests.sh
12+
- Type checking: ./scripts/run-typecheck.sh
13+
- Linting: ./scripts/run-lint.sh
14+
- Auto-fix formatting: uv python -m ruff format && uv python -m ruff check --fix
15+
16+
Our CI server runs these checks for all Python packages (`selfie-lib`, `pytest-selfie`, and `example-pytest-selfie`).
2017

2118
For the IDE we use VSCode. Make sure to open the `python` directory, not the parent `selfie`. Recommended VSCode plugins:
2219

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Dev dependencies
2+
ruff==0.5.0
3+
pyright==1.1.350
4+
pytest==8.0.0
5+
markdownify==0.12.1
6+
beautifulsoup4==4.12.3
7+
werkzeug==3.0.3
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Metadata-Version: 2.1
2+
Name: example-pytest-selfie
3+
Version: 0.1.0
4+
Summary: An example project for using the pytest plugin for selfie snapshot testing.
5+
Author-email: Selina Delgado <[email protected]>, Harvir Sahota <[email protected]>, Ned Twigg <[email protected]>, Edwin Ye <[email protected]>
6+
License: Apache-2.0
7+
Requires-Python: >=3.9
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
README.md
2+
pyproject.toml
3+
setup.py
4+
example_pytest_selfie.egg-info/PKG-INFO
5+
example_pytest_selfie.egg-info/SOURCES.txt
6+
example_pytest_selfie.egg-info/dependency_links.txt
7+
example_pytest_selfie.egg-info/top_level.txt
8+
tests/__init__.py
9+
tests/app_account_test.py
10+
tests/cache_selfie_test.py
11+
tests/get_started_test.py
12+
tests/homepage_test.py
13+
tests/selfie_settings.py
14+
tests/simple_comment_removal_test.py
15+
tests/simple_inline_test.py
16+
tests/simple_ondisk_test.py
17+
tests/to_be_file_test.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests
Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
1-
[tool.poetry]
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
26
name = "example-pytest-selfie"
37
version = "0.1.0"
48
description = "An example project for using the pytest plugin for selfie snapshot testing."
5-
authors = ["Selina Delgado <[email protected]>","Harvir Sahota <[email protected]>","Ned Twigg <[email protected]>","Edwin Ye <[email protected]>"]
6-
license = "Apache-2.0"
7-
package-mode = false
8-
9-
[tool.poetry.dependencies]
10-
flask = "^3.0.3"
11-
openai = "^1.0.0"
12-
python = "^3.9"
13-
14-
[tool.poetry.group.dev.dependencies]
15-
ruff = "^0.5.0"
16-
pyright = "^1.1.350"
17-
pytest = "^8.0.0"
18-
selfie-lib = { path = "../selfie-lib", develop = true }
19-
pytest-selfie = { path = "../pytest-selfie", develop = true }
20-
markdownify = "^0.12.1"
21-
beautifulsoup4 = "^4.12.3"
22-
werkzeug = "^3.0.3"
23-
24-
[build-system]
25-
requires = ["poetry-core"]
26-
build-backend = "poetry.core.masonry.api"
9+
authors = [
10+
{name = "Selina Delgado", email = "[email protected]"},
11+
{name = "Harvir Sahota", email = "[email protected]"},
12+
{name = "Ned Twigg", email = "[email protected]"},
13+
{name = "Edwin Ye", email = "[email protected]"}
14+
]
15+
license = {text = "Apache-2.0"}
16+
requires-python = ">=3.9"
2717

2818
[tool.ruff]
29-
lint.extend-select = ["I"]
19+
lint.extend-select = ["I"]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Main dependencies
2+
flask==3.0.3
3+
openai==1.0.0
4+
-e ../selfie-lib
5+
-e ../pytest-selfie
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from setuptools import find_packages, setup
2+
3+
setup(
4+
name="example-pytest-selfie",
5+
version="0.1.0",
6+
packages=find_packages(),
7+
install_requires=[
8+
"flask>=3.0.3",
9+
"openai>=1.0.0",
10+
"selfie-lib @ file://localhost/home/ubuntu/repos/selfie/python/selfie-lib",
11+
"pytest-selfie @ file://localhost/home/ubuntu/repos/selfie/python/pytest-selfie",
12+
],
13+
extras_require={
14+
"dev": [
15+
"ruff>=0.5.0",
16+
"pyright>=1.1.350",
17+
"pytest>=8.0.0",
18+
"markdownify>=0.12.1",
19+
"beautifulsoup4>=4.12.3",
20+
"werkzeug>=3.0.3",
21+
]
22+
},
23+
python_requires=">=3.9",
24+
)

0 commit comments

Comments
 (0)