Saravanan666/pypi-org huggingface dataset:
Package: datasette-events-forward
datasette-events-forwardForward Datasette events to another instanceInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-events-forwardConfigurationConfigure the plugin like so:{"plugins":{"datasette-events-forward":{"api_token":"***","api_url":"https://stats.datasette.cloud/data/-/create","instance":"localhost"}}}The plugin will then gather all events and forward them to the specified instance, adding them to a table calleddatasette_eventswhich will be created if it does not exist.Theinstancekey can be used to differentiate different instances that report to the same backend. Events are identified with a ULID to ensure they are unique even across different instances.Events are forwarded in batches of up to 10, no more than once every 10 seconds.Full list of configuration settings:api_url: The write API URL of a Datasette instance to forward the events to.api_token: The API token to use when sending events. Use{"$env": "FORWARD_TOKEN"}to read the token from theFORWARD_TOKENenvironment variable.instance: A string to identify the instance that is sending the events.Theapi_urlcan be either ahttps://datasette.example.com/data/datasette_events/-/insertendpoint for inserting rows, or ahttps://datasette.example.com/data/-/createendpoint for creating a table and inserting rows into it. If the table does not yet exist you should use the/-/createvariant, otherwise use the/-/insertvariant.If you use/-/insertyour API token just needsinsert-rowpermissions. For/-/createyou will needcreate-tablepermissions as well.And to control the rate at which batches of events are sent to the Datasette write API:batch_limit: The number of events to send in each batch, defaults to 10. The Datasette write API has a 100 row limit by default so this should be set to a value less than that.max_rate: The maximum number of deliver HTTP requests to send in the specified time period, defaults to 1.time_period: The time period for the rate limiting in seconds, defaults to 10.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-events-forward
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-explain
datasette-explainExplain SQL queries executed using DatasetteInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-explainUsageThe plugin adds JavaScript to the query editor page which will constantly update the page with information gained from running EXPLAIN QUERY PLAN queries against the entered SQL.This may result in an error message, or it may show the query plan along with any tables used by the query.DemoYou can see this plugin in action ondatasette.simonwillison.net.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-explain
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-export
datasette-exportExport pages from Datasette to files on diskInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-exportUsageThis plugin adds a newexportcommand. You can use this to export one or more pages from Datasette to files on disk.Pass the--pathoption one or more times to specify pages:datasette export mydata.db --path / --path /mydata.json --path /mydata/table1.csvThis will create anexport/directory and save the following files to it:index.htmlmydata.jsonmydata/table1.csvUse--outputto specify an alternative directory for the export:datasette export mydata.db --path / --output mywebsite/In addition to specifying paths, you can pass one or more SQL queries that can return lists of pages to be exported:datasette export mydata.db --sql "select path from pages"For example, to export JSON for every row in thefixtures/facetabletable:datasette export fixtures.db \
  --sql "select '/fixtures/facetable/' || pk || '.json' from facetable"DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-export
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-export-notebook
datasette-export-notebookDatasette plugin providing instructions for exporting data to aJupyterorObservablenotebook.InstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-export-notebookUsageOnce installed, the plugin will add a.Notebookexport option to every table and query. Clicking on this link will show instructions for exporting the data to Jupyter or Observable.DemoYou can see this plugin in action on thelatest-with-plugins.datasette.ioDatasette instance - for example on/github/commits.Notebook.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-export-notebook
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and tests:pip install -e '.[test]'To run the tests:pytest
Package: datasette-expose-env
datasette-expose-envDatasette plugin to expose selected environment variables at/-/envfor debuggingInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-expose-envConfigurationDecide on a list of environment variables you would like to expose, then add the following to yourmetadata.ymlconfiguration:plugins:datasette-expose-env:-ENV_VAR_1-ENV_VAR_2-ENV_VAR_3If you are using JSON in ametadata.jsonfile use the following:{"plugins":{"datasette-expose-env":["ENV_VAR_1","ENV_VAR_2","ENV_VAR_3"]}}Visit/-/envon your Datasette instance to see the values of the environment variables.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-expose-env
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-external-links-new-tabs
datasette-external-links-new-tabsDatasette plugin to open external links in new tabsInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-external-links-new-tabsUsageThere are no usage instructions, it simply opens external links in a new tab.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-external-links-new-tabs
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-geojson
datasette-geojsonAdd GeoJSON as an output option for datasette queries.InstallationInstall this plugin in the same environment as Datasette.datasette install datasette-geojsonUsageTo render GeoJSON, add a.geojsonextension to any query URL that includes ageometrycolumn. That column should be a validGeoJSON geometry.For example, you might usegeojson-to-sqliteorshapefile-to-sqliteto loadneighborhood boundariesinto a SQLite database.wget-Oneighborhoods.geojsonhttps://opendata.arcgis.com/datasets/3525b0ee6e6b427f9aab5d0a1d0a1a28_0.geojson
geojson-to-sqliteboston.dbneighborhoodsneighborhoods.geojson--spatial-index# create a spatial indexdatasetteserveboston.db--load-extensionspatialiteIf you're using Spatialite, the geometry column will be in a binary format. If not, make sure thegeometrycolumn is a well-formedGeoJSON geometry. If you usedgeojson-to-sqliteorshapefile-to-sqlite, you should be all set.Run this query in Datasette and you'll see a link to download GeoJSON:selectrowid,OBJECTID,Name,Acres,Neighborhood_ID,SqMiles,ShapeSTArea,ShapeSTLength,geometryfromneighborhoodsorderbyrowidlimit101Note that the geometry column needs to be explicitlynamedgeometryor you won't get the option to export GeoJSON. If you want to use a different column, rename it withAS:SELECT other AS geometry FROM my_table.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-geojson
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and tests:pip install -e '.[test]'To run the tests:pytest
Package: datasette-geojson-map
datasette-geojson-mapRender a map for any query with a geometry columnInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-geojson-mapUsageStart by loading a GIS file.For example, you might usegeojson-to-sqliteorshapefile-to-sqliteto loadneighborhood boundariesinto a SQLite database.wget-Oneighborhoods.geojsonhttps://opendata.arcgis.com/datasets/3525b0ee6e6b427f9aab5d0a1d0a1a28_0.geojson
geojson-to-sqliteboston.dbneighborhoodsneighborhoods.geojson(The command above uses Spatialite, but that's not required.)Start updatasetteand navigate to theneighborhoodstable.datasetteserveboston.db# in another terminal tabopenhttp://localhost:8001/boston/neighborhoodsYou should see a map centered on Boston with each neighborhood outlined. Clicking a boundary will bring up a popup with details on that feature.This plugin relies on (and will install)datasette-geojson. Any query that includes ageometrycolumn will produce a map of the results. This also includes single row views.Run the includeddemoproject to see it live.ConfigurationThis project uses the same map configuration asdatasette-cluster-map. Here's how you would useStamen's terrain tiles:plugins:datasette-geojson-map:tile_layer:https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.{ext}tile_layer_options:attribution:>-Map tiles by <a href="http://stamen.com">Stamen Design</a>,under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>.Data by <a href="http://openstreetmap.org">OpenStreetMap</a>,under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.subdomains:abcdminZoom:1maxZoom:16ext:jpgOptions:tile_layer: Use a URL template that can be passed to aLeaflet Tilelayertile_layer_options: All options will be passed to the tile layer. SeeLeaflet documentationfor more on possible values here.Styling map featuresMap features can be styled using thesimplestyle-spec. This requires setting specific fields on returned rows. Here's an example:SELECTName,geometry,"#ff0000"asfill,"#0000ff"asstroke,0.2asstroke-width,fromneighborhoodsThat will render a neighborhood map where each polygon is filled in red, outlined in blue and lines are 0.2 pixels wide.A more useful approach would use theCASEstatement to color features based on data:SELECTName,geometry,CASENameWHEN"Roslindale"THEN"#ff0000"WHEN"Dorchester"THEN"#0000ff"ELSE"#dddddd"ENDfillFROMneighborhoodsThis will fill Roslindale in red, Dorchester in blue and all other neighborhoods in gray.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-geojson-map
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-gfm
datasette-gfmExport Datasette records as GitHub flavoured markdownInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-gfmUsageHaving installed this plugin, every table and query will gain a new.mdexport link.You can also construct these URLs directly:/dbname/tablename.mdDemoTBDDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-gfm
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and tests:pip install -e '.[test]'To run the tests:pytestThanksThis plugin is very heavily based ondatasette-yamlby Simon Willison.
Package: datasette-granian
datasette-granianRun Datasette using the Granian HTTP serverInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-granianUsageRundatasette granian ...instead ofdatasette serve ...- most options should remain the same.% datasette granian fixtures.db content.db --crossdb
[INFO] Starting granian
[INFO] Listening at: 127.0.0.1:8001
[INFO] Booting worker-1 with pid: 92793
[INFO] Started worker-1
[INFO] Started worker-1 runtime-1DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-granian
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-gzip
datasette-gzipAdd gzip compression to DatasetteInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-gzipUsageOnce installed, Datasette will obey theAccept-Encoding:header sent by browsers or other user agents and return content compressed in the most appropriate way.This plugin is a thin wrapper for theasgi-gzip library, which extracts theGzipMiddlewarefrom Starlette.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-gzip
python3 -mvenv venv
source venv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-hashed-urls
datasette-hashed-urlsOptimize Datasette performance behind a caching proxyWhen you open a database file in immutable mode using the-ioption, Datasette calculates a SHA-256 hash of the contents of that file on startup.This content hash can then optionally be used to create URLs that are guaranteed to change if the contents of the file changes in the future.The result is pages  that can be cached indefinitely by both browsers and caching proxies - providing a significant performance boost.DemoA demo of this plugin is running athttps://datasette-hashed-urls.vercel.app/InstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-hashed-urlsUsageOnce installed, this plugin will act on any immutable database files that are loaded into Datasette:datasette -i fixtures.dbThe database will automatically be renamed to incorporate a hash of the contents of the SQLite file - so the above database would be served as:http://127.0.0.1:8001/fixtures-aa7318bEvery page that accesss that database, including JSON endpoints, will be served with the following far-future cache expiry header:cache-control: max-age=31536000, publicHeremax-age=31536000is the number of seconds in a year.A caching proxy such as Cloudflare can then be used to cache and accelerate content served by Datasette.When the database file is updated and the server is restarted, the hash will change and content will be served from a new URL. Any hits to the previous hashed URLs will be automatically redirected.If you run Datasette using the--crossdboption to enablecross-database queriesthe_memorydatabase will also have a hash added to its URL - in this case, the hash will be a combination of the hashes of the other attached databases.ConfigurationYou can use themax_ageplugin configuration setting to change the cache duration specified in thecache-controlHTTP header.To set the cache expiry time to one hour you would add this to your Datasettemetadata.jsonconfiguration file:{"plugins":{"datasette-hashed-urls":{"max_age":3600}}}HistoryThis functionality used to ship as part of Datasette itself, as a feature calledHashed URL mode.That feature has been deprecated and will be removed in Datasette 1.0. This plugin should be used as an alternative.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-hashed-urls
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-haversine
datasette-haversineDatasette plugin that adds a custom SQL function for haversine distancesInstall this plugin in the same environment as Datasette to enable thehaversine()SQL function.datasetteinstalldatasette-haversineThe plugin is built on top of thehaversinelibrary.haversine() to calculate distancesselecthaversine(lat1,lon1,lat2,lon2);This will return the distance in kilometers between the point defined by(lat1, lon1)and the point defined by(lat2, lon2).DemoYou can try this functionhere using Datasette Lite.selecthaversine(40.7128,-74.0060,-- New York37.7749,-122.4194,-- San Francisco'mi')asdistance_in_miles;Custom unitsBy defaulthaversine()returns results in km. You can pass an optional third argument to get results in a different unit:ftfor feetmfor metersinfor inchesmifor milesnmifor nautical mileskmfor kilometers (the default)selecthaversine(lat1,lon1,lat2,lon2,'mi');
Package: datasette-haversine-point-path
datasette-haversine-point-pathDatasette plugin that adds a custom SQL function for shortest haversine distances between a point and a path on a sphereInstall this plugin in the same environment as Datasette to enable thehaversine_point_path()SQL function.datasetteinstalldatasette-haversine-point-pathThe plugin is built on top of thehaversinelibrary.haversine_point_path() to calculate distancesselecthaversine_point_path(lat1,lon1,lat2,lon2,lat3,lon3);This will return the distance in kilometers between the path defined by(lat1, lon1),(lat2, lon2), and the point defined by(lat3, lon3).DemoNo demo yetCustom unitsBy defaulthaversine_point_path()returns results in km. You can pass an optional third argument to get results in a different unit:ftfor feetmfor metersinfor inchesmifor milesnmifor nautical mileskmfor kilometers (the default)selecthaversine_point_path(lat1,lon1,lat2,lon2,'mi');
Package: datasette-hello-world
datasette-hello-worldThe hello world of Datasette pluginsInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-hello-worldUsageRun this to see "Hello world":datasette hello-worldDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-hello-world
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-homepage-table
datasette-homepage-tableShow a specific Datasette table on the homepageInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-homepage-tableUsageThis plugin changes the Datasette homepage to display a table instead of the default list of databases.Without configuration, it will take the first table in the first attached database.Alternatively you can configure it like this:{"plugins":{"datasette-homepage-table":{"database":"mydatabase","table":"mytable"}}}Both keys are optional: if you omitdatabaseit will use the first attached database, and if you omittableit will use the first table in the database.You can customize thetable.htmltemplate tochange the appearance of the table.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-homepage-table
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-hovercards
datasette-hovercardsAdd preview hovercards to links in DatasetteInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-hovercardsUsageOnce installed, hovering over a link to a row within the Datasette interface - for example a foreign key reference on the table page - should show a hovercard with a preview of that row.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-hovercards
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: datasette-ics
datasette-icsDatasette plugin that adds support for generatingiCalendar .ics fileswith the results of a SQL query.InstallationInstall this plugin in the same environment as Datasette to enable the.icsoutput extension.$ pip install datasette-icsUsageTo create an iCalendar file you need to define a custom SQL query that returns a required set of columns:event_name- the short name for the eventevent_dtstart- when the event startsThe following columns are optional:event_dtend- when the event endsevent_duration- the duration of the event (use instead ofdtend)event_description- a longer description of the eventevent_uid- a globally unique identifier for this eventevent_tzid- the timezone for the event, e.g.America/ChicagoA query that returns these columns can then be returned as an ics feed by adding the.icsextension.DemoThis SQL querycalculates the lowest tide per day at Pillar Point in Half Moon Bay, California.Since the query returnsevent_name,event_dtstartandevent_tzidcolumns it producesthis ICS feed. If you subscribe to that in a calendar application such as Apple Calendar you get something that looks like this:Using a canned queryDatasette'scanned query mechanismcan be used to configure calendars. If a canned query definition has atitlethat will be used as the title of the calendar.Here's an example, defined using ametadata.yamlfile:databases:mydatabase:queries:calendar:title:My Calendarsql:|-selecttitle as event_name,start as event_dtstart,description as event_descriptionfromeventsorder bystartlimit100This will result in a calendar feed athttp://localhost:8001/mydatabase/calendar.ics
Package: datasette-import-table
datasette-import-tableDatasette plugin for importing tables from other Datasette instancesInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-import-tableUsageVisit/-/import-tablefor the interface. Paste in the URL to a table page on another Datasette instance and click the button to import that table.By default onlythe root actorcan access the page - so you'll need to run Datasette with the--rootoption and click on the link shown in the terminal to sign in and access the page.Theimport-tablepermission governs access. You can use permission plugins such asdatasette-permissions-sqlto grant additional access to the write interface.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-import-table
python3 -mvenv venv
source venv/bin/activateOr if you are usingpipenv:pipenv shellNow install the dependencies and tests:pip install -e '.[test]'To run the tests:pytest