mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 09:25:06 +01:00
Build khoj python package using hatchling, pyproject.toml
- Why - pyprojects.toml is the python standards compliant config format - allows collating python tooling configs into single standard file - hatch(-ling) is a new lightweight build system for python packages - Detailed Changes - Replace setup.py, setuptools with pyproject.toml, hatchling for khoj python config and build - move pytest into optional development dependencies - add more links to khoj in the project urls section - add topic classifiers and keywords to find khoj package - Delete setup.py, MANIFEST.in as moved to pyproject.toml based setup - Update pypi workflow to set python package version in pyproject.toml
This commit is contained in:
parent
c641eb4ad6
commit
dcb86c2d3e
4 changed files with 78 additions and 60 deletions
4
.github/workflows/pypi.yml
vendored
4
.github/workflows/pypi.yml
vendored
|
@ -37,13 +37,13 @@ jobs:
|
|||
|
||||
- name: 📝 Set Pre-Release Version for Master
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: sed -E -i "s/version=(.*)',/version=\1a$(date +%s)',/g" setup.py
|
||||
run: sed -E -i "s/version = (.*)\"/version = \1a$(date +%s)\"/g" pyproject.toml
|
||||
|
||||
- name: 📝 Set Development Version for PR
|
||||
if: github.event_name == 'pull_request'
|
||||
env:
|
||||
PULL_REQUEST_NUMBER: ${{ github.event.number }}
|
||||
run: sed -E -i "s/version=(.*)',/version=\1.dev$PULL_REQUEST_NUMBER$(date +%s)',/g" setup.py
|
||||
run: sed -E -i "s/version = (.*)\"/version = \1.dev$PULL_REQUEST_NUMBER$(date +%s)\"/g" pyproject.toml
|
||||
|
||||
- name: ⚙️ Build Python Package
|
||||
run: |
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
include README.md
|
||||
graft src/khoj/interface/*
|
||||
prune src/khoj/interface/web/images*
|
||||
prune docs*
|
||||
global-exclude .DS_Store *.py[cod]
|
76
pyproject.toml
Normal file
76
pyproject.toml
Normal file
|
@ -0,0 +1,76 @@
|
|||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "khoj-assistant"
|
||||
version = "0.3.0"
|
||||
description = "A natural language search engine for your personal notes, transactions and images"
|
||||
readme = "README.md"
|
||||
license = "GPL-3.0-or-later"
|
||||
requires-python = ">=3.8, <3.11"
|
||||
authors = [
|
||||
{ name = "Debanjum Singh Solanky", email = "debanjum+pypi@gmail.com" },
|
||||
{ name = "Saba Imran", email = "narmiabas@gmail.com" },
|
||||
]
|
||||
keywords = [
|
||||
"search",
|
||||
"semantic-search",
|
||||
"productivity",
|
||||
"NLP",
|
||||
"AI",
|
||||
"org-mode",
|
||||
"markdown",
|
||||
"beancount",
|
||||
"images",
|
||||
]
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
|
||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
|
||||
"Topic :: Text Processing :: Linguistic",
|
||||
]
|
||||
dependencies = [
|
||||
"dateparser == 1.1.1",
|
||||
"defusedxml == 0.7.1",
|
||||
"fastapi == 0.77.1",
|
||||
"jinja2 == 3.1.2",
|
||||
"openai == 0.20.0",
|
||||
"pillow == 9.3.0",
|
||||
"pydantic == 1.9.1",
|
||||
"pyqt6 == 6.3.1",
|
||||
"pyyaml == 6.0",
|
||||
"rich >= 13.3.1",
|
||||
"schedule == 1.1.0",
|
||||
"sentence-transformers == 2.2.2",
|
||||
"torch == 1.13.1",
|
||||
"uvicorn == 0.17.6",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/debanjum/khoj"
|
||||
Issues = "https://github.com/debanjum/khoj/issues"
|
||||
Discussions = "https://github.com/debanjum/khoj/discussions"
|
||||
Releases = "https://github.com/debanjum/khoj/releases"
|
||||
|
||||
[project.scripts]
|
||||
khoj = "khoj.main:run"
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = [
|
||||
"pytest == 7.1.2",
|
||||
]
|
||||
dev = ["khoj-assistant[test]"]
|
||||
|
||||
[tool.hatch.build.targets.sdist]
|
||||
include = ["src/khoj"]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/khoj"]
|
53
setup.py
53
setup.py
|
@ -1,53 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
from pathlib import Path
|
||||
this_directory = Path(__file__).parent
|
||||
|
||||
setup(
|
||||
name='khoj-assistant',
|
||||
version='0.3.0',
|
||||
description="A natural language search engine for your personal notes, transactions and images",
|
||||
long_description=(this_directory / "README.md").read_text(encoding="utf-8"),
|
||||
long_description_content_type="text/markdown",
|
||||
author='Debanjum Singh Solanky, Saba Imran',
|
||||
author_email='debanjum+pypi@gmail.com, narmiabas@gmail.com',
|
||||
url='https://github.com/debanjum/khoj',
|
||||
license="GPLv3",
|
||||
keywords="search semantic-search productivity NLP org-mode markdown beancount images",
|
||||
python_requires=">=3.8, <3.11",
|
||||
package_dir={"": "src"},
|
||||
packages=find_packages(
|
||||
where="src",
|
||||
include=["khoj*"]
|
||||
),
|
||||
install_requires=[
|
||||
"torch == 1.13.1",
|
||||
"sentence-transformers == 2.2.2",
|
||||
"openai == 0.20.0",
|
||||
"pydantic == 1.9.1",
|
||||
"fastapi == 0.77.1",
|
||||
"uvicorn == 0.17.6",
|
||||
"jinja2 == 3.1.2",
|
||||
"pyyaml == 6.0",
|
||||
"pytest == 7.1.2",
|
||||
"pillow == 9.3.0",
|
||||
"dateparser == 1.1.1",
|
||||
"pyqt6 == 6.3.1",
|
||||
"defusedxml == 0.7.1",
|
||||
'schedule == 1.1.0',
|
||||
"rich >= 13.3.1",
|
||||
],
|
||||
include_package_data=True,
|
||||
entry_points={"console_scripts": ["khoj = khoj.main:run"]},
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
]
|
||||
)
|
Loading…
Reference in a new issue