Skip to content

Commit c1bd914

Browse files
authored
Migrating from setup.py to pyproject.toml (#252)
* Removed setup.py in favor of pyproject.toml metadata * Moved to importlib.metadata for version * Added pytest testpaths to shorten invocation * Added setuptools build backend to ensure it will be properly installed * Documenting where version now lives, per PR comments
1 parent f4a5a77 commit c1bd914

File tree

4 files changed

+58
-40
lines changed

4 files changed

+58
-40
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,4 @@ jobs:
3232
env:
3333
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3434
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
35-
run: |
36-
pytest tests
35+
run: pytest

paperqa/version.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
__version__ = "4.3.0"
1+
from importlib.metadata import version
2+
3+
# If you're looking to bump the version, this now
4+
# lives in the pyproject.toml's [project] section
5+
__version__ = version("paper-qa")

pyproject.toml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = ["setuptools >= 61.0"]
4+
5+
[project]
6+
authors = [
7+
{email = "[email protected]", name = "Andrew White"},
8+
]
9+
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
10+
classifiers = [
11+
"License :: OSI Approved :: Apache Software License",
12+
"Operating System :: OS Independent",
13+
"Programming Language :: Python :: 3 :: Only",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: 3.12",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python",
20+
]
21+
dependencies = [
22+
"PyCryptodome",
23+
"html2text",
24+
"numpy",
25+
"openai>=1",
26+
"pydantic>=2",
27+
"pypdf",
28+
"tiktoken>=0.4.0",
29+
]
30+
description = "LLM Chain for answering questions from docs"
31+
keywords = ["question answering"]
32+
license = {file = "LICENSE"}
33+
maintainers = [
34+
{email = "[email protected]", name = "James Braza"},
35+
{email = "[email protected]", name = "Andrew White"},
36+
]
37+
name = "paper-qa"
38+
readme = "README.md"
39+
requires-python = ">=3.8"
40+
urls = {repository = "https://github.com/whitead/paper-qa"}
41+
version = "4.3.0"
42+
143
[tool.codespell]
244
check-filenames = true
345
check-hidden = true
@@ -55,6 +97,13 @@ module = [
5597
"sentence_transformers", # SEE: https://github.com/UKPLab/sentence-transformers/issues/1723
5698
]
5799

100+
[tool.pytest.ini_options]
101+
# List of directories that should be searched for tests when no specific directories,
102+
# files or test ids are given in the command line when executing pytest from the rootdir
103+
# directory. File system paths may use shell-style wildcards, including the recursive **
104+
# pattern.
105+
testpaths = ["tests"]
106+
58107
[tool.ruff]
59108
# Line length to use when enforcing long-lines violations (like `E501`).
60109
line-length = 120
@@ -134,6 +183,9 @@ max-doc-length = 120 # Match line-length
134183
# defaults when analyzing docstring sections.
135184
convention = "google"
136185

186+
[tool.setuptools.packages.find]
187+
include = ["paperqa*"]
188+
137189
[tool.tomlsort]
138190
all = true
139191
in_place = true

setup.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)