This commit is contained in:
student_2333 2024-11-16 22:11:51 +08:00
parent 75153acbc5
commit b925734181
No known key found for this signature in database
GPG Key ID: B36E8DF853C33EE1
7 changed files with 1222 additions and 447 deletions

24
.github/workflows/pre-commit.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Pre Commit Check
on:
push:
pull_request:
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Install project dependencies
run: |-
pdm config python.use_venv false
pdm --pep582
pdm pre-install
pdm install -G:all
- uses: pre-commit/action@v3.0.1

14
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,14 @@
repos:
- repo: https://github.com/DetachHead/basedpyright-pre-commit-mirror
rev: v1.13.0
hooks:
- id: basedpyright
language: system
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
hooks:
- id: ruff-format
- id: ruff
args: ['--fix']
- id: ruff-format

View File

@ -5,7 +5,7 @@
groups = ["default"] groups = ["default"]
strategy = ["inherit_metadata"] strategy = ["inherit_metadata"]
lock_version = "4.5.0" lock_version = "4.5.0"
content_hash = "sha256:58b9cabad0aef97f60e2e1974ac4d343dfe3109fb15d1e836f7ae19333f8ba39" content_hash = "sha256:2f74c56fbdcd0faabf96c80c486c987ddb72e2441143a8aa315fdae252e2b9ed"
[[metadata.targets]] [[metadata.targets]]
requires_python = "~=3.9" requires_python = "~=3.9"

View File

@ -19,8 +19,8 @@ dependencies = [
"githubkit>=0.11.14", "githubkit>=0.11.14",
"yarl>=1.17.1", "yarl>=1.17.1",
"tqdm>=4.66.6", "tqdm>=4.66.6",
"huggingface-hub>=0.26", "huggingface-hub>=0.26.2",
"ultralytics>=8.3", "ultralytics>=8.3.31",
"gradio-client>=1.3.0", "gradio-client>=1.3.0",
] ]
license = { text = "MIT" } license = { text = "MIT" }
@ -31,8 +31,6 @@ keywords = ["nonebot", "plugin", "image"]
homepage = "https://github.com/Refound-445/nonebot-plugin-nailongremove" homepage = "https://github.com/Refound-445/nonebot-plugin-nailongremove"
repository = "https://github.com/Refound-445/nonebot-plugin-nailongremove" repository = "https://github.com/Refound-445/nonebot-plugin-nailongremove"
[project.optional-dependencies]
[build-system] [build-system]
requires = ["pdm-backend"] requires = ["pdm-backend"]
build-backend = "pdm.backend" build-backend = "pdm.backend"
@ -42,4 +40,4 @@ includes = []
[tool.pdm.version] [tool.pdm.version]
source = "file" source = "file"
path = "nonebot_plugin_nailongremove/__init__.py" path = "nonebot_plugin_nailongremove/__init__.py"

1524
pdm.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,13 @@ readme = "README.md"
[tool.pdm.dev-dependencies] [tool.pdm.dev-dependencies]
dev = [ dev = [
# pip
"setuptools>=73.0.1",
"pip>=24.2",
# tools
"basedpyright>=1.17.0",
"ruff>=0.6.2",
# packages
"-e file:///${PROJECT_ROOT}/packages/nonebot-plugin-nailongremove-base#egg=nonebot-plugin-nailongremove-base", "-e file:///${PROJECT_ROOT}/packages/nonebot-plugin-nailongremove-base#egg=nonebot-plugin-nailongremove-base",
"-e file:///${PROJECT_ROOT}/packages/nonebot-plugin-nailongremove#egg=nonebot-plugin-nailongremove", "-e file:///${PROJECT_ROOT}/packages/nonebot-plugin-nailongremove#egg=nonebot-plugin-nailongremove",
] ]
@ -25,3 +32,88 @@ render = { call = "scripts.src.render:main" }
pre-install = { composite = ["install-scripts", "render"] } pre-install = { composite = ["install-scripts", "render"] }
pub-all-pub = { call = "scripts.src.pub_all:main" } pub-all-pub = { call = "scripts.src.pub_all:main" }
pub-all = { composite = ["render", "pub-all-pub"] } pub-all = { composite = ["render", "pub-all-pub"] }
[tool.basedpyright]
pythonVersion = "3.9"
defineConstant = { PYDANTIC_V2 = true }
typeCheckingMode = "standard"
reportShadowedImports = false
exclude = ["__pypackages__"]
[tool.ruff]
target-version = "py39"
[tool.ruff.format]
docstring-code-format = true
line-ending = "lf"
[tool.ruff.lint]
preview = true
ignore = [
"B008",
"B905",
# "COM812",
"E501",
"F821", # conflict with pyright
"FBT001",
"FBT002",
"ISC001",
"PERF203",
"PGH003",
"PLC04",
"RUF001",
"RUF002",
"RUF003",
"RUF006",
"RUF029",
"RUF100",
"S101",
"S311",
"S404",
"SIM117",
"TRY002",
"TRY003",
]
select = [
"A",
"ANN001",
"ARG",
"ASYNC",
"B",
"C4",
"COM",
"DTZ",
"E",
"F",
"FBT",
"FLY",
"FURB",
"I",
"ISC",
"N",
"NPY",
"PERF",
"PIE",
"PGH",
# "PL",
"PT",
"PTH",
"PYI",
"Q",
"RET",
"RSE",
"RUF",
"S",
"SIM",
"SLF",
"SLOT",
"TCH",
"TRY",
"YTT",
]
[tool.ruff.lint.isort]
combine-as-imports = true
detect-same-package = true
extra-standard-library = ["typing_extensions"]
split-on-trailing-comma = true

View File

@ -2,7 +2,10 @@ import re
from pathlib import Path from pathlib import Path
from typing import TypedDict from typing import TypedDict
import tomllib try:
import tomllib # pyright: ignore[reportMissingImports]
except ModuleNotFoundError:
import tomli as tomllib
from .utils import PACKAGES_PATH from .utils import PACKAGES_PATH