cloud-run-job-base/readme/python_init.md
2025-12-04 02:29:19 +09:00

55 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Python Project
## 仮想環境を構築する
### venvで構築する
```sh
python3 -m venv .venv
# Linux
source .venv/bin/activate
# Windows
# .venv/Scripts/activate
pip install -r requirements.txt
# For Develop(Tests,Docs)
pip install -r requirements-dev.txt
```
### uvで構築する
プロジェクトを生成する場合
```bash
uv init <ProjectName>
# --pythonまたは-pにバージョンを指定できます
# uv init <ProjectName> -p 3.10とすると">=3.10,<3.11"となる
```
```sh
uv sync
```
## Linter
### ruffライブラリの場合
RuffFlake8 のルールを多数サポートしています。
ruff.tomlで設定できます
```toml
select = ["E", "W"]
line-length = 88
```
| 分類 | コード | 内容 |
| ---- | ------ | ----------------------------------- |
| W | W291 | 末尾スペースtrailing whitespace |
| | W293 | ファイル末尾の空行の空白 |
| E | E303 | 空行が多すぎる |
| | E501 | 行が長すぎる |