From d9962f0c249409c0229fd59e03ae81027db8ccc4 Mon Sep 17 00:00:00 2001 From: Aaron <7063649+ahcode0919@users.noreply.github.com> Date: Mon, 27 Jul 2026 11:55:50 -0700 Subject: [PATCH] Migrate to uv environment management --- .github/workflows/python.yml | 20 ++++++++-------- .gitignore | 3 +++ Brewfile | 2 ++ README.md | 44 ++++++++++++++---------------------- justfile | 7 ++++-- pyproject.toml | 13 +++++++++++ pytest.ini | 2 -- 7 files changed, 49 insertions(+), 42 deletions(-) create mode 100644 Brewfile delete mode 100644 pytest.ini diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 35d85b7..11f7c79 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -12,23 +12,21 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v6 with: python-version: "3.14" - name: Setup just uses: extractions/setup-just@v3 - - name: Install requirements + - name: Install uv + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 + with: + enable-cache: true + - name: Setup environment run: | - python3 -m venv .venv - source .venv/bin/activate - - python3 -m pip install --upgrade pip - pip install -r requirements.txt - - name: Lint project + just sync + - name: Lint run: | - source .venv/bin/activate just lint - - name: Run unit tests + - name: Unit tests run: | - source .venv/bin/activate just test diff --git a/.gitignore b/.gitignore index 773b321..2c927c8 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ dmypy.json # Pyre type checker .pyre/ + +# Ruff +.ruff_cache \ No newline at end of file diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..f58ecdf --- /dev/null +++ b/Brewfile @@ -0,0 +1,2 @@ +brew "just" +brew "uv" \ No newline at end of file diff --git a/README.md b/README.md index 7e8fb8b..402f3dd 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,35 @@ # Python Project Template ![](https://github.com/ahcode0919/python-project-template/actions/workflows/ci.yml/badge.svg?branch=main) - Baseline Python project template ## Setup Project supports local development and VSCode Dev container development -### Local development +### Local Development Installation + +Note: Project uses `uv` and `just` to manage project configuration and commands -- Recommended - - Install [`pyenv`](https://github.com/pyenv/pyenv) - - Install current Python version: `pyenv install 3.14.2` - - Set global Python version: `pyenv global 3.14.2` - - Or Install with Homebrew - - Install python 3 `brew install python3` -- Initialize virtual environment: `python3 -m venv .venv` -- Activate: `source .venv/bin/activate` -- Install packages: `pip install -r requirements.txt` +* Install dependencies via Homebrew - `brew bundle install` +* Sync project - `just sync` ### VS Code Dev Container -- Install Docker -- Install VSCode -- Open project folder in VS Code -- Install recommended extensions -- Reopen in container using Remote Development Container menu +* Install Docker +* Install VSCode +* Open project folder in VS Code +* Install recommended extensions +* Reopen in container using Remote Development Container menu ## Project Commands -- Local - - `just lint` - lint project files -- Dev container - - `just lint` - lint and stylecheck project files -- Run unit tests: `just test` +* Local + * `just lint` - lint project files +* Dev container + * `just lint` - lint and stylecheck project files +* Run unit tests: `just test` +* Install dependency: `uv add {package}` ## Usage -- Usage Notes - -## Update Dependencies - -- Install dependency: `pip install {dependency}` -- Update requirements file: `pip freeze > requirements.txt` +* Usage Notes diff --git a/justfile b/justfile index 08ba629..bef3ba6 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,7 @@ lint: - ruff check . --fix && ruff format . + uv run ruff check . --fix + uv run ruff format . +sync: + uv sync --all-groups test: - pytest + uv run pytest \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2f93459..36eb485 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,16 @@ +[project] +name = "example" +version = "0.0.1" +requires-python = ">=3.14" + +dependencies = [] + +[dependency-groups] +dev = ["pytest", "ruff>=0.16.0"] + +[tool.pytest.ini_options] +pythonpath = ["."] + [tool.ruff] line-length = 100 target-version = "py312" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index a635c5c..0000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -pythonpath = .