Skip to content

Commit e5efa4b

Browse files
author
Nutchanon Ninyawee
committed
Refactor project configuration and linting setup
- Updated .mise.toml to streamline development tasks - Simplified linting and testing configurations - Removed redundant tasks and consolidated lint commands - Updated ruff configuration in pyproject.toml - Improved code formatting and linting rules
1 parent b0dc185 commit e5efa4b

7 files changed

Lines changed: 329 additions & 295 deletions

File tree

.mise.toml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
[tools]
2-
python = "3.8"
2+
uv = "latest"
3+
ruff = "latest"
34

45
[env]
56
'_'.file = ".env.yaml"
67

7-
[tasks.install]
8-
description = "Install dependencies"
9-
run = "uv pip install -e . && uv pip install pytest pytest-asyncio pytest-cov ruff mypy safety bandit"
10-
11-
[tasks.venv]
12-
description = "Setup a virtual environment with all dependencies"
13-
run = "python -m venv .venv && echo 'Created .venv. Activate with: source .venv/bin/activate (Linux/Mac) or .venv\\Scripts\\activate (Windows)'"
14-
158
[tasks.sync]
169
description = "Install all dependencies to the current environment from pyproject.toml"
1710
run = "uv sync"
@@ -22,23 +15,26 @@ run = "uv sync --dev"
2215

2316
[tasks.test]
2417
description = "Run tests"
25-
run = "uv run pytest"
18+
sources = ["tests"]
19+
run = "uv run pytest tests/"
2620

2721
[tasks.format]
2822
description = "Format code with ruff"
23+
sources = ["snap_html", "tests"]
2924
run = "uv run ruff format snap_html/ tests/ && uv run ruff check --fix snap_html/ tests/"
3025

3126
[tasks.lint]
3227
description = "Run all checks"
33-
run = "mise run test && mise run check-safety && mise run check"
28+
depends = ["lint:mypy", "lint:ruff"]
3429

35-
[tasks.check]
30+
[tasks."lint:mypy"]
3631
description = "Check code style with ruff and mypy"
37-
run = "uv run ruff check snap_html/ tests/ && uv run mypy --config-file setup.cfg snap_html tests/**/*.py"
32+
run = "uv run mypy --config-file setup.cfg snap_html tests/**/*.py"
33+
34+
[tasks."lint:ruff"]
35+
description = "Check code style with ruff"
36+
run = "uv run ruff check snap_html/ tests/"
3837

39-
[tasks.check-safety]
40-
description = "Run safety checks"
41-
run = "uv pip check && uv run safety check --full-report && uv run bandit -ll -r snap_html/"
4238

4339
[tasks.build]
4440
description = "Build package"

pyproject.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,11 @@ requires = ["hatchling"]
3434
build-backend = "hatchling.build"
3535

3636
[dependency-groups]
37-
dev = [
38-
"pytest>=6.2.1",
39-
"pytest-asyncio>=0.20.3",
40-
"pytest-cov>=4.1.0",
41-
"ruff>=0.2.0",
42-
]
37+
dev = ["pytest>=6.2.1", "pytest-asyncio>=0.20.3", "pytest-cov>=4.1.0"]
4338

4439
[tool.ruff]
4540
# Enable pycodestyle (E), Pyflakes (F), isort (I), and more
46-
line-length = 80
41+
line-length = 88
4742
target-version = "py38"
4843
select = [
4944
"E",
@@ -94,6 +89,14 @@ exclude = [
9489
"venv",
9590
]
9691

92+
[tool.ruff.lint]
93+
docstring-code-line-length = "dynamic"
94+
95+
[tool.ruff.lint.per-file-ignores]
96+
"__init__.py" = ["E402"]
97+
"**/{tests,docs,tools}/*" = ["S101"]
98+
99+
97100
[tool.ruff.format]
98101
quote-style = "double"
99102
indent-style = "space"
@@ -114,6 +117,7 @@ combine-as-imports = true
114117
[tool.ruff.pydocstyle]
115118
convention = "google"
116119

120+
117121
[tool.pytest.ini_options]
118122
markers = ["asyncio: mark test as async test"]
119123
addopts = "-v"

0 commit comments

Comments
 (0)