Adopt pyproject.toml (#89)

* ditching setup.py in favour of pyproject.toml; bump to 0.3.2

* bump to 0.3.3
This commit is contained in:
ian_Cin 2023-11-29 14:58:35 +07:00 committed by GitHub
parent 8e0779a22d
commit 4256030b4f
4 changed files with 75 additions and 79 deletions

View File

@ -53,8 +53,11 @@ jobs:
- name: Get cache key - name: Get cache key
id: get-cache-key id: get-cache-key
# using tomli so that it works on windows. From python 3.11, this can be switched to the
# built-in tomllib
run: | run: |
package_version=$(python setup.py --version) pip install tomli
package_version=$(python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])")
cache_key="${{ runner.os }}-py${{ matrix.python-version }}-v${package_version}" cache_key="${{ runner.os }}-py${{ matrix.python-version }}-v${package_version}"
echo "key=$cache_key" | tee -a ${{ matrix.GITHUB_OUTPUT }} echo "key=$cache_key" | tee -a ${{ matrix.GITHUB_OUTPUT }}

View File

@ -21,5 +21,3 @@ try:
haystack.telemetry.telemetry = None haystack.telemetry.telemetry = None
except ImportError: except ImportError:
pass pass
__version__ = "0.3.2"

71
pyproject.toml Normal file
View File

@ -0,0 +1,71 @@
# build backand and build dependencies
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = false
packages.find.include = ["kotaemon*"]
packages.find.exclude = ["tests*", "env*"]
# metadata and dependencies
[project]
name = "kotaemon"
version = "0.3.3"
requires-python = ">= 3.10"
description = "Kotaemon core library for AI development."
dependencies = [
"langchain",
"theflow",
"llama-index>=0.9.0",
"llama-hub",
"gradio",
"openpyxl",
"cookiecutter",
"click",
"pandas",
]
readme = "README.md"
license = { text = "MIT License" }
authors = [
{ name = "john", email = "john@cinnamon.is" },
{ name = "ian", email = "ian@cinnamon.is" },
{ name = "tadashi", email = "tadashi@cinnamon.is" },
]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
[project.optional-dependencies]
dev = [
"ipython",
"pytest",
"pre-commit",
"black",
"flake8",
"sphinx",
"coverage",
"openai",
"chromadb",
"wikipedia",
"duckduckgo-search",
"googlesearch-python",
"python-dotenv",
"pytest-mock",
"unstructured[pdf]",
"farm-haystack==1.19.0",
"sentence_transformers",
"cohere",
"elasticsearch",
"pypdf",
]
[project.scripts]
kh = "kotaemon.cli:main"
[project.urls]
Homepage = "https://github.com/Cinnamon/kotaemon/"
Repository = "https://github.com/Cinnamon/kotaemon/"
Documentation = "https://github.com/Cinnamon/kotaemon/wiki"

View File

@ -1,76 +0,0 @@
import codecs
import re
from pathlib import Path
import setuptools
def read(file_path: str) -> str:
return codecs.open(file_path, "r").read()
def get_version() -> str:
version_file = read(str(Path("kotaemon", "__init__.py")))
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if match:
return match.group(1)
raise RuntimeError("Cannot find verison string")
setuptools.setup(
name="kotaemon",
version=get_version(),
author="john",
author_email="john@cinnamon.com",
description="Kotaemon core library for AI development",
long_description=read("README.md"),
long_description_content_type="text/markdown",
url="https://github.com/Cinnamon/kotaemon/",
packages=setuptools.find_packages(
exclude=("tests", "tests.*", "examples", "examples.*")
),
install_requires=[
"langchain",
"theflow",
"llama-index>=0.9.0",
"llama-hub",
"gradio",
"openpyxl",
"cookiecutter",
"click",
"pandas",
],
extras_require={
"dev": [
"ipython",
"pytest",
"pre-commit",
"black",
"flake8",
"sphinx",
"coverage",
# optional dependency needed for test
"openai",
"chromadb",
"wikipedia",
"duckduckgo-search",
"googlesearch-python",
"python-dotenv",
"pytest-mock",
"unstructured[pdf]",
"farm-haystack==1.19.0",
"sentence_transformers",
"cohere",
"elasticsearch",
"pypdf",
],
},
entry_points={"console_scripts": ["kh=kotaemon.cli:main"]},
python_requires=">=3.10",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
include_package_data=True,
)