simonw / datasette-plugin

Cookiecutter template for creating Datasette plugins
16 stars 5 forks source link

Port to pyproject.toml #18

Open simonw opened 10 months ago

simonw commented 10 months ago

Notes here https://til.simonwillison.net/python/pyproject - I've been using this for some of my own recent plugins, e.g. https://github.com/datasette/datasette-remote-actors

simonw commented 10 months ago

After some experimenting this seems to be the right pattern for static and templates inclusion:

[tool.setuptools.package-data]
datasette_chronicle = ["static/*", "templates/*"]
simonw commented 10 months ago

This commit shows the difference this made to the generated structure: https://github.com/simonw/datasette-plugin-template-demo/commit/80e4c481cb5b75cb2aa6d56f039ddf83387ceb8c

The new pyproject.toml file copied in from that commit looks like this:

[project]
name = "datasette-plugin-template-demo"
version = "0.1"
description = "Demonstrating https://github.com/simonw/datasette-plugin"
readme = "README.md"
authors = [{name = "Simon Willison"}]
license = {text = "Apache-2.0"}
classifiers=[
    "Framework :: Datasette",
    "License :: OSI Approved :: Apache Software License"
]
requires-python = ">=3.8"
dependencies = [
    "datasette"
]

[project.urls]
Homepage = "https://github.com/simonw/datasette-plugin-template-demo"
Changelog = "https://github.com/simonw/datasette-plugin-template-demo/releases"
Issues = "https://github.com/simonw/datasette-plugin-template-demo/issues"
CI = "https://github.com/simonw/datasette-plugin-template-demo/actions"

[project.entry-points.datasette]
plugin_template_demo = "datasette_plugin_template_demo"

[project.optional-dependencies]
test = ["pytest", "pytest-asyncio"]

[tool.pytest.ini_options]
asyncio_mode = "strict"

[tool.setuptools.package-data]
datasette_plugin_template_demo = ["static/*", "templates/*"]

Leaving this issue open until I successfully ship a new plugin built with this template.