From e16b7ef924fdfbcd25b63ab0b195663b507f363d Mon Sep 17 00:00:00 2001 From: student_2333 Date: Sat, 16 Nov 2024 22:39:10 +0800 Subject: [PATCH] up --- .github/workflows/pre-commit.yml | 20 +++++-- pdm.lock | 93 +++++++++++++++++++++++++++++++- pyproject.toml | 15 +++--- 3 files changed, 116 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5888731..d25bdf2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -17,13 +17,27 @@ jobs: - name: Setup PDM uses: pdm-project/setup-pdm@v4 with: - python-version: 3.12 enable-pep582: true - name: Install project dependencies run: |- - pdm config python.use_venv false pdm pre-install pdm install -G:all - - uses: pre-commit/action@v3.0.1 + - name: Run pre-commit + run: |- + pdm run pre-commit run --all-files --show-diff-on-failure --color=always + local ret=$? + + # push back changes + if [[ -n "$(git status -s)" ]]; then + git add . + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + git commit -m "chore: pre-commit auto fix [skip ci]" + git push + else + echo "No changes detected." + fi + + exit $ret diff --git a/pdm.lock b/pdm.lock index 67f1d89..c9ff2d2 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:a42ce331487cc7c7a2fe979f7e01816d367ede1b465b6b4ec3ccabe0e3264cc1" +content_hash = "sha256:5007274a43436d6abba9573181b8f32de6edb9a0b449a7396f0d02d3f60cbca4" [[metadata.targets]] requires_python = "~=3.9" @@ -97,6 +97,17 @@ files = [ {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, ] +[[package]] +name = "cfgv" +version = "3.4.0" +requires_python = ">=3.8" +summary = "Validate configuration and produce human readable error messages." +groups = ["dev"] +files = [ + {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, + {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, +] + [[package]] name = "charset-normalizer" version = "3.4.0" @@ -329,6 +340,16 @@ files = [ {file = "cycler-0.12.1.tar.gz", hash = "sha256:88bb128f02ba341da8ef447245a9e138fae777f6a23943da4540077d3601eb1c"}, ] +[[package]] +name = "distlib" +version = "0.3.9" +summary = "Distribution utilities" +groups = ["dev"] +files = [ + {file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"}, + {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, +] + [[package]] name = "exceptiongroup" version = "1.2.2" @@ -567,6 +588,17 @@ files = [ {file = "humanfriendly-10.0.tar.gz", hash = "sha256:6b0b831ce8f15f7300721aa49829fc4e83921a9a301cc7f606be6686a2288ddc"}, ] +[[package]] +name = "identify" +version = "2.6.2" +requires_python = ">=3.9" +summary = "File identification library for Python" +groups = ["dev"] +files = [ + {file = "identify-2.6.2-py2.py3-none-any.whl", hash = "sha256:c097384259f49e372f4ea00a19719d95ae27dd5ff0fd77ad630aa891306b82f3"}, + {file = "identify-2.6.2.tar.gz", hash = "sha256:fab5c716c24d7a789775228823797296a2994b075fb6080ac83a102772a98cbd"}, +] + [[package]] name = "idna" version = "3.10" @@ -996,6 +1028,17 @@ files = [ {file = "networkx-3.2.1.tar.gz", hash = "sha256:9f1bb5cf3409bf324e0a722c20bdb4c20ee39bf1c30ce8ae499c8502b0b5e0c6"}, ] +[[package]] +name = "nodeenv" +version = "1.9.1" +requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +summary = "Node.js virtual environment builder" +groups = ["dev"] +files = [ + {file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"}, + {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, +] + [[package]] name = "nodejs-wheel-binaries" version = "22.11.0" @@ -1565,6 +1608,35 @@ files = [ {file = "pip-24.3.1.tar.gz", hash = "sha256:ebcb60557f2aefabc2e0f918751cd24ea0d56d8ec5445fe1807f1d2109660b99"}, ] +[[package]] +name = "platformdirs" +version = "4.3.6" +requires_python = ">=3.8" +summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." +groups = ["dev"] +files = [ + {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, + {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, +] + +[[package]] +name = "pre-commit" +version = "4.0.1" +requires_python = ">=3.9" +summary = "A framework for managing and maintaining multi-language pre-commit hooks." +groups = ["dev"] +dependencies = [ + "cfgv>=2.0.0", + "identify>=1.0.0", + "nodeenv>=0.11.1", + "pyyaml>=5.1", + "virtualenv>=20.10.0", +] +files = [ + {file = "pre_commit-4.0.1-py2.py3-none-any.whl", hash = "sha256:efde913840816312445dc98787724647c65473daefe420785f885e8ed9a06878"}, + {file = "pre_commit-4.0.1.tar.gz", hash = "sha256:80905ac375958c0444c65e9cebebd948b3cdb518f335a091a670a89d652139d2"}, +] + [[package]] name = "propcache" version = "0.2.0" @@ -1834,7 +1906,7 @@ version = "3.5.4" requires_python = ">=3.8" summary = "A python implementation of GNU readline." groups = ["dev"] -marker = "sys_platform == \"win32\" and python_version >= \"3.8\"" +marker = "sys_platform == \"win32\"" files = [ {file = "pyreadline3-3.5.4-py3-none-any.whl", hash = "sha256:eaf8e6cc3c49bcccf145fc6067ba8643d1df34d604a1ec0eccbf7a18e6d3fae6"}, {file = "pyreadline3-3.5.4.tar.gz", hash = "sha256:8d57d53039a1c75adba8e50dd3d992b28143480816187ea5efbd5c78e6c885b7"}, @@ -2362,6 +2434,23 @@ files = [ {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] +[[package]] +name = "virtualenv" +version = "20.27.1" +requires_python = ">=3.8" +summary = "Virtual Python Environment builder" +groups = ["dev"] +dependencies = [ + "distlib<1,>=0.3.7", + "filelock<4,>=3.12.2", + "importlib-metadata>=6.6; python_version < \"3.8\"", + "platformdirs<5,>=3.9.1", +] +files = [ + {file = "virtualenv-20.27.1-py3-none-any.whl", hash = "sha256:f11f1b8a29525562925f745563bfd48b189450f61fb34c4f9cc79dd5aa32a1f4"}, + {file = "virtualenv-20.27.1.tar.gz", hash = "sha256:142c6be10212543b32c6c45d3d3893dff89112cc588b7d0879ae5a1ec03a47ba"}, +] + [[package]] name = "websockets" version = "12.0" diff --git a/pyproject.toml b/pyproject.toml index 4e0bc3c..bb6dc6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,9 @@ dependencies = [] license = { text = "MIT" } readme = "README.md" +[tool.pdm] +distribution = false + [tool.pdm.dev-dependencies] dev = [ # pip @@ -14,18 +17,12 @@ dev = [ # tools "basedpyright>=1.17.0", "ruff>=0.6.2", + "pre-commit>=4.0.1", # packages "-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", ] -[build-system] -requires = ["pdm-backend"] -build-backend = "pdm.backend" - -[tool.pdm] -distribution = false - [tool.pdm.scripts] install-scripts = { shell = "cd scripts && pdm install -G:all && cd .." } render = { call = "scripts.src.render:main" } @@ -33,6 +30,10 @@ pre-install = { composite = ["install-scripts", "render"] } pub-all-pub = { call = "scripts.src.pub_all:main" } pub-all = { composite = ["render", "pub-all-pub"] } +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" + [tool.basedpyright] pythonVersion = "3.9" defineConstant = { PYDANTIC_V2 = true }