Skip to content

Commit 8505f12

Browse files
committed
use uv instead of docker
1 parent 60ba486 commit 8505f12

12 files changed

Lines changed: 38 additions & 79 deletions

.githooks/pre-commit

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
#! /bin/bash -e
22

3-
docker build \
4-
--build-arg TAG="3.12" \
5-
--build-arg UID="$(id -u)" \
6-
--build-arg GID="$(id -g)" \
7-
-t python-amazon-paapi .
8-
93
touch .env
10-
11-
docker run -t --rm -u "$(id -u):$(id -g)" -v "${PWD}:/code" --env-file .env \
12-
python-amazon-paapi -c "python -m pre_commit"
4+
uv run --env-file .env pre-commit

.pre-commit-config.yaml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ default_language_version:
44
python: python3.12
55

66
repos:
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.14.11
9+
hooks:
10+
- id: ruff-format
11+
- id: ruff-check
12+
args: [--fix, --exit-non-zero-on-fix]
13+
714
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.6.0
15+
rev: v6.0.0
916
hooks:
1017
- id: trailing-whitespace
1118
- id: end-of-file-fixer
@@ -16,21 +23,21 @@ repos:
1623
- id: check-executables-have-shebangs
1724
- id: check-shebang-scripts-are-executable
1825
- id: check-toml
26+
- id: check-merge-conflict
27+
- id: debug-statements
1928
- id: name-tests-test
2029

21-
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.14.11
23-
hooks:
24-
- id: ruff-format
25-
- id: ruff-check
26-
args: [--fix, --exit-non-zero-on-fix]
27-
2830
- repo: https://github.com/lk16/detect-missing-init
2931
rev: v0.1.6
3032
hooks:
3133
- id: detect-missing-init
3234
args: ["--create", "--python-folders", "amazon_paapi"]
3335

36+
- repo: https://github.com/gitleaks/gitleaks
37+
rev: v8.30.0
38+
hooks:
39+
- id: gitleaks
40+
3441
- repo: https://github.com/pre-commit/mirrors-mypy
3542
rev: 'v1.19.1'
3643
hooks:
@@ -39,20 +46,9 @@ repos:
3946

4047
- repo: local
4148
hooks:
42-
# - id: mypy
43-
# name: Checking types with mypy
44-
# language: system
45-
# entry: "python -m mypy amazon_paapi"
46-
# pass_filenames: false
47-
4849
- id: test
4950
name: Running tests
5051
language: system
51-
entry: "python -m coverage run -m pytest -rs"
52-
pass_filenames: false
53-
54-
- id: test
55-
name: Checking coverage
56-
language: system
57-
entry: "python -m coverage report"
52+
entry: "uv run pytest -rs --cov=amazon_paapi"
53+
types_or: [python]
5854
pass_filenames: false

Dockerfile

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

Makefile

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
export UID:=$(shell id -u)
22
export GID:=$(shell id -g)
33

4-
export PYTHON_TAGS = 3.7 3.8 3.9 3.10 3.11 3.12
4+
export PYTHON_TAGS = 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15
55

66
setup:
77
@git config --unset-all core.hooksPath || true
88
@git config --local core.hooksPath .githooks
99

10-
build:
11-
@docker build --build-arg TAG="3.12" --build-arg UID="${UID}" --build-arg GID="${GID}" -t python-amazon-paapi .
12-
13-
coverage: build
10+
ensure-env:
1411
@touch .env
15-
@docker run -t --rm -u "${UID}:${GID}" -v "${PWD}:/code" --env-file .env python-amazon-paapi -c \
16-
"python -m coverage run -m pytest -rs && python -m coverage xml && python -m coverage report"
1712

18-
test: build
19-
@touch .env
20-
@docker run -t --rm -u "${UID}:${GID}" -v "${PWD}:/code" --env-file .env python-amazon-paapi -c "python -m pytest -rs"
13+
test: ensure-env
14+
@uv run --env-file .env pytest -rs
2115

22-
test-all-python-tags:
23-
@touch .env
16+
coverage: ensure-env
17+
@uv run pytest -rs --cov=amazon_paapi --cov-report=html --cov-report=term --cov-report=xml
18+
19+
test-all-python-tags: ensure-env
2420
@for tag in $$PYTHON_TAGS; do \
25-
docker build --build-arg TAG="$$tag" --build-arg UID="${UID}" --build-arg GID="${GID}" -t python-amazon-paapi .; \
26-
docker run -t --rm -u "${UID}:${GID}" -v "${PWD}:/code" python-amazon-paapi -c "python -m pytest -rs"; \
21+
uv run --env-file .env --python "$$tag" pytest -rs; \
2722
done
2823

29-
lint: build
30-
@touch .env
31-
@docker run --rm -t -u "${UID}:${GID}" -v "${PWD}:/code" --env-file .env python-amazon-paapi -c "python -m pre_commit run -a"
24+
lint:
25+
@uv run ruff check --fix .
26+
27+
mypy:
28+
@uv run mypy .
3229

33-
pre-commit:
34-
@./.githooks/pre-commit
30+
pre-commit: ensure-env
31+
@uv run --env-file .env pre-commit run -a

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ build-backend = "hatchling.build"
3232
packages = ["amazon_paapi"]
3333

3434
[dependency-groups]
35-
dev = ["pytest>=7.4.4"]
35+
dev = [
36+
"pytest>=7.4.4",
37+
"pytest-cov>=4.1.0",
38+
]
3639

3740
[tool.ruff]
3841
target-version = "py37"
File renamed without changes.

0 commit comments

Comments
 (0)