Skip to content

Commit 2d567f4

Browse files
authored
refactor: switch to uv + update pre-commit hooks (#4)
1 parent fd38b14 commit 2d567f4

File tree

8 files changed

+687
-1104
lines changed

8 files changed

+687
-1104
lines changed

.github/ISSUE_TEMPLATE/config.yml

100755100644
File mode changed.

.github/ISSUE_TEMPLATE/feature_request.yml

100755100644
File mode changed.

.github/workflows/ruff.yaml

100755100644
File mode changed.

.pre-commit-config.yaml

100755100644
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,29 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v5.0.0
44
hooks:
5-
- id: trailing-whitespace
6-
args: [--markdown-linebreak-ext=md]
7-
- id: end-of-file-fixer
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-executables-have-shebangs
8+
- id: check-illegal-windows-names
9+
- id: check-merge-conflict
10+
- id: check-shebang-scripts-are-executable
811
- id: check-toml
912
- id: check-yaml
1013
- id: detect-private-key
14+
- id: end-of-file-fixer
15+
- id: name-tests-test
16+
args: [ --pytest-test-first ]
17+
- id: trailing-whitespace
18+
args: [ --markdown-linebreak-ext=md ]
19+
20+
- repo: https://github.com/pappasam/toml-sort
21+
rev: v0.24.2
22+
hooks:
23+
- id: toml-sort-fix
24+
files: ^(.*\.toml)$
1125

1226
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.7.2
27+
rev: v0.8.4
1428
hooks:
1529
- id: ruff
1630
args: [ --fix ]

bunkrr_uploader/logger.py

100755100644
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
from rich.logging import RichHandler
88
from rich.theme import Theme
99

10-
CONSOLE_THEME = Theme(
11-
{
12-
"logging.level.warning": "yellow",
13-
"logging.level.debug": "blue",
14-
"logging.level.info": "white",
15-
"logging.level.error": "red",
16-
},
17-
)
18-
10+
THEME_DICT = {
11+
"logging.level.warning": "yellow",
12+
"logging.level.debug": "blue",
13+
"logging.level.info": "white",
14+
"logging.level.error": "red",
15+
}
16+
CONSOLE_THEME = Theme(THEME_DICT)
1917
RICH_CONSOLE = Console(theme=CONSOLE_THEME)
2018
RICH_HANDLER_CONSOLE_CONFIG: dict = {"show_time": False, "rich_tracebacks": False, "tracebacks_show_locals": False}
2119
RICH_HANDLER_FILE_CONFIG: dict = {"show_time": True, "rich_tracebacks": True, "tracebacks_show_locals": True}

poetry.lock

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

pyproject.toml

Lines changed: 67 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
[tool.poetry]
1+
[project]
22
name = "bunkrr-uploader"
3-
version = "0.1.0"
3+
authors = [
4+
{name = "alexmi256"},
5+
{name = "NTFSvolume"}
6+
]
7+
dependencies = [
8+
"aiofiles>=24.1.0,<25",
9+
"aiohttp>=3.11.10,<4",
10+
"pydantic-settings>=2.7.0,<3",
11+
"pydantic>=2.10.4,<3",
12+
"rich>=13.9.4,<14",
13+
"tqdm>=4.67.1,<5",
14+
"yarl>=1.18.3,<2"
15+
]
416
description = "Async Bunkrr uploader"
5-
authors = ["NTFSvolume", "alexmi256"]
617
license = "MIT"
718
readme = "README.md"
19+
requires-python = ">=3.11,<3.13"
20+
version = "0.1.0"
821

9-
[build-system]
10-
requires = ["poetry-core"]
11-
build-backend = "poetry.core.masonry.api"
12-
13-
[tool.poetry.dependencies]
14-
python = ">=3.11,<3.13"
15-
aiofiles = "^24.1.0"
16-
aiohttp = "^3.11.10"
17-
tqdm = "^4.67.1 "
18-
rich = "^13.9.4"
19-
yarl = "^1.18.3"
20-
pydantic = "^2.10.4"
21-
pydantic-settings = "^2.7.0"
22-
23-
[tool.poetry.group.dev.dependencies]
24-
pre-commit = "^4.0.1"
25-
ruff = "^0.8.0"
26-
27-
[tool.poetry.scripts]
22+
[project.scripts]
2823
bunkrr-uploader = "bunkrr_uploader.main:main"
2924

3025
[tool.ruff]
@@ -33,25 +28,60 @@ target-version = "py311"
3328

3429
[tool.ruff.lint]
3530
select = [
36-
"E", # pycodestyle errors
37-
"W", # pycodestyle warnings
38-
"F", # pyflakes
39-
"I", # isort
40-
"B", # flake8-bugbear
41-
"C4", # flake8-comprehensions
42-
"UP", # pyupgrade
43-
"N", # PEP8 naming conventions
44-
"TCH", # flake8-type-checking
45-
"COM8", # flake8-commas linter
31+
"ASYNC", # async calls that do not await anything or use blocking methods
32+
"B", # flake8-bugbear
33+
"C4", # flake8-comprehensions
34+
"COM8", # flake8-commas linter
35+
"E", # pycodestyle errors
36+
"F", # pyflakes
37+
"FA102", # future annotations
38+
"I", # isort
39+
"N", # PEP8 naming conventions
40+
"PTH", # use pathlib instead of os
41+
"Q", # flake8-quotes
4642
"RUF", # RUF specific fixes
47-
"Q", # flake8-quotes
43+
"T20", # flake8-print
44+
"TC", # flake8-type-checking
45+
"TID", # flake8-tidy-imports
46+
"UP", # pyupgrade
47+
"W" # pycodestyle warnings
48+
]
49+
extend-safe-fixes = [
50+
"TC" # move import from and to TYPE_CHECKING blocks
4851
]
49-
5052
ignore = [
51-
"N806", # Uppercase variables in functions
52-
"E501", # Suppress line-too-long, let formatter decide
53-
"COM812", # missing-trailing-comma
53+
"COM812", # missing-trailing-comma
54+
"E501", # suppress line-too-long, let formatter decide
55+
"N806" # uppercase variables in functions
56+
]
57+
unfixable = [
58+
"ERA" # do not autoremove commented out code
5459
]
5560

61+
[tool.ruff.lint.per-file-ignores]
62+
"**/{tests,docs}/*" = [
63+
"E402", # imports not at the top of the file.
64+
"T20" # flake8-print
65+
]
66+
"__init__.py" = ["E402"] # imports not at the top of the file.
67+
5668
[tool.ruff.lint.pydocstyle]
5769
convention = "google"
70+
71+
[tool.tomlsort]
72+
all = true
73+
ignore_case = true
74+
in_place = true
75+
sort_first = ["name", "project", "select", "tool"]
76+
spaces_before_inline_comment = 2
77+
spaces_indent_inline_array = 4
78+
79+
[build-system]
80+
build-backend = "hatchling.build"
81+
requires = ["hatchling"]
82+
83+
[dependency-groups]
84+
dev = [
85+
"pre-commit>=4.0.1,<5",
86+
"ruff>=0.8.0,<0.9"
87+
]

0 commit comments

Comments
 (0)