Skip to content

Commit 0cd59c1

Browse files
Migrate to UV
1 parent db4fa2e commit 0cd59c1

29 files changed

+2683
-3812
lines changed

.devcontainer.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
{
2-
"name": "andrew-codechimp/calendar-event",
3-
"image": "mcr.microsoft.com/devcontainers/python:dev-3.13",
2+
"name": "andrew-codechimp/calendar_event",
3+
"build": {"dockerfile": "Dockerfile"},
4+
"remoteUser": "vscode",
45
"features": {
5-
"ghcr.io/devcontainers/features/github-cli:1": {
6-
"installDirectlyFromGitHubRelease": true,
7-
"version": "latest"
8-
},
6+
"ghcr.io/devcontainers/features/git:1": {},
97
"ghcr.io/devcontainers/features/node:1": {
10-
"nodeGypDependencies": true,
11-
"version": "lts"
12-
},
13-
"ghcr.io/devcontainers-extra/features/poetry:2": {
14-
"version": "latest"
15-
},
16-
"ghcr.io/devcontainers/features/rust:1": {}
8+
"version": "lts"
9+
},
10+
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
11+
"packages": [
12+
"build-essential",
13+
"ffmpeg",
14+
"libpcap-dev",
15+
"libturbojpeg0"
16+
]
17+
}
1718
},
1819
"postCreateCommand": "scripts/setup",
20+
"runArgs": ["--network=host"],
1921
"forwardPorts": [8123],
2022
"portsAttributes": {
2123
"8123": {
@@ -35,7 +37,6 @@
3537
"settings": {
3638
"files.eol": "\n",
3739
"editor.tabSize": 4,
38-
"python.pythonPath": "/usr/bin/python3",
3940
"python.analysis.autoSearchPaths": false,
4041
"editor.formatOnPaste": false,
4142
"editor.formatOnSave": true,
@@ -52,6 +53,5 @@
5253
}
5354
}
5455
}
55-
},
56-
"remoteUser": "vscode"
56+
}
5757
}

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ updates:
66
schedule:
77
interval: "weekly"
88

9-
- package-ecosystem: "pip"
9+
- package-ecosystem: "uv"
1010
directory: "/"
1111
schedule:
1212
interval: "weekly"

.github/workflows/lint.yml

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,72 @@ name: "Lint"
33
on:
44
push:
55
paths:
6-
- '**.py' # Run if pushed commits include a change to a Python (.py) file.
7-
- '.github/workflows/lint.yml' # Run if pushed commits include a change to a github actions workflow file.
8-
- 'requirements.txt' # Run if pushed commits include a change to the Python requirements.txt file.
9-
- '.pyprogject.toml' # Run if project configuration file changes.
6+
- "**.py" # Run if pushed commits include a change to a Python (.py) file.
7+
- ".github/workflows/lint.yml" # Run if pushed commits include a change to a github actions workflow file.
8+
- "pyproject.toml" # Run if project configuration file changes.
109
pull_request:
1110
paths:
12-
- '**.py' # Run if pushed commits include a change to a Python (.py) file.
13-
- '.github/workflows/lint.yml' # Run if pushed commits include a change to a github actions workflow file.
14-
- 'requirements.txt' # Run if pushed commits include a change to the Python requirements.txt file.
15-
- '.pyprogject.toml' # Run if project configuration file changes.
11+
- "**.py" # Run if pushed commits include a change to a Python (.py) file.
12+
- ".github/workflows/lint.yml" # Run if pushed commits include a change to a github actions workflow file.
13+
- "pyproject.toml" # Run if project configuration file changes.
1614
workflow_dispatch:
1715

1816
jobs:
19-
build:
20-
runs-on: "ubuntu-latest"
21-
strategy:
22-
matrix:
23-
python-version: ["3.13"]
17+
ruff_check:
18+
runs-on: ubuntu-latest
19+
2420
steps:
25-
- name: Checkout repo
26-
uses: actions/checkout@v5
21+
- name: Checkout code
22+
uses: actions/checkout@v5
23+
24+
- name: Ruff Check
25+
uses: astral-sh/ruff-action@v3
26+
with:
27+
args: check --output-format=github
28+
29+
- name: Ruff Format
30+
uses: astral-sh/ruff-action@v3
31+
with:
32+
args: format --check --diff
33+
34+
# mypy:
35+
# runs-on: ubuntu-latest
36+
37+
# steps:
38+
# - name: Checkout code
39+
# uses: actions/checkout@v5
40+
41+
# - name: Install uv
42+
# uses: astral-sh/setup-uv@v5
43+
44+
# - name: Set up Python
45+
# uses: actions/setup-python@v5
46+
# with:
47+
# python-version-file: "pyproject.toml"
48+
49+
# - name: Install dependencies
50+
# run: uv sync
51+
52+
# - name: Run mypy
53+
# run: uv run mypy
54+
55+
tests:
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v5
61+
62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v5
2764

28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v6
30-
with:
31-
python-version: ${{ matrix.python-version }}
65+
- name: Set up Python
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version-file: "pyproject.toml"
3269

33-
- name: Install dependencies from requirements.txt
34-
run: |
35-
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi
70+
- name: Install dependencies
71+
run: uv sync
3672

37-
- name: Analyse the code with ruff
38-
run: |
39-
python3 -m ruff check .
73+
- name: Run tests
74+
run: uv run pytest

.github/workflows/pull.yaml

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

.github/workflows/push.yaml

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

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ __pycache__
44
*.egg-info
55
*/build/*
66
*/dist/*
7-
7+
.venv
8+
.ruff_cache
89

910
# misc
1011
.coverage

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13.2

.vscode/launch.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"configurations": [
77
{
88
"name": "Home Assistant",
9-
"type": "python",
9+
"type": "debugpy",
1010
"request": "launch",
1111
"module": "homeassistant",
1212
"justMyCode": true,
@@ -19,16 +19,18 @@
1919
{
2020
// Example of attaching to my production server
2121
"name": "Python: Attach Remote",
22-
"type": "python",
22+
"type": "debugpy",
2323
"request": "attach",
24-
"port": 5678,
25-
"host": "localhost",
24+
"connect": {
25+
"host": "localhost",
26+
"port": 5678
27+
},
2628
"pathMappings": [
2729
{
2830
"localRoot": "${workspaceFolder}",
2931
"remoteRoot": "/usr/src/homeassistant"
3032
}
31-
],
33+
]
3234
}
3335
]
34-
}
36+
}

.vscode/settings.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2-
"[python]": {
3-
"editor.defaultFormatter": "charliermarsh.ruff"
2+
"git.autofetch": true,
3+
"python.createEnvironment.trigger": "off",
4+
"editor.defaultFormatter": "charliermarsh.ruff",
5+
"editor.formatOnSave": true,
6+
"editor.codeActionsOnSave": {
7+
"source.organizeImports": "always",
48
},
5-
"terminal.integrated.env.linux": {
6-
"PYTHONPATH": "${workspaceRoot}"
7-
}
8-
}
9+
"python.terminal.activateEnvInCurrentTerminal": true,
10+
}

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
],
2525
}
2626
]
27-
}
27+
}

0 commit comments

Comments
 (0)