소스 검색

feat: switch from setup.py to pyproject.toml

忘忧北萱草 1 년 전
부모
커밋
ef5a71398b
4개의 변경된 파일65개의 추가작업 그리고 46개의 파일을 삭제
  1. 26 0
      .github/workflows/python-build.yml
  2. 39 0
      pyproject.toml
  3. 0 15
      requirements.txt
  4. 0 31
      setup.py

+ 26 - 0
.github/workflows/python-build.yml

@@ -0,0 +1,26 @@
+name: Build Python Package
+
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v4
+    - name: Set up Python
+      uses: actions/setup-python@v3
+      with:
+        python-version: '3.x'
+
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install build
+
+    - name: Build package
+      run: python -m build

+ 39 - 0
pyproject.toml

@@ -0,0 +1,39 @@
+[project]
+name = "pdf2zh"
+version = "1.7.9"
+description = "Latex PDF Translator"
+authors = [{ name = "Byaidu", email = "byaidux@gmail.com" }]
+license = "AGPL-3.0"
+readme = "README.md"
+requires-python = ">=3.8,<=3.12"
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "Operating System :: OS Independent",
+]
+dependencies = [
+    "charset-normalizer",
+    "cryptography",
+    "requests",
+    "pymupdf",
+    "tqdm",
+    "tenacity",
+    "doclayout-yolo",
+    "numpy",
+    "ollama",
+    "deepl<1.19.1",
+    "openai",
+    "azure-ai-translation-text<=1.0.1",
+    "gradio",
+    "huggingface_hub",
+    "torch",
+]
+
+[project.urls]
+Homepage = "https://github.com/Byaidu/PDFMathTranslate"
+
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project.scripts]
+pdf2zh = "pdf2zh.pdf2zh:main"

+ 0 - 15
requirements.txt

@@ -1,15 +0,0 @@
-charset-normalizer
-cryptography
-requests
-pymupdf
-tqdm
-tenacity
-doclayout-yolo
-numpy
-ollama
-deepl<1.19.1
-openai
-azure-ai-translation-text<=1.0.1
-gradio
-huggingface_hub
-torch

+ 0 - 31
setup.py

@@ -1,31 +0,0 @@
-from pdf2zh import __version__, __author__
-from setuptools import setup
-
-with open("README.md", encoding='utf-8') as f:
-    readme = f.read()
-
-with open("requirements.txt", encoding='utf-8') as f:
-    requirements = f.readlines()
-
-setup(
-    name="pdf2zh",
-    long_description=readme,
-    long_description_content_type="text/markdown",
-    description="Latex PDF Translator",
-    license="AGPLv3",
-    version=__version__,
-    author=__author__,
-    author_email="byaidux@gmail.com",
-    url="https://github.com/Byaidu/PDFMathTranslate",
-    packages=["pdf2zh"],
-    install_requires=requirements,
-    classifiers=[
-        "Programming Language :: Python :: 3",
-        "Operating System :: OS Independent",
-    ],
-    entry_points={
-        'console_scripts': [
-            'pdf2zh=pdf2zh.pdf2zh:main',
-        ]
-    },
-)