Skip to content

Commit 52973e9

Browse files
authored
Migrate to uv. (#53)
1 parent d323c13 commit 52973e9

8 files changed

+839
-51
lines changed

.github/workflows/nameless.yml

+24-8
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,30 @@ jobs:
2525
with:
2626
token: ${{ secrets.PAT }}
2727

28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v5
3030
with:
31-
python-version: ${{ matrix.python-version }}
32-
cache: "pip"
33-
cache-dependency-path: |
34-
**/requirements*.txt
31+
enable-cache: true
32+
cache-dependency-glob: "uv.lock"
33+
34+
- name: Pin Python version for uv
35+
run: |
36+
uv python pin ${{ matrix.python-version }}
37+
38+
- name: Set up Python ${{ matrix.python-version }}
39+
run: |
40+
uv python install
41+
42+
- name: Activate virtualenv
43+
run: |
44+
# https://stackoverflow.com/a/74669486
45+
uv venv
46+
source .venv/bin/activate
47+
echo PATH=$PATH >> $GITHUB_ENV
3548
3649
- name: Install dependencies
3750
run: |
38-
pip install -r requirements.txt
39-
pip install -r requirements.dev.txt
51+
uv sync --all-extras
4052
4153
- name: Create Prisma client
4254
run: |
@@ -56,3 +68,7 @@ jobs:
5668
if: ${{ matrix.python-version == '3.13' }}
5769
with:
5870
commit_message: "[ci skip] Automated code format commit."
71+
72+
- name: Minimize uv cache
73+
run: |
74+
uv cache prune --ci

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66

77
# Files should not not be exposed to the public
88
.env
9+
.python-version
910
nameless.sqlite
10-
nameless.cache
11+
nameless.cache

.vscode/settings.json

+2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@
1010
"nameless.sqlite": true,
1111
"nameless.cache": true,
1212
"nameless/command/__init__.py": true,
13+
".python-version": true,
14+
"uv.lock": true
1315
}
1416
}

nameless.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[nameless]
2-
version = "2025.01.22"
2+
version = "2025.01.24"
33
description = "Just a normal bot."
44
support_server = ""
55

pyproject.toml

+51-33
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
1-
[tool.basedpyright]
2-
exclude = ["venv", ".venv", "**/__pycache__"]
3-
reportUnnecessaryTypeIgnoreComment = "error"
4-
reportPrivateLocalImportUsage = "error"
5-
reportPrivateImportUsage = "error"
6-
reportPrivateUsage = "error"
7-
reportUnusedCallResult = "none"
8-
reportMissingTypeStubs = "none"
9-
reportCallInDefaultInitializer = "none"
10-
typeCheckingMode = "recommended"
11-
12-
[tool.ruff]
13-
line-length = 88
14-
indent-width = 4
15-
fix = true
16-
src = ["nameless"]
17-
18-
[tool.ruff.format]
19-
indent-style = "space"
20-
21-
[tool.ruff.lint]
22-
select = ["E", "F", "UP", "B", "SIM", "I", "Q", "TID", "D"]
23-
ignore = ["B018", "D1", "D417"]
24-
25-
[tool.ruff.lint.per-file-ignores]
26-
"__init__.py" = ["F403", "TID252"]
27-
"*" = ["B008", "F401", "F821", "F841"]
28-
29-
[tool.ruff.lint.flake8-tidy-imports]
30-
ban-relative-imports = "all"
31-
32-
[tool.ruff.lint.pydocstyle]
33-
convention = "numpy"
1+
[project]
2+
name = "nameless"
3+
version = "6.6.6"
4+
description = "A Discord BOT, written with batteries in mind."
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"audioop-lts==0.2.1 ; python_full_version >= '3.13'",
9+
"beautifulsoup4>=4.12.3",
10+
"discord-py>=2.4.0",
11+
"prisma>=0.15.0",
12+
"python-dotenv>=1.0.1",
13+
"requests>=2.32.3",
14+
"uv>=0.5.24",
15+
]
16+
17+
[dependency-groups]
18+
dev = ["basedpyright>=1.24.0", "ruff>=0.9.3"]
19+
20+
[tool.basedpyright]
21+
exclude = ["venv", ".venv", "**/__pycache__"]
22+
reportUnnecessaryTypeIgnoreComment = "error"
23+
reportPrivateLocalImportUsage = "error"
24+
reportPrivateImportUsage = "error"
25+
reportPrivateUsage = "error"
26+
reportUnusedCallResult = "none"
27+
reportMissingTypeStubs = "none"
28+
typeCheckingMode = "recommended"
29+
30+
[tool.ruff]
31+
line-length = 88
32+
indent-width = 4
33+
fix = true
34+
src = ["nameless"]
35+
36+
[tool.ruff.format]
37+
indent-style = "space"
38+
39+
[tool.ruff.lint]
40+
select = ["E", "F", "UP", "B", "SIM", "I", "Q", "TID", "D"]
41+
ignore = ["B018", "D1", "D417"]
42+
43+
[tool.ruff.lint.per-file-ignores]
44+
"__init__.py" = ["F403", "TID252"]
45+
"*" = ["B008", "F401", "F821", "F841"]
46+
47+
[tool.ruff.lint.flake8-tidy-imports]
48+
ban-relative-imports = "all"
49+
50+
[tool.ruff.lint.pydocstyle]
51+
convention = "numpy"

requirements.dev.txt

-2
This file was deleted.

requirements.txt

-6
This file was deleted.

uv.lock

+759
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)