From aeed40b0ed7f36c12f65d7beabb3b9cd56390999 Mon Sep 17 00:00:00 2001 From: xiaoxx-mac Date: Wed, 17 May 2023 15:43:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=BF=E6=8D=A2setup.py=E4=B8=BA?= =?UTF-8?q?pyproject.toml;=20=E6=B7=BB=E5=8A=A0=E5=8C=85=5F=5Fmain=5F=5F.p?= =?UTF-8?q?y=E8=AE=A9=E7=A8=8B=E5=BA=8F=E5=8F=AF=E4=BB=A5=E4=BB=A5?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- MANIFEST.in | 1 - gpt_term/__init__.py | 5 ++++- gpt_term/__main__.py | 4 ++++ pyproject.toml | 32 ++++++++++++++++++++++++++++++++ setup.py | 42 ------------------------------------------ 6 files changed, 42 insertions(+), 45 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 gpt_term/__main__.py create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 3d646a2..7af10dd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ chat*.json __pycache__ build *.egg-info/ -dist \ No newline at end of file +dist +gpt_term/_version.py \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 29771cb..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include gpt_term/config.ini \ No newline at end of file diff --git a/gpt_term/__init__.py b/gpt_term/__init__.py index 87a7cf5..078de92 100644 --- a/gpt_term/__init__.py +++ b/gpt_term/__init__.py @@ -1 +1,4 @@ -__version__ = "1.0.4" \ No newline at end of file +try: + from ._version import version as __version__ +except ImportError: + __version__ = "0.0+unknown" \ No newline at end of file diff --git a/gpt_term/__main__.py b/gpt_term/__main__.py new file mode 100644 index 0000000..40e2b01 --- /dev/null +++ b/gpt_term/__main__.py @@ -0,0 +1,4 @@ +from .main import main + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..654c326 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,32 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] + +[project] +name = "gpt-term" +dynamic = ["version", "dependencies"] +description = "Chat with GPT in Terminal" +authors = [{name="xiaoxx970"}, {name="Ace-Radom"}] +readme = "README.md" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Environment :: Console", +] +requires-python = ">=3.7" +license = {file = "LICENSE"} + +[project.urls] +Homepage = "https://github.com/xiaoxx970/chatgpt-in-terminal/" + +[project.scripts] +gpt-term = "gpt_term.main:main" + +[tool.setuptools] +packages = ["gpt_term"] + +[tool.setuptools.dynamic] +dependencies = {file = "requirements.txt"} + +[tool.setuptools_scm] +write_to="gpt_term/_version.py" \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 85e7f35..0000000 --- a/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -from setuptools import find_packages, setup -from gpt_term import __version__ - -with open("README.md", 'r', encoding='utf-8') as f: - long_description = f.read() - -install_requires = [ - "requests", - "pyperclip", - "rich>=13.3.1", - "prompt_toolkit>=3.0", - "sseclient-py>=1.7.2", - "tiktoken", - "packaging" -] - -setup( - name="gpt-term", - version=__version__, - author="xiaoxx970", - description="Use ChatGPT in terminal", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/xiaoxx970/chatgpt-in-terminal", - license="MIT", - - packages=find_packages(), - py_modules=["chat"], - install_requires=install_requires, - entry_points={ - "console_scripts": [ - "gpt-term=gpt_term.main:main" - ] - }, - include_package_data=True, - python_requires=">=3.7", - classifiers=[ - 'Programming Language :: Python :: 3', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - ] -) \ No newline at end of file