diff --git a/docs/usage/schedule-run.md b/docs/usage/advanced/schedule-run.md similarity index 100% rename from docs/usage/schedule-run.md rename to docs/usage/advanced/schedule-run.md diff --git a/docs/usage/from-source/index.md b/docs/usage/from-source/index.md new file mode 100644 index 0000000..4969cad --- /dev/null +++ b/docs/usage/from-source/index.md @@ -0,0 +1,13 @@ +# From source + +Có thể sử dụng: + +- pip (Chỉ cần cài python) +- uv (Cài uv) +- uv và just (Cài uv và just) + +## Clone repo + +```sh +git clone https://github.com/NTGNguyen/check-phat-nguoi.git +``` diff --git a/docs/usage/from-source/pip.md b/docs/usage/from-source/pip.md new file mode 100644 index 0000000..e922286 --- /dev/null +++ b/docs/usage/from-source/pip.md @@ -0,0 +1,61 @@ +# Pip + +## Yêu cầu + +- [Python](https://www.python.org/downloads/) (>=3.13) + +--- + +## Cài đặt dependencies + +### Thiết lập môi trường ảo + +#### Tạo môi trường ảo + +```sh +python -m venv .venv +``` + +#### Kích hoạt môi trường ảo + +=== "Windows" + + ```powershell + .venv\Scripts\activate + ``` + +=== "Unix / MacOS" + + ```sh + source .venv/bin/activate + ``` + +#### Cài đặt dependencies + +```sh +pip install -r requirements/requirements.txt +``` + +???- info "Tắt môi trường ảo" + + Để tắt môi trường khi không sử dụng chạy `deactivate` + +--- + +## Chạy chương trình + +!!! important "" + + Yêu cầu kích hoạt venv + +=== "Trực tiếp" + + ```sh + check-phat-nguoi + ``` + +=== "Python module" + + ```sh + python -m check-phat-nguoi + ``` diff --git a/docs/usage/from-source/uv-just.md b/docs/usage/from-source/uv-just.md new file mode 100644 index 0000000..cc87a2a --- /dev/null +++ b/docs/usage/from-source/uv-just.md @@ -0,0 +1,23 @@ +# uv & just + +## Yêu cầu + +!!! info "" + + Giống uv + +- [just](https://github.com/casey/just) + +## Chạy chương trình + +```sh +just +``` + +???+ info + + Just sẽ tự thiết lập môi trường và restore dependencies trước khi chạy. + +???+ danger + + Just restore tất cả các dependencies khiến môi trường nặng diff --git a/docs/usage/from-source/uv.md b/docs/usage/from-source/uv.md new file mode 100644 index 0000000..8b0987a --- /dev/null +++ b/docs/usage/from-source/uv.md @@ -0,0 +1,19 @@ +# uv + +## Yêu cầu + +- [uv](https://github.com/astral-sh/uv) + +## Thiết lập môi trường và dependencies + +```sh +uv sync --no-dev +``` + +## Chạy chương trình + +```sh +uv run check-phat-nguoi # (1) +``` + +1. Có thể thêm arg `--frozen` để không mutate lock file diff --git a/docs/usage/index.md b/docs/usage/index.md index 27a05cf..cc26353 100644 --- a/docs/usage/index.md +++ b/docs/usage/index.md @@ -2,7 +2,6 @@ ## Yêu cầu -- [Python](https://www.python.org/downloads/) - [Tesseact OCR CLI](https://tesseract-ocr.github.io/tessdoc/Installation.html) và [Tesseact data set](https://github.com/tesseract-ocr/tessdata) _(Không bắt buộc)_(1) { .annotate } @@ -12,88 +11,3 @@ - Hiện tại API từ csgt.vn không đảm bảo hoạt động. - checkphatnguoi.vn không cho truy cập từ IP nước ngoài? (Ảnh hưởng github action) - ---- - -## Clone repo - -```sh -git clone https://github.com/NTGNguyen/check-phat-nguoi.git -``` - ---- - -## Cài đặt dependencies - -### Thiết lập môi trường ảo - -#### Tạo môi trường ảo - -```sh -python -m venv .venv -``` - -#### Kích hoạt môi trường ảo - -=== "Windows" - - ```powershell - .venv\Scripts\activate - ``` - -=== "Unix / MacOS" - - ```sh - source .venv/bin/activate - ``` - -#### Cài đặt dependencies - -```sh -pip install -r requirements/requirements.txt -``` - -???- info "Tắt môi trường ảo" - - Để tắt môi trường khi không sử dụng chạy `deactivate` - ---- - -## Sử dụng chương trình - -### Thiết lập file config - -Thiết lập file `config.json` (1) -{ .annotate } - -1. Hoặc - - `check-phat-nguoi.config.json` tại nơi đang đứng - - `~/check-phat-nguoi.config.json` - -!!! info - - Xem [Config Schema](https://ntgnguyen.github.io/check-phat-nguoi/schemas/config.html) để biết chi tiết config - -??? example - - ```json title="config.json" - --8<-- "config.sample.json" - ``` - -### Chạy chương trình - -!!! important "" - - Yêu cầu kích hoạt venv - -=== "Trực tiếp" - - ```sh - check-phat-nguoi - ``` - -=== "Python module" - - ```sh - python -m check-phat-nguoi - ``` diff --git a/docs/usage/setup-config.md b/docs/usage/setup-config.md new file mode 100644 index 0000000..dc4ef52 --- /dev/null +++ b/docs/usage/setup-config.md @@ -0,0 +1,18 @@ +# Thiết lập file config + +Thiết lập file `config.json` (1) +{ .annotate } + +1. Hoặc + - `check-phat-nguoi.config.json` tại nơi đang đứng + - `~/check-phat-nguoi.config.json` + +!!! info + + Xem [Config Schema](https://ntgnguyen.github.io/check-phat-nguoi/schemas/config.html) để biết chi tiết config + +???+ example "Config mẫu" + + ```json title="config.json" + --8<-- "config.sample.json" + ``` diff --git a/mkdocs.yml b/mkdocs.yml index 7473b85..4f38faa 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -11,7 +11,14 @@ nav: - 'Trang chủ': index.md - 'Sử dụng': - usage/index.md - - usage/schedule-run.md + - usage/setup-config.md + - 'From source': + - usage/from-source/index.md + - usage/from-source/pip.md + - usage/from-source/uv.md + - usage/from-source/uv-just.md + - 'Nâng cao': + - usage/advanced/schedule-run.md - 'Config schema': 'https://ntgnguyen.github.io/check-phat-nguoi/schemas/config.html' - 'Development': - dev/setup.md @@ -24,8 +31,6 @@ nav: theme: language: vi - icon: - annotation: material/arrow-right-circle features: - navigation.instant - navigation.instant.progress