Port pyproject.toml to setup.py, refs #675

This commit is contained in:
Simon Willison 2025-11-23 12:27:34 -08:00
commit 9e5735e287
9 changed files with 84 additions and 92 deletions

View file

@ -18,7 +18,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: setup.py
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install -e '.[test]'
@ -35,14 +35,14 @@ jobs:
with:
python-version: '3.13'
cache: pip
cache-dependency-path: setup.py
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install setuptools wheel twine
pip install build twine
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*

View file

@ -12,7 +12,7 @@ jobs:
with:
python-version: "3.12"
cache: pip
cache-dependency-path: setup.py
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install -e '.[docs]'

View file

@ -18,7 +18,7 @@ jobs:
with:
python-version: "3.11"
cache: pip
cache-dependency-path: setup.py
cache-dependency-path: pyproject.toml
- name: Install SpatiaLite
run: sudo apt-get install libsqlite3-mod-spatialite
- name: Install Python dependencies

View file

@ -25,8 +25,7 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
cache-dependency-path: setup.py
cache-dependency-path: setup.py
cache-dependency-path: pyproject.toml
- name: Set up SQLite ${{ matrix.sqlite-version }}
uses: asg017/sqlite-versions@71ea0de37ae739c33e447af91ba71dda8fcf22e6
with:

View file

@ -21,7 +21,7 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
cache-dependency-path: setup.py
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install -e '.[test,mypy,flake8]'

1
.gitignore vendored
View file

@ -16,7 +16,6 @@ venv
.hypothesis
Pipfile
Pipfile.lock
pyproject.toml
tests/*.dylib
tests/*.so
tests/*.dll

View file

@ -144,7 +144,7 @@ We increment ``minor`` for new features.
We increment ``patch`` for bugfix releass.
To release a new version, first create a commit that updates the version number in ``setup.py`` and the :ref:`the changelog <changelog>` with highlights of the new version. An example `commit can be seen here <https://github.com/simonw/sqlite-utils/commit/b491f22d817836829965516983a3f4c3c72c05fc>`__::
To release a new version, first create a commit that updates the version number in ``pyproject.toml`` and the :ref:`the changelog <changelog>` with highlights of the new version. An example `commit can be seen here <https://github.com/simonw/sqlite-utils/commit/b491f22d817836829965516983a3f4c3c72c05fc>`__::
# Update changelog
git commit -m " Release 3.29

75
pyproject.toml Normal file
View file

@ -0,0 +1,75 @@
[project]
name = "sqlite-utils"
version = "4.0a0"
description = "CLI tool and Python library for manipulating SQLite databases"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
{ name = "Simon Willison" },
]
license = "Apache-2.0"
requires-python = ">=3.10"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Database",
]
dependencies = [
"click",
"click-default-group>=1.2.3",
"pluggy",
"python-dateutil",
"sqlite-fts4",
"tabulate",
]
[project.urls]
Homepage = "https://github.com/simonw/sqlite-utils"
Documentation = "https://sqlite-utils.datasette.io/en/stable/"
Changelog = "https://sqlite-utils.datasette.io/en/stable/changelog.html"
Issues = "https://github.com/simonw/sqlite-utils/issues"
CI = "https://github.com/simonw/sqlite-utils/actions"
[project.scripts]
sqlite-utils = "sqlite_utils.cli:cli"
[project.optional-dependencies]
test = [
"black>=24.1.1",
"cogapp",
"hypothesis",
"pytest",
]
docs = [
"beanbag-docutils>=2.0",
"codespell",
"furo",
"pygments-csv-lexer",
"sphinx-autobuild",
"sphinx-copybutton",
]
mypy = [
"data-science-types",
"mypy",
"types-click",
"types-pluggy",
"types-python-dateutil",
"types-tabulate",
]
flake8 = [
"flake8",
]
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[tool.setuptools.package-data]
sqlite_utils = ["py.typed"]

View file

@ -1,81 +0,0 @@
from setuptools import setup, find_packages
import io
import os
VERSION = "4.0a0"
def get_long_description():
with io.open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="sqlite-utils",
description="CLI tool and Python library for manipulating SQLite databases",
long_description=get_long_description(),
long_description_content_type="text/markdown",
author="Simon Willison",
version=VERSION,
license="Apache License, Version 2.0",
packages=find_packages(exclude=["tests", "tests.*"]),
package_data={"sqlite_utils": ["py.typed"]},
install_requires=[
"sqlite-fts4",
"click",
"click-default-group>=1.2.3",
"tabulate",
"python-dateutil",
"pluggy",
],
extras_require={
"test": ["pytest", "black>=24.1.1", "hypothesis", "cogapp"],
"docs": [
"furo",
"sphinx-autobuild",
"codespell",
"sphinx-copybutton",
"beanbag-docutils>=2.0",
"pygments-csv-lexer",
],
"mypy": [
"mypy",
"types-click",
"types-tabulate",
"types-python-dateutil",
"types-pluggy",
"data-science-types",
],
"flake8": ["flake8"],
},
entry_points="""
[console_scripts]
sqlite-utils=sqlite_utils.cli:cli
""",
url="https://github.com/simonw/sqlite-utils",
project_urls={
"Documentation": "https://sqlite-utils.datasette.io/en/stable/",
"Changelog": "https://sqlite-utils.datasette.io/en/stable/changelog.html",
"Source code": "https://github.com/simonw/sqlite-utils",
"Issues": "https://github.com/simonw/sqlite-utils/issues",
"CI": "https://github.com/simonw/sqlite-utils/actions",
},
python_requires=">=3.10",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: End Users/Desktop",
"Topic :: Database",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
# Needed to bundle py.typed so mypy can see it:
zip_safe=False,
)