diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a393230a9..d325f6950 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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/* diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index 884312026..62d5746e9 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -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]' diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 0aa898625..410edafc8 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -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 diff --git a/.github/workflows/test-sqlite-support.yml b/.github/workflows/test-sqlite-support.yml index 5c8a9a4ba..83a8fd39b 100644 --- a/.github/workflows/test-sqlite-support.yml +++ b/.github/workflows/test-sqlite-support.yml @@ -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: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 93ced81c1..24123f86a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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]' diff --git a/.gitignore b/.gitignore index 7947f3325..a276b5fef 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ venv .hypothesis Pipfile Pipfile.lock -pyproject.toml tests/*.dylib tests/*.so tests/*.dll diff --git a/docs/contributing.rst b/docs/contributing.rst index 2e883eebf..de00bb347 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -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 ` with highlights of the new version. An example `commit can be seen here `__:: +To release a new version, first create a commit that updates the version number in ``pyproject.toml`` and the :ref:`the changelog ` with highlights of the new version. An example `commit can be seen here `__:: # Update changelog git commit -m " Release 3.29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..5b4b47986 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,81 @@ +[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", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "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", + "flake8-pyproject", +] + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.flake8] +max-line-length = 160 +# Black compatibility, E203 whitespace before ':': +extend-ignore = ["E203"] + +[tool.setuptools.package-data] +sqlite_utils = ["py.typed"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6b9c88509..000000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[flake8] -max-line-length = 160 -# Black compatibility, E203 whitespace before ':': -extend-ignore = E203 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 143b71a58..000000000 --- a/setup.py +++ /dev/null @@ -1,83 +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-2.0", - license_files=[ - "LICENSE", - ], - 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", - "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, -) diff --git a/tests/test_extracts.py b/tests/test_extracts.py index cca16ba5c..f24e448ca 100644 --- a/tests/test_extracts.py +++ b/tests/test_extracts.py @@ -25,7 +25,7 @@ def test_extracts(fresh_db, kwargs, expected_table, use_table_factory): {"id": 2, "species_id": "Oak"}, {"id": 3, "species_id": "Palm"}, ], - **insert_kwargs + **insert_kwargs, ) # Should now have two tables: Trees and Species assert {expected_table, "Trees"} == set(fresh_db.table_names())