Skip to content

Commit

Permalink
Migrating from setup.py to pyproject.toml (#252)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jamesbraza authored Mar 13, 2024
1 parent f4a5a77 commit c1bd914
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 40 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion paperqa/version.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
__version__ = "4.3.0"
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")
52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools >= 61.0"]

[project]
authors = [
{email = "[email protected]", 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 = "[email protected]", name = "James Braza"},
{email = "[email protected]", name = "Andrew White"},
]
name = "paper-qa"
readme = "README.md"
requires-python = ">=3.8"
urls = {repository = "https://github.com/whitead/paper-qa"}
version = "4.3.0"

[tool.codespell]
check-filenames = true
check-hidden = true
Expand Down Expand Up @@ -55,6 +97,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
Expand Down Expand Up @@ -134,6 +183,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
Expand Down
37 changes: 0 additions & 37 deletions setup.py

This file was deleted.

0 comments on commit c1bd914

Please sign in to comment.