Skip to content

Commit aee7af2

Browse files
committed
chore: migrate to uv and ruff
1 parent fde3a04 commit aee7af2

28 files changed

+1113
-1199
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
11
{
22
"name": "Python 3",
3-
"image": "mcr.microsoft.com/devcontainers/python:1-3",
3+
"image": "mcr.microsoft.com/devcontainers/python:1-3.13",
44
"features": {
5-
"ghcr.io/devcontainers-contrib/features/pipenv:2": {}
6-
},
7-
"postCreateCommand": "pipenv install --dev --system",
8-
"customizations": {
9-
"vscode": {
10-
"extensions": [
11-
"ms-python.python",
12-
"ms-python.isort",
13-
"EditorConfig.EditorConfig",
14-
"eamodio.gitlens",
15-
"mhutchie.git-graph",
16-
"streetsidesoftware.code-spell-checker",
17-
"streetsidesoftware.code-spell-checker-german",
18-
"yzhang.markdown-all-in-one",
19-
"bierner.markdown-emoji",
20-
"DavidAnson.vscode-markdownlint"
21-
]
22-
}
23-
}
5+
"ghcr.io/va-h/devcontainers-features/uv:1": {}
6+
}
247
}

.github/workflows/python-ci.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,20 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- name: Set up Python 3
18-
id: setup-python
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version: "3.x"
22-
23-
- name: Install pipenv
24-
run: pip install pipenv
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
2519

26-
- name: Cache virtual environment
27-
uses: actions/cache@v4
28-
with:
29-
path: ~/.local/share/virtualenvs
30-
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
20+
- name: Set up Python
21+
run: uv python install
3122

3223
- name: Install dependencies
33-
run: pipenv install --dev
24+
run: uv sync --frozen
3425

3526
- name: Lint
36-
run: |
37-
pipenv run pylint scripts && \
38-
pipenv run pylint tests/*.py && \
39-
pipenv run pylint package.py
27+
run: uv run ruff check
4028

4129
- name: Test
42-
run: pipenv run pytest
30+
run: uv run pytest
4331

4432
analyze:
4533
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- name: Set up Python 3
19-
id: setup-python
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: "3.x"
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
20+
21+
- name: Set up Python
22+
run: uv python install
2323

2424
- name: Create packages
25-
run: python package.py
25+
run: uv run package.py
2626

2727
- name: Upload packages
2828
env:

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
__pycache__/
1+
.mypy_cache/
22
.pytest_cache/
3-
.venv
3+
.venv/
4+
__pycache__/
45
bin/
56
out/
7+
*.egg-info/
68
*.pyz

.python-version

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

.vscode/settings.json

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

Pipfile

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

Pipfile.lock

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

package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python3
22

3-
from pathlib import Path
43
import sys
54
import zipapp
5+
from pathlib import Path
66

77

88
def _create_archive(name: str, files: list[str]) -> None:

pyproject.toml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
[tool.pylint.master]
2-
init-hook = "import os, sys; sys.path.append(os.getcwd()); sys.path.append(os.path.join(os.getcwd(), 'scripts'))"
1+
[project]
2+
name = "python-scripts"
3+
description = "Various Python scripts"
4+
readme = "README.md"
5+
license = { text = "MIT" }
6+
dynamic = ["version"]
7+
requires-python = ">=3.13"
8+
dependencies = [
9+
"icalendar==5.0.12",
10+
"Scrapy==2.11.1",
11+
"selenium==4.20.0",
12+
"markdownify==0.12.1",
13+
"requests==2.31.0",
14+
"feedparser==6.0.11",
15+
]
316

4-
[tool.pylint.messages_control]
5-
disable = [
6-
"missing-docstring"
17+
[dependency-groups]
18+
dev = [
19+
"pytest==8.1.2",
20+
"ruff==0.9.10",
721
]
822

9-
[tool.mypy]
10-
mypy_path = "scripts"
23+
[tool.ruff.lint]
24+
extend-select = ["E", "W", "I", "B", "Q"]
1125

1226
[tool.pytest.ini_options]
1327
addopts = [

0 commit comments

Comments
 (0)