Skip to content

Commit 7b4a000

Browse files
authored
Migrate to uv environment management (#9)
1 parent e460257 commit 7b4a000

7 files changed

Lines changed: 49 additions & 42 deletions

File tree

‎.github/workflows/python.yml‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,21 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Setup Python
15-
uses: actions/setup-python@v3
15+
uses: actions/setup-python@v6
1616
with:
1717
python-version: "3.14"
1818
- name: Setup just
1919
uses: extractions/setup-just@v3
20-
- name: Install requirements
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
22+
with:
23+
enable-cache: true
24+
- name: Setup environment
2125
run: |
22-
python3 -m venv .venv
23-
source .venv/bin/activate
24-
25-
python3 -m pip install --upgrade pip
26-
pip install -r requirements.txt
27-
- name: Lint project
26+
just sync
27+
- name: Lint
2828
run: |
29-
source .venv/bin/activate
3029
just lint
31-
- name: Run unit tests
30+
- name: Unit tests
3231
run: |
33-
source .venv/bin/activate
3432
just test

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# Ruff
132+
.ruff_cache

‎Brewfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brew "just"
2+
brew "uv"

‎README.md‎

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,35 @@
11
# Python Project Template ![](https://github.com/ahcode0919/python-project-template/actions/workflows/ci.yml/badge.svg?branch=main)
22

3-
43
Baseline Python project template
54

65
## Setup
76

87
Project supports local development and VSCode Dev container development
98

10-
### Local development
9+
### Local Development Installation
10+
11+
Note: Project uses `uv` and `just` to manage project configuration and commands
1112

12-
- Recommended
13-
- Install [`pyenv`](https://github.com/pyenv/pyenv)
14-
- Install current Python version: `pyenv install 3.14.2`
15-
- Set global Python version: `pyenv global 3.14.2`
16-
- Or Install with Homebrew
17-
- Install python 3 `brew install python3`
18-
- Initialize virtual environment: `python3 -m venv .venv`
19-
- Activate: `source .venv/bin/activate`
20-
- Install packages: `pip install -r requirements.txt`
13+
* Install dependencies via Homebrew - `brew bundle install`
14+
* Sync project - `just sync`
2115

2216
### VS Code Dev Container
2317

24-
- Install Docker
25-
- Install VSCode
26-
- Open project folder in VS Code
27-
- Install recommended extensions
28-
- Reopen in container using Remote Development Container menu
18+
* Install Docker
19+
* Install VSCode
20+
* Open project folder in VS Code
21+
* Install recommended extensions
22+
* Reopen in container using Remote Development Container menu
2923

3024
## Project Commands
3125

32-
- Local
33-
- `just lint` - lint project files
34-
- Dev container
35-
- `just lint` - lint and stylecheck project files
36-
- Run unit tests: `just test`
26+
* Local
27+
* `just lint` - lint project files
28+
* Dev container
29+
* `just lint` - lint and stylecheck project files
30+
* Run unit tests: `just test`
31+
* Install dependency: `uv add {package}`
3732

3833
## Usage
3934

40-
- Usage Notes
41-
42-
## Update Dependencies
43-
44-
- Install dependency: `pip install {dependency}`
45-
- Update requirements file: `pip freeze > requirements.txt`
35+
* Usage Notes

‎justfile‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
lint:
2-
ruff check . --fix && ruff format .
2+
uv run ruff check . --fix
3+
uv run ruff format .
4+
sync:
5+
uv sync --all-groups
36
test:
4-
pytest
7+
uv run pytest

‎pyproject.toml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
[project]
2+
name = "example"
3+
version = "0.0.1"
4+
requires-python = ">=3.14"
5+
6+
dependencies = []
7+
8+
[dependency-groups]
9+
dev = ["pytest", "ruff>=0.16.0"]
10+
11+
[tool.pytest.ini_options]
12+
pythonpath = ["."]
13+
114
[tool.ruff]
215
line-length = 100
316
target-version = "py312"

‎pytest.ini‎

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

0 commit comments

Comments
 (0)