Skip to content

Commit 046073e

Browse files
authored
Merge pull request #8 from LeakIX/dw/update-dev-deps-py-project
Update dev deps + better CI
2 parents da96936 + f3f9ebd commit 046073e

5 files changed

Lines changed: 51 additions & 14 deletions

File tree

.github/workflows/action.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ jobs:
2121
run: poetry --help
2222
- name: Run poetry install
2323
run: poetry install
24-
- name: Run tests
25-
run: poetry run pytest tests
26-
- name: Run black
27-
run: poetry run black l9format/*.py tests/*.py --check
28-
- name: Run poetry build
29-
run: poetry build
24+
- name: lint
25+
run: poetry run ruff check .
26+
- name: format check
27+
run: poetry run black --check .
28+
- name: sort-check
29+
run: poetry run isort --check-only .
30+
- name: test
31+
run: poetry run pytest
32+
- name: security-audit
33+
run: poetry run pip-audit
3034

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Makefile for pygins project
2+
3+
.PHONY: test format sort lint security-check all
4+
5+
# Run all quality checks
6+
all: test format sort lint security-check
7+
8+
# Run tests using pytest
9+
test:
10+
poetry run pytest
11+
12+
# Format code using black
13+
format:
14+
poetry run black .
15+
16+
# Sort imports using isort
17+
sort:
18+
poetry run isort .
19+
20+
# Lint code using ruff
21+
lint:
22+
poetry run ruff check .
23+
24+
# Check for vulnerable dependencies using pip-audit
25+
security-check:
26+
poetry run pip-audit
27+

l9format/l9format.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import decimal
2+
23
from serde import Model, fields
34

5+
46
# Import from https://github.com/rossmacarthur/serde/commit/304884bca3c80e8b9a22a054b64dd94e3324b593#diff-dd2f65f16516311f0183377201a3d0b7894438787da732fc2bbc9c28cbde9fb8
57
# A helper function...
68
def round_decimal(
@@ -48,7 +50,7 @@ def deserialize(self, value) -> decimal.Decimal:
4850

4951
return decimal.Decimal(value)
5052
except decimal.DecimalException:
51-
raise ValidationError("invalid decimal", value=value)
53+
raise Exception("invalid decimal", value=value)
5254

5355

5456
class L9HttpEvent(Model):

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ python = "^3.9"
1919
# Bump up to python 3.11 fixes the issue as it seems fixed in the stdlib of 3.11
2020
serde = "^0.8.1"
2121

22-
[tool.poetry.dev-dependencies]
23-
pytest = "*"
24-
black = "^22"
25-
mypy = "*"
22+
[tool.poetry.group.dev.dependencies]
23+
black = "^24.10.0"
24+
fire = "^0.7.0"
25+
isort = "^5.12.0"
26+
pip-audit = "^2.7.3"
27+
pytest = "^8.3.4"
28+
ruff = "^0.9.2"
2629

2730
[build-system]
2831
requires = ["poetry-core>=1.0.0"]

tests/test_l9format.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from l9format import l9format
2-
from pathlib import Path
3-
import os
41
import json
2+
import os
3+
from pathlib import Path
4+
5+
from l9format import l9format
56

67
TESTS_DIR = Path(os.path.dirname(__file__))
78

0 commit comments

Comments
 (0)