Skip to content

Commit eabe281

Browse files
committed
chore: add pre-commit config
1 parent 7184f3a commit eabe281

File tree

4 files changed

+740
-95
lines changed

4 files changed

+740
-95
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.14.0
4+
hooks:
5+
- id: ruff-check
6+
args: [--fix]
7+
- id: ruff-format

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
args := $(wordlist 2, 100, $(MAKECMDGOALS))
2+
3+
.DEFAULT:
4+
@echo "No such command (or you pass two or many targets to ). List of possible commands: make help"
5+
6+
.DEFAULT_GOAL := help
7+
8+
##@ Local development
9+
10+
.PHONY: help
11+
help: ## Show this help
12+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target> <arg=value>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m %s\033[0m\n\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
13+
14+
.PHONY: venv
15+
venv: ## Create a new virtual environment
16+
@uv venv
17+
18+
.PHONY: check_venv
19+
check_venv: ## Check that virtual environment is activated
20+
@if [ -z $$VIRTUAL_ENV ]; then \
21+
echo "Error: Virtual environment is not activated"; \
22+
exit 1; \
23+
fi
24+
25+
.PHONY: init
26+
init: ## Install all project dependencies with extras
27+
@$(MAKE) check_venv
28+
@uv sync --all-extras
29+
30+
.PHONY: run_infra
31+
run_infra: ## Run rabbitmq in docker for integration tests
32+
@docker compose -f docker-compose.yml up -d
33+
34+
##@ Code quality
35+
36+
.PHONY: lint
37+
lint: ## Run linting
38+
@uv run ruff check .
39+
@uv run mypy
40+
41+
.PHONY: format
42+
format: ## Run formatting
43+
@uv run ruff check . --fix
44+
45+
##@ Testing
46+
47+
.PHONY: test
48+
test: ## Run all pytest tests
49+
@uv run pytest tests
50+
51+
.PHONY: test_cov
52+
test_cov: ## Generate test coverage report
53+
@pytest --cov='src' --cov-report=html
54+
55+
56+
.PHONY: test_install
57+
test_install: ## Verify package installation by importing it
58+
@uv run --with taskiq-postgres --no-project -- python -c "import taskiq_pg"

pyproject.toml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[project]
22
name = "taskiq-postgres"
3-
version = "0.0.0"
3+
version = "0.2.0"
44
description = "PostgreSQL integration for taskiq"
5+
summary = "PostgreSQL integration for taskiq"
56
readme = "README.md"
67
classifiers = [
78
"Development Status :: 5 - Production/Stable",
@@ -29,9 +30,8 @@ keywords = ["taskiq", "tasks", "distributed", "async", "postgresql"]
2930
authors = [
3031
{name = "Anfimov Dima", email = "lovesolaristics@gmail.com"}
3132
]
32-
requires-python = ">=3.9"
33+
requires-python = ">=3.9,<3.14"
3334
dependencies = [
34-
"aiopg>=1.4.0",
3535
"taskiq>=0.11.17",
3636
]
3737

@@ -49,15 +49,25 @@ asyncpg = [
4949
psqlpy = [
5050
"psqlpy>=0.10.1",
5151
]
52+
5253
[dependency-groups]
5354
dev = [
54-
"ruff>=0.11.9",
55-
"pytest>=8.3.5",
56-
"pytest-asyncio>=0.26.0",
57-
"mypy>=1.15.0",
58-
"asyncpg-stubs>=0.30.1",
55+
"ruff>=0.14.0",
56+
"pytest>=8.4.2",
57+
"pytest-asyncio>=1.1.0",
58+
"mypy>=1.18.1",
59+
"asyncpg-stubs>=0.30.2",
60+
"mkdocs-material>=9.6.21",
61+
"prek>=0.2.4",
5962
]
6063

64+
[build-system]
65+
requires = ["uv_build>=0.8.14,<0.9.0"]
66+
build-backend = "uv_build"
67+
68+
[tool.uv.build-backend]
69+
module-name = "taskiq_pg"
70+
6171
[tool.pytest.ini_options]
6272
pythonpath = [
6373
"."
@@ -120,8 +130,16 @@ known-local-folder = ["taskiq_pg"]
120130
lines-after-imports = 2
121131

122132
[tool.mypy]
123-
check_untyped_defs = true
124-
disallow_incomplete_defs = true
125-
disallow_untyped_defs = true
133+
python_version = "3.12"
134+
modules = "taskiq_pg"
135+
exclude_gitignore = true
136+
platform = "linux"
137+
follow_imports = "normal"
126138
ignore_missing_imports = false
127-
no_implicit_optional = true
139+
mypy_path = "stubs"
140+
disallow_untyped_defs = true
141+
warn_return_any = true
142+
warn_unreachable = true
143+
warn_no_return = true
144+
warn_unused_ignores = true
145+
warn_redundant_casts = true

0 commit comments

Comments
 (0)