-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use pyproject.toml and uv publish pkg (#6)
* feat: use pyproject.toml and uv publish pkg * feat: use pyproject.toml and uv publish pkg * feat: use pyproject.toml and uv publish pkg * feat: use pyproject.toml and uv publish pkg
- Loading branch information
Showing
12 changed files
with
429 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: lint | ||
on: [push, pull_request] | ||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
|
||
- name: Lint | ||
if: matrix.python-version != '3.13' | ||
# 3.13 以下锁定版本 | ||
run: | | ||
uv sync --frozen | ||
uv run ruff check | ||
- name: Lint 3.13 | ||
if: matrix.python-version == '3.13' | ||
# 3.13 以上安装最新版本 | ||
run: | | ||
uv sync -U | ||
uv run ruff check | ||
- name: Test | ||
run: | | ||
uv run pytest -s tests/ | ||
- name: Build | ||
run: | | ||
uv build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,37 @@ | ||
[tool.poetry] | ||
[project] | ||
name = "bk-bscp" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
description = "The Python SDK for blueking bscp project." | ||
include = ["bk-bscp/py.typed"] | ||
readme = "readme.md" | ||
authors = ["blueking <[email protected]>"] | ||
license = "MIT" | ||
license = { file = "LICENSE.txt" } | ||
authors = [{ name = "blueking", email = "[email protected]" }] | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Programming Language :: Python :: 3 :: Only", | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
grpcio = "^1.60.0" | ||
typing-extensions = "^4.9.0" | ||
protobuf = "^4.25.2" | ||
|
||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"grpcio>=1.60.0", | ||
"protobuf>=4.25.2", | ||
"typing-extensions>=4.9.0", | ||
] | ||
[project.urls] | ||
Home = "https://github.com/TencentBlueKing/bscp-python-sdk" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
grpcio-tools = "^1.60.0" | ||
ruff = "^0.1.13" | ||
pytest = "^7.4.4" | ||
mypy = "^1.9.0" | ||
[dependency-groups] | ||
dev = ["grpcio-tools>=1.60.0", "mypy>=1.9.0", "pytest>=7.4.4", "ruff>=0.7.2"] | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
requires = ["setuptools>=61.0.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.ruff] | ||
line-length = 119 | ||
|
@@ -53,7 +58,7 @@ select = [ | |
# 理论上来说,ignore 规则列表中的条目越少越好。但在实际项目中,选择性地忽略某些规则常常是必须的。 | ||
# 下面收集了常见的待忽略规则集,并将其分为两类:“推荐忽略”和“谨慎忽略”。“推荐忽略”类中所包含的规 | ||
# 则,所有项目建议默认启用。“谨慎忽略”类中的规则,项目可酌情添加。 | ||
# | ||
# | ||
# 除此处列出的规则以外,不建议随意扩充忽略规则列表。 | ||
ignore = [ | ||
# === 推荐忽略 === | ||
|
@@ -86,14 +91,12 @@ ignore = [ | |
"N817", | ||
# pep8-naming: 忽略后,不强制要求异常类的名字必须以 Error 结尾 | ||
"N818", | ||
# perflint: 忽略后,不强制要求一定用推导式替代 for 循环,因为有时循环的可读性更好 | ||
# perflint: 忽略后,不强制要求一定用推导式替代 for 循环,因为有时循环的可读性更好 | ||
"PERF401", | ||
# perflint: 忽略后,允许在循环中使用 try except 代码块,因为这对性能影响微乎其微,有时可读性更好 | ||
"PERF203", | ||
# tryceratops: 忽略后,允许抛出异常时,使用较长的字符串作为异常信息,可能会降低异常的可使用性 | ||
"TRY003", | ||
# tryceratops: 忽略后,允许在 except 语句块中使用裸的 raise 语句,不要求必须使用 raise ... from | ||
"TRY200", | ||
# flake8-simplify: 忽略后,允许使用 exception: pass 语句,不要求必须用 contextlib.suppress 替换 | ||
"SIM105", | ||
# flake8-simplify: 忽略后,不强制要求用三元表达式替换普通的短 if-else 语句 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.