Просмотр исходного кода

Merge pull request #115 from YadominJinta/main

check code format in ci
Rongxin 1 год назад
Родитель
Сommit
6387bfc14a
3 измененных файлов с 15 добавлено и 4 удалено
  1. 6 1
      .github/workflows/python-build.yml
  2. 1 2
      .pre-commit-config.yaml
  3. 8 1
      pyproject.toml

+ 6 - 1
.github/workflows/python-build.yml

@@ -20,7 +20,12 @@ jobs:
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip
-        pip install build
+        pip install build flake8 black
+
+    - name: Check code format
+      run: |
+        black --check --diff --color pdf2zh/*.py
+        flake8
 
     - name: Build package
       run: python -m build

+ 1 - 2
.pre-commit-config.yaml

@@ -1,5 +1,6 @@
 # See https://pre-commit.com for more information
 # See https://pre-commit.com/hooks.html for more hooks
+files: '^.*\.py$'
 repos:
 -   repo: local
     hooks:
@@ -7,9 +8,7 @@ repos:
       name: black
       entry: black --check --diff --color
       language: python
-      files: ".py"
     - id: flake8
       name: flake8
       entry: flake8
       language: python
-      files: ".py"

+ 8 - 1
pyproject.toml

@@ -5,7 +5,7 @@ description = "Latex PDF Translator"
 authors = [{ name = "Byaidu", email = "byaidux@gmail.com" }]
 license = "AGPL-3.0"
 readme = "README.md"
-requires-python = ">=3.8,<=3.12"
+requires-python = ">=3.8,<3.13"
 classifiers = [
     "Programming Language :: Python :: 3",
     "Operating System :: OS Independent",
@@ -28,6 +28,13 @@ dependencies = [
     "torch",
 ]
 
+[project.optional-dependencies]
+dev = [
+    "black",
+    "flake8",
+    "pre-commit"
+]
+
 [project.urls]
 Homepage = "https://github.com/Byaidu/PDFMathTranslate"