From 900a9196fda7d984cf962533f8b17e718ae8a12d Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 11 Mar 2025 21:50:49 +0000 Subject: [PATCH] chore: switch to UV --- .github/workflows/tests.yaml | 13 ++++++++----- .gitignore | 33 +++++---------------------------- .pre-commit-config.yaml | 10 ++++------ README.md | 2 +- pyproject.toml | 34 ++++++++++++++-------------------- 5 files changed, 32 insertions(+), 60 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1369a3b..753830e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,17 +14,20 @@ jobs: - name: 🛎️ Check out repository uses: actions/checkout@v4 - - name: 📦 Set up Poetry - run: pipx install poetry==2.0.0 + - name: 📦 Set up UV + uses: astral-sh/setup-uv@v5 + with: + version: "0.6.5" + enable-cache: true - name: 🐍 Set up Python uses: actions/setup-python@v5 with: python-version: 3.11 - cache: poetry + python-version-file: "pyproject.toml" - name: 🔨 Install dependencies - run: poetry install --without dev + run: uv sync --group test - name: ✅ Run unit tests - run: poetry run pytest -vvv + run: uv run pytest -vvv diff --git a/.gitignore b/.gitignore index 2e6f168..f8efb21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ -# IntelliJ project files +# IDE and system files +.vscode/ .idea/ +.DS_Store + +# IntelliJ project files .run/ *.iml out @@ -89,33 +93,6 @@ target/ profile_default/ ipython_config.py -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f11d036..999a8bf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- ci: autoupdate_schedule: quarterly - skip: ["identity", "poetry-lock", "pytest", "coverage-badge"] + skip: ["identity", "uv-lock", "pytest", "coverage-badge"] repos: - repo: meta @@ -31,12 +31,10 @@ repos: - id: check-ast name: Validate Python - - repo: https://github.com/python-poetry/poetry - rev: 2.0.0 + - repo: https://github.com/astral-sh/uv-pre-commit + rev: 0.6.5 hooks: - - id: poetry-check - name: Check that the Poetry configuration is valid - - id: poetry-lock + - id: uv-lock name: Check that the lock file is up-to-date # Formatting diff --git a/README.md b/README.md index fbafe09..2dc8b29 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
[![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)](https://www.python.org/downloads/release/python-3110/) -[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/) +[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv) [![tests](https://github.com/Bilbottom/python-template/actions/workflows/tests.yaml/badge.svg)](https://github.com/Bilbottom/python-template/actions/workflows/tests.yaml) [![coverage](coverage.svg)](https://github.com/dbrgn/coverage-badge) [![GitHub last commit](https://img.shields.io/github/last-commit/Bilbottom/python-template)](https://shields.io/badges/git-hub-last-commit) diff --git a/pyproject.toml b/pyproject.toml index b5e68e8..4fcb771 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + [project] name = "python-template" version = "0.0.0" @@ -5,27 +9,17 @@ description = "" authors = [{name = "Bilbottom"}] readme = "README.md" requires-python = ">=3.11" -dynamic = ["dependencies"] - -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" - +dependencies = [] -[tool.poetry] -packages = [{include = "src"}] - -[tool.poetry.group] -dev.optional = false -test.optional = false - -[tool.poetry.group.dev.dependencies] -coverage-badge = "^1.1.0" -pre-commit = "^3.6.2" - -[tool.poetry.group.test.dependencies] -pytest = "^8.0.2" -pytest-cov = "^4.1.0" +[dependency-groups] +dev = [ + "coverage-badge>=1.1.0", + "pre-commit>=4.1.0", +] +test = [ + "pytest>=8.3.5", + "pytest-cov>=6.0.0", +] [tool.pytest.ini_options]