Convert from setup.py to pyproject.toml (#908)

* Build package as part of tests, upload as artifact
* Only stash artifact for ubuntu-latest Python 3.13

Closes #907
This commit is contained in:
Simon Willison 2025-04-10 16:57:53 -07:00 committed by GitHub
parent 0cc26b3d4f
commit 54f54efcbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 81 additions and 71 deletions

View file

@ -44,8 +44,17 @@ jobs:
if: matrix.os != 'windows-latest'
run: |
ruff check .
- name: Check it builds
run: |
python -m build
- name: Run test-llm-load-plugins.sh
if: matrix.os != 'windows-latest'
run: |
llm install llm-cluster llm-mistral
./tests/test-llm-load-plugins.sh
- name: Upload artifact of builds
if: matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/*

View file

@ -58,7 +58,7 @@ You'll need [Just](https://github.com/casey/just) installed to run this command.
To release a new version:
1. Update `docs/changelog.md` with the new changes.
2. Update the version number in `setup.py`
2. Update the version number in `pyproject.toml`
3. [Create a GitHub release](https://github.com/simonw/llm/releases/new) for the new version.
4. Wait for the package to push to PyPI and then...
5. Run the [regenerate.yaml](https://github.com/simonw/homebrew-llm/actions/workflows/regenerate.yaml) workflow to update the Homebrew tap to the latest version.

71
pyproject.toml Normal file
View file

@ -0,0 +1,71 @@
[project]
name = "llm"
version = "0.24.2"
description = "CLI utility and Python library for interacting with Large Language Models from organizations like OpenAI, Anthropic and Gemini plus local models installed on your own machine."
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "Simon Willison" },
]
license = "Apache-2.0"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Text Processing :: Linguistic",
"Topic :: Utilities",
]
dependencies = [
"click",
"condense-json>=0.1.2",
"openai>=1.55.3",
"click-default-group>=1.2.3",
"sqlite-utils>=3.37",
"sqlite-migrate>=0.1a2",
"pydantic>=2.0.0",
"PyYAML",
"pluggy",
"python-ulid",
"setuptools",
"pip",
"pyreadline3; sys_platform == 'win32'",
"puremagic",
]
[project.urls]
Homepage = "https://github.com/simonw/llm"
Documentation = "https://llm.datasette.io/"
Issues = "https://github.com/simonw/llm/issues"
CI = "https://github.com/simonw/llm/actions"
Changelog = "https://github.com/simonw/llm/releases"
[project.scripts]
llm = "llm.cli:cli"
[project.optional-dependencies]
test = [
"build",
"pytest",
"numpy",
"pytest-httpx>=0.33.0",
"pytest-asyncio",
"cogapp",
"mypy>=1.10.0",
"black>=25.1.0",
"ruff",
"types-click",
"types-PyYAML",
"types-setuptools",
]
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

View file

@ -1,70 +0,0 @@
from setuptools import setup, find_packages
import os
VERSION = "0.24.2"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="llm",
description=(
"CLI utility and Python library for interacting with Large Language Models from "
"organizations like OpenAI, Anthropic and Gemini plus local models installed on your own machine."
),
long_description=get_long_description(),
long_description_content_type="text/markdown",
author="Simon Willison",
url="https://github.com/simonw/llm",
project_urls={
"Documentation": "https://llm.datasette.io/",
"Issues": "https://github.com/simonw/llm/issues",
"CI": "https://github.com/simonw/llm/actions",
"Changelog": "https://github.com/simonw/llm/releases",
},
license="Apache License, Version 2.0",
version=VERSION,
packages=find_packages(),
entry_points="""
[console_scripts]
llm=llm.cli:cli
""",
install_requires=[
"click",
"condense-json>=0.1.2",
"openai>=1.55.3",
"click-default-group>=1.2.3",
"sqlite-utils>=3.37",
"sqlite-migrate>=0.1a2",
"pydantic>=2.0.0",
"PyYAML",
"pluggy",
"python-ulid",
"setuptools",
"pip",
"pyreadline3; sys_platform == 'win32'",
"puremagic",
],
extras_require={
"test": [
"pytest",
"numpy",
"pytest-httpx>=0.33.0",
"pytest-asyncio",
"cogapp",
"mypy>=1.10.0",
"black>=25.1.0",
"ruff",
"types-click",
"types-PyYAML",
"types-setuptools",
]
},
python_requires=">=3.9",
)