From 2ee8a1e094f313689c4d986d5db1c8b577092e00 Mon Sep 17 00:00:00 2001 From: James Braza Date: Fri, 8 Mar 2024 12:25:09 -0800 Subject: [PATCH 1/5] Removed setup.py in favor of pyproject.toml metadata --- pyproject.toml | 41 +++++++++++++++++++++++++++++++++++++++++ setup.py | 37 ------------------------------------- 2 files changed, 41 insertions(+), 37 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 4e193fb10..5163e83bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,41 @@ +[project] +authors = [ + {email = "white.d.andrew@gmail.com", name = "Andrew White"}, +] +# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python", +] +dependencies = [ + "PyCryptodome", + "html2text", + "numpy", + "openai>=1", + "pydantic>=2", + "pypdf", + "tiktoken>=0.4.0", +] +description = "LLM Chain for answering questions from docs" +keywords = ["question answering"] +license = {file = "LICENSE"} +maintainers = [ + {email = "jamesbraza@gmail.com", name = "James Braza"}, + {email = "white.d.andrew@gmail.com", name = "Andrew White"}, +] +name = "paper-qa" +readme = "README.md" +requires-python = ">=3.8" +urls = {repository = "https://github.com/whitead/paper-qa"} +version = "4.2.0" + [tool.codespell] check-filenames = true check-hidden = true @@ -134,6 +172,9 @@ max-doc-length = 120 # Match line-length # defaults when analyzing docstring sections. convention = "google" +[tool.setuptools.packages.find] +include = ["paperqa*"] + [tool.tomlsort] all = true in_place = true diff --git a/setup.py b/setup.py deleted file mode 100644 index 6bc87745c..000000000 --- a/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -from setuptools import setup - -# for typing -__version__ = "" -exec(open("paperqa/version.py").read()) # noqa: S102, SIM115 - -with open("README.md", encoding="utf-8") as fh: - long_description = fh.read() - -setup( - name="paper-qa", - version=__version__, - description="LLM Chain for answering questions from docs ", - author="Andrew White", - author_email="white.d.andrew@gmail.com", - url="https://github.com/whitead/paper-qa", - license="Apache License 2.0", - packages=["paperqa", "paperqa.contrib"], - package_data={"paperqa": ["py.typed"]}, - install_requires=[ - "pypdf", - "pydantic>=2", - "openai>=1", - "numpy", - "PyCryptodome", - "html2text", - "tiktoken>=0.4.0", - ], - test_suite="tests", - long_description=long_description, - long_description_content_type="text/markdown", - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - ], -) From 58e8121ca28fca7c1208dcd49ca744073b0d29fa Mon Sep 17 00:00:00 2001 From: James Braza Date: Fri, 8 Mar 2024 12:25:20 -0800 Subject: [PATCH 2/5] Moved to importlib.metadata for version --- paperqa/version.py | 4 +++- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/paperqa/version.py b/paperqa/version.py index 111dc9172..6ade5f26e 100644 --- a/paperqa/version.py +++ b/paperqa/version.py @@ -1 +1,3 @@ -__version__ = "4.3.0" +from importlib.metadata import version + +__version__ = version("paper-qa") diff --git a/pyproject.toml b/pyproject.toml index 5163e83bf..d1f015b43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ name = "paper-qa" readme = "README.md" requires-python = ">=3.8" urls = {repository = "https://github.com/whitead/paper-qa"} -version = "4.2.0" +version = "4.3.0" [tool.codespell] check-filenames = true From 2b680b6b0e94feac23b5b4b454117d1fedca470f Mon Sep 17 00:00:00 2001 From: James Braza Date: Fri, 8 Mar 2024 12:27:06 -0800 Subject: [PATCH 3/5] Added pytest testpaths to shorten invocation --- .github/workflows/tests.yml | 3 +-- pyproject.toml | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a422e3b8e..da80dbaf6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,5 +32,4 @@ jobs: env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - run: | - pytest tests + run: pytest diff --git a/pyproject.toml b/pyproject.toml index d1f015b43..ccc5bab04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,6 +93,13 @@ module = [ "sentence_transformers", # SEE: https://github.com/UKPLab/sentence-transformers/issues/1723 ] +[tool.pytest.ini_options] +# List of directories that should be searched for tests when no specific directories, +# files or test ids are given in the command line when executing pytest from the rootdir +# directory. File system paths may use shell-style wildcards, including the recursive ** +# pattern. +testpaths = ["tests"] + [tool.ruff] # Line length to use when enforcing long-lines violations (like `E501`). line-length = 120 From ec21eb7c3c93c5f4eaa47e736353c7b8733e9548 Mon Sep 17 00:00:00 2001 From: James Braza Date: Wed, 13 Mar 2024 11:14:52 -0700 Subject: [PATCH 4/5] Added setuptools build backend to ensure it will be properly installed --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index ccc5bab04..1990f8f09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools >= 61.0"] + [project] authors = [ {email = "white.d.andrew@gmail.com", name = "Andrew White"}, From 0b08fd5ecffa220c7df3162bceaae59f4b5b067a Mon Sep 17 00:00:00 2001 From: James Braza Date: Wed, 13 Mar 2024 12:26:06 -0700 Subject: [PATCH 5/5] Documenting where version now lives, per PR comments --- paperqa/version.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paperqa/version.py b/paperqa/version.py index 6ade5f26e..d12246efa 100644 --- a/paperqa/version.py +++ b/paperqa/version.py @@ -1,3 +1,5 @@ from importlib.metadata import version +# If you're looking to bump the version, this now +# lives in the pyproject.toml's [project] section __version__ = version("paper-qa")