Skip to content

Commit

Permalink
build: use uv (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
malteo authored Dec 20, 2024
1 parent ec47425 commit 92ee35b
Show file tree
Hide file tree
Showing 7 changed files with 369 additions and 31 deletions.
49 changes: 27 additions & 22 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,40 @@ name: Python application

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.7"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
uvx flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
uvx flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
uv run pytest
2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
python = "3.12"
"pipx:uv" = "latest"
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[project]
name = "syndication-python-template"
version = "0.1.0"
description = "Example Python/FastAPI application that handles the Cloudesire syndication API"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"fastapi-slim==0.115.6",
"httpx==0.27.2",
"pydantic-settings==2.7.0",
"python-dotenv==1.0.1",
]

[dependency-groups]
dev = [
"pytest>=8.3.4",
"respx>=0.21.1",
"ruff>=0.8.2",
]
4 changes: 0 additions & 4 deletions requirements-dev.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

321 changes: 321 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit 92ee35b

Please sign in to comment.