Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
feat: lower python version to run to 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinNitroG committed Jan 7, 2025
1 parent 2428ae8 commit e211af1
Show file tree
Hide file tree
Showing 15 changed files with 919 additions and 29 deletions.
11 changes: 9 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ repos:
- id: check-added-large-files
- id: detect-private-key

# For upgrading python syntax
# - repo: https://github.com/asottile/pyupgrade
# rev: v3.19.1
# hooks:
# - id: pyupgrade

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff
args: [--fix]
args: ['--fix', '--unsafe-fixes']
- id: ruff-format

- repo: https://github.com/commitizen-tools/commitizen
Expand All @@ -42,7 +48,8 @@ repos:
- id: uv-sync
- id: uv-lock # update lock file
- id: uv-export # export lock file to requirements.txt
args: ['--no-dev', '--frozen', '--output-file=requirements.txt']
args:
['--no-dev', '--frozen', '--output-file=requirements.txt', '--quiet']

- repo: local
hooks:
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
> [!NOTE]
>
> Project được viết bằng python 3.13
> Project được viết bằng python 3.13 nhưng có thể chạy với python 3.10 trở lên (không đảm bảo)
---

Expand Down Expand Up @@ -70,11 +70,24 @@ uv run generate-schemas
uv run generate-config-schema
```

- Test on production with python 3.10

```
uv python install 3.10
uv venv .venv-3.10 -p 3.10
uv pip install -e . -r ./requirements.txt
uv run check-phat-nguoi
```

### DISCLAIMER

1. Không bảo đảm
> [!IMPORTANT]
>
> Repo được phát hành với mục đích học tập và tham khảo. Tác giả không chịu trách nhiệm đối với bất kỳ hành vi sử dụng nào có thể gây ảnh hưởng tiêu cực đến cá nhân, tổ chức khác hoặc vi phạm pháp luật Việt Nam.
1. Không đảm bảo

- Mã nguồn và tài nguyên trong repo này được cung cấp mà không có bất kỳ bảo đảm nào, dù rõ ràng hay ngụ ý.
- Mã nguồn và tài nguyên trong repo này được cung cấp mà không có bất kỳ đảm bảo nào, dù rõ ràng hay ngụ ý.
- Không có sự đảm bảo rằng mã nguồn sẽ hoạt động chính xác, đáng tin cậy, hoặc phù hợp với bất kỳ mục đích cụ thể nào. Người sử dụng tự chịu toàn bộ rủi ro khi sử dụng các tài nguyên này.

2. Không phải sản phẩm chính thức
Expand All @@ -85,10 +98,6 @@ uv run generate-config-schema

- Trừ khi được chỉ định khác, toàn bộ nội dung trong repo này được cấp phép theo các điều khoản trong tệp [`LICENSE`](./LICENSE). Khi sử dụng mã nguồn hoặc tài nguyên, người dùng cần tuân thủ đầy đủ các quy định của giấy phép này.

> [!IMPORTANT]
>
> Kho lưu trữ này được phát hành với mục đích học tập và tham khảo. Tác giả không chịu trách nhiệm đối với bất kỳ hành vi sử dụng nào có thể gây ảnh hưởng tiêu cực đến cá nhân, tổ chức khác hoặc vi phạm pháp luật Việt Nam.
### APIs

> [!NOTE]
Expand Down
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ authors = [
description = "Check phạt nguội"
name = "check-phat-nguoi"
version = "0.1.0-dev.1"
requires-python = ">=3.13"
dependencies = [
"aiohttp[speedups]>=3.11.11",
"pydantic>=2.10.4",
]
requires-python = ">=3.10"
dependencies = ["aiohttp[speedups]>=3.11.11", "pydantic>=2.10.4"]

[project.scripts]
check-phat-nguoi = "check_phat_nguoi:main"
Expand All @@ -22,4 +19,6 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
dev = ["pre-commit>=4.0.1"]
dev = [
"pre-commit>=4.0.1",
]
428 changes: 419 additions & 9 deletions requirements.txt

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[lint]
select = [
"I", # Isort
"F401", # Unused imports
"I", # Isort
"F401", # Unused imports
"FA100", # future-rewritable-type-annotation
"FA102", # future-required-type-annotation
]
2 changes: 1 addition & 1 deletion src/check_phat_nguoi/config/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def _config_reader() -> ConfigDTO:
for config_path in CONFIG_PATHS:
if path_exists(config_path):
try:
with open(config_path, "r", encoding="utf8") as config:
with open(config_path, encoding="utf8") as config:
data = load(config)
return ConfigDTO(**data)
except ValidationError as e:
Expand Down
2 changes: 2 additions & 0 deletions src/check_phat_nguoi/config/dto/plate_info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Any, override

from pydantic import BaseModel, ConfigDict, Field
Expand Down
2 changes: 2 additions & 0 deletions src/check_phat_nguoi/context/plates/models/plate_info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Any, override

from pydantic import BaseModel, Field
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from pydantic import BaseModel, Field


Expand Down
2 changes: 2 additions & 0 deletions src/check_phat_nguoi/context/plates/models/violation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from datetime import datetime
from typing import Literal

Expand Down
2 changes: 2 additions & 0 deletions src/check_phat_nguoi/get_data/engines/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from abc import abstractmethod
from typing import Final, Self

Expand Down
2 changes: 2 additions & 0 deletions src/check_phat_nguoi/get_data/engines/check_phat_nguoi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
import re
from asyncio import TimeoutError
Expand Down
2 changes: 2 additions & 0 deletions src/check_phat_nguoi/notify/markdown_msg/md_msg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from check_phat_nguoi.config.config_reader import config
from check_phat_nguoi.constants import (
MESSAGE_MARKDOWN_PATTERN,
Expand Down
4 changes: 3 additions & 1 deletion src/check_phat_nguoi/utils/singleton.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Self


Expand All @@ -6,7 +8,7 @@ class Singleton:

def __new__(cls, *args, **kwargs) -> Self:
if not cls._instance:
cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs)
cls._instance = super().__new__(cls, *args, **kwargs)
return cls._instance


Expand Down
Loading

0 comments on commit e211af1

Please sign in to comment.