Saravanan666/pypi-org huggingface dataset:
Package: datasette-indieauth
datasette-indieauthDatasette authentication usingIndieAuth.DemoYou can try out the latest version of this plugin atdatasette-indieauth-demo.datasette.ioInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-indieauthUsageEnsure you have a website with a domain that supports IndieAuth or RelMeAuth. The easiest way to do that is to add the following HTML to your homepage, linking to your personal GitHub profile:<linkhref="https://github.com/simonw"rel="me"><linkrel="authorization_endpoint"href="https://indieauth.com/auth">Your GitHub profile needs to link back to your website, to prove that your GitHub account should be a valid identifier for that page.Now visit/-/indieauthon your Datasette instance to begin the sign-in progress.ActorWhen a user signs in using IndieAuth they will be recieve a signedds_actorcookie identifying them as anactorthat looks like this:{"me":"https://simonwillison.net/","display":"simonwillison.net"}If the IndieAuth server returned additional"profile"fields those will be merged into the actor. You can visit/-/actoron your Datasette instance to see the full actor you are currently signed in as.Restricting access with the restrict_access plugin configurationYou can useDatasette's permissions systemto control permissions of authenticated users - by default, an authenticated user will be able to perform the same actions as an unauthenticated user.As a shortcut if you want to lock down access to your instance entirely to just specific users, you can use therestrict_accessplugin configuration option like this:{"plugins":{"datasette-indieauth":{"restrict_access":"https://simonwillison.net/"}}}This can be a string or a list of user identifiers. It can also be a space separated list, which means you can use it with thedatasette publish--plugin-secretconfiguration option to set permissions as part of a deployment, like this:datasette publish vercel mydb.db --project my-secret-db \
    --install datasette-indieauth \
    --plugin-secret datasette-indieauth restrict_access https://simonwillison.net/DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-indieauth
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-init
datasette-initEnsure specific tables and views exist on startupInstallationInstall this plugin in the same environment as Datasette.$ pip install datasette-initUsageThis plugin is configured usingmetadata.json(ormetadata.yaml).Creating tablesAdd a block like this that specifies the tables you would like to ensure exist:{"plugins":{"datasette-init":{"my_database":{"tables":{"dogs":{"columns":{"id":"integer","name":"text","age":"integer","weight":"float"},"pk":"id"}}}}}}Any tables that do not yet exist will be created when Datasette first starts.Valid column types are"integer","text","float"and"blob".The"pk"is optional, and is used to define the primary key. To define a compound primary key (across more than one column) use a list of column names here:"pk":["id1","id2"]Creating viewsThe plugin can also be used to create views:{"plugins":{"datasette-init":{"my_database":{"views":{"my_view":"select 1 + 1"}}}}}Each view in the"views"block will be created when the Database first starts. If a view with the same name already exists it will be replaced with the new definition.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-init
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-insert-unsafe
datasette-insert-unsafeUnsafe permissions for datasette-insert - allows all actions without authenticationInstallationInstall this plugin in the same environment as Datasette.$ pip install datasette-insert-unsafeUsageOnce installed, all actions performed usingdatasette-insertwill be allowed without authentication.This isnot safeif you are running Datasette withdatasette-inserton the public internet. You should only use this plugin if you are running Datasette on your own local machine, or on a private network.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-insert-unsafe
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-jellyfish
datasette-jellyfishDatasette plugin that adds custom SQL functions for fuzzy string matching, built on top of theJellyfishPython library by James Turk and Michael Stephens.Interactive demos:soundex, metaphone, nysiis, match_rating_codex comparison.distance functions comparisonExamples:SELECT soundex("hello");
    -- Outputs H400
SELECT metaphone("hello");
    -- Outputs HL
SELECT nysiis("hello");
    -- Outputs HAL
SELECT match_rating_codex("hello");
    -- Outputs HLL
SELECT levenshtein_distance("hello", "hello world");
    -- Outputs 6
SELECT damerau_levenshtein_distance("hello", "hello world");
    -- Outputs 6
SELECT hamming_distance("hello", "hello world");
    -- Outputs 6
SELECT jaro_similarity("hello", "hello world");
    -- Outputs 0.8181818181818182
SELECT jaro_winkler_similarity("hello", "hello world");
    -- Outputs 0.890909090909091
SELECT match_rating_comparison("hello", "helloo");
    -- Outputs 1Seethe Jellyfish documentationfor an explanation of each of these functions.
Package: datasette-jq
datasette-jqDatasette plugin that adds custom SQL functions for executingjqexpressions against JSON values.Install this plugin in the same environment as Datasette to enable thejq()SQL function.Usage:select jq(
    column_with_json,
    "{top_3: .classifiers[:3], v: .version}"
)Seethe jq manualfor full details of supported expression syntax.Interactive demoYou can try this plugin out atdatasette-jq-demo.datasette.ioSample query:select package, "https://pypi.org/project/" || package || "/" as url,
jq(info, "{summary: .info.summary, author: .info.author, versions: .releases|keys|reverse}")
from packagesTry this query outin the interactive demo.
Package: datasette-json-preview
datasette-json-previewPreview of new JSON default format for Datasette, seeissue #782This plugin will continue to change while the new output format is explored.InstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-json-previewUsageUse the.json-previewextension to preview the new JSON API design.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-json-preview
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-jupyterlite
datasette-jupyterliteJupyterLiteas a Datasette pluginInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-jupyterliteDemoYou can try out a demo of the plugin here:https://latest-with-plugins.datasette.io/jupyterlite/Run this example code in a Pyolite notebook to pull all of the data from thegithub/starstable into a Pandas DataFrame:importpandas,pyodidedf=pandas.read_csv(pyodide.open_url("https://latest-with-plugins.datasette.io/github/stars.csv?_labels=on&_stream=on&_size=max"))UsageOnce installed, visit/jupyterlite/to access JupyterLite served from your Datasette instance.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-jupyterlite
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-leaflet
datasette-leafletDatasette plugin adding theLeafletJavaScript library.A growing number of Datasette plugins depend on the Leaflet JavaScript mapping library. They each have their own way of loading Leaflet, which could result in loading it multiple times (with multiple versions) if more than one plugin is installed.This library is intended to solve this problem, by providing a single plugin they can all depend on that loads Leaflet in a reusable way.Plugins that use this:datasette-leaflet-freedrawdatasette-leaflet-geojsondatasette-cluster-mapInstallationYou can install this plugin like so:datasette install datasette-leafletUsually this plugin will be a dependency of other plugins, so it should be installed automatically when you install them.UsageThe plugin makesleaflet.jsandleaflet.cssavailable as static files. It provides two custom template variables with the URLs of those two files.{{ datasette_leaflet_url }}is the URL to the JavaScript{{ datasette_leaflet_css_url }}is the URL to the CSSThese URLs are also made available as global JavaScript constants:datasette.leaflet.JAVASCRIPT_URLdatasette.leaflet.CSS_URLThe JavaScript is packaed as aJavaScript module. You can dynamically import the JavaScript from a custom template like this:<scripttype="module">import('{{datasette_leaflet_url}}').then((leaflet)=>{/* Use leaflet here */});</script>You can load the CSS like this:<linkrel="stylesheet"href="{{datasette_leaflet_css_url}}">Or dynamically like this:<script>letlink=document.createElement('link');link.rel='stylesheet';link.href='{{datasette_leaflet_css_url}}';document.head.appendChild(link);</script>Here's a full example that loads the JavaScript and CSS and renders a map:<scripttype="module">window.DATASETTE_CLUSTER_MAP_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS={"maxZoom":19,"detectRetina":true,"attribution":"&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"};letlink=document.createElement('link');link.rel='stylesheet';link.href='{{datasette_leaflet_css_url}}';document.head.appendChild(link);import('{{datasette_leaflet_url}}').then((leaflet)=>{letdiv=document.createElement('div');div.style.height='400px';document.querySelector('.content').appendChild(div);lettiles=leaflet.tileLayer(window.DATASETTE_CLUSTER_MAP_TILE_LAYER,window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS);letmap=leaflet.map(div,{center:leaflet.latLng(0,0),zoom:2,layers:[tiles]});});</script>
Package: datasette-leaflet-freedraw
datasette-leaflet-freedrawDraw polygons on maps in DatasetteProject background:Drawing shapes on a map to query a SpatiaLite database.InstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-leaflet-freedrawUsageIf a table has a SpatiaLitegeometrycolumn, the plugin will add a map interface to the table page allowing users to draw a shape on the map to find rows with a geometry that intersects that shape.The plugin can also work with arbitrary SQL queries. There it looks for input fields with a name offreedrawor that ends in_freedrawand replaces them with a map interface.The map interface uses theFreeDrawLeaflet plugin.DemoYou can try out this plugin to run searches against the GreenInfo Network California Protected Areas Database. Here'san example queryshowing mini parks in San Francisco:selectAsGeoJSON(geometry),*fromCPAD_2020a_SuperUnitswherePARK_NAMElike'%mini%'andIntersects(GeomFromGeoJSON(:freedraw),geometry)=1andCPAD_2020a_SuperUnits.rowidin(selectrowidfromSpatialIndexwheref_table_name='CPAD_2020a_SuperUnits'andsearch_frame=GeomFromGeoJSON(:freedraw))DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-leaflet-freedraw
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-leaflet-geojson
datasette-leaflet-geojsonDatasette plugin that replaces any GeoJSON column values with a Leaflet mapInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-leaflet-geojsonUsageAny columns containing valid GeoJSON strings will have their contents replaced with a Leaflet map when they are displayed in the Datasette interface.DemoYou can try this plugin out athttps://calands.datasettes.com/calands/superunits_with_mapsConfigurationBy default this plugin displays maps for the first ten rows, and shows a "Click to load map" prompt for rows past the first ten.You can change this limit using thedefault_maps_to_loadplugin configuration setting. Add this to yourmetadata.json:{"plugins":{"datasette-leaflet-geojson":{"default_maps_to_load":20}}}Then run Datasette withdatasette mydb.db -m metadata.json.
Package: datasette-litestream
datasette-litestreamAn experimental Datasette <-> Litestream plugin.InstallationInstall this plugin in the same environment as Datasette.datasette install datasette-litestreamUsageplugins:datasette-litestream:metrics-addr::9090all-replicate:-file://$PWD/$DB-backupReplicate a single database to a local directorydatabases:my_database:plugins:datasette-litestream:replicas:-path:./my_database-backupReplicate a single database to S3databases:my_database:plugins:datasette-litestream:replicas:-url:s3://my-bucket/my_databaseEnvironment variablesLITESTREAM_ACCESS_KEY_IDandLITESTREAM_SECRET_ACCESS_KEY.AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYEnvironment variables withaccess-key-idandsecret-access-keyconfig options.Raw values insecret-access-keyandsecret-access-keyconfig options.Replicate all databasesplugins:datasette-litestream:all-replicate:-s3://my-bucket/$DBConfigTop-levelThe following are valid keys that are allowed when specifying top-evelall-replicateaccess-key-idsecret-access-keymetrics-addrNone of these keys are required.Example:plugins:datasette-litestream:all-replicate:-XXX-YYYaccess-key-id:$YOUR_KEYsecret-access-key:$YOUR_SECRETmetrics-addr::5001Database-levelreplicasmonitor-intervalcheckpoint-intervalmin-checkpoint-page-countmax-checkpoint-page-countdatabases:my_database:plugins:datasette-litestream:replicas:-XXX-XXXmonitor-interval:XXXcheckpoint-interval:XXXmin-checkpoint-page-count:XXXmax-checkpoint-page-count:XXXDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-litestream
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-llm-embed
datasette-llm-embedDatasette plugin adding allm_embed(model_id, text)SQL function.Installationdatasetteinstalldatasette-llm-embedUsageAdds a SQL function that can be called like this:selectllm_embed('sentence-transformers/all-mpnet-base-v2','This is some text')This embeds the provided text using the specified embedding model and returns a binary blob, suitable for use with plugins such asdatasette-faiss.The models need to be installed usingLLMplugins such asllm-sentence-transformers.Usellm_embed_cosine(a, b)to calculate cosine similarity between two vector blobs:selectllm_embed_cosine(llm_embed('sentence-transformers/all-mpnet-base-v2','This is some text'),llm_embed('sentence-transformers/all-mpnet-base-v2','This is some other text'))Thellm_embed_decode()function can be used to decode a binary BLOB into a JSON array of floats:selectllm_embed_decode(llm_embed('sentence-transformers/all-mpnet-base-v2','This is some text'))Models that require API keysIf your embedding model needs an API key - for example theada-002model from OpenAI - you can configure that key inmetadata.yml(or JSON) like this:plugins:datasette-llm-embed:keys:ada-002:$env:OPENAI_API_KEYThe key here should be the full model ID of the model - not an alias.You can then set theOPENAI_API_KEYenvironment variable to the key you want to use before starting Datasette:exportOPENAI_API_KEY=sk-1234567890Once configured, calls like this will use the API key that has been provided:selectllm_embed('ada-002','This is some text')DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-llm-embed
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:
```bash
pytest
Package: datasette-low-disk-space-hook
datasette-low-disk-space-hookDatasette plugin providing the low_disk_space hook for other plugins to check for low disk spaceInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-low-disk-space-hookYou are unlikely to need to install this plugin directly though: it will usually be automatically be installed as a dependency of another plugin.UsageThis plugin adds a new plugin hook to Datasette calledlow_disk_space(datasette=datasette).It also adds a newspace_is_running_low(datasette)utility function which can be called to check if the Datasette instance is running out of space:fromdatasette_low_disk_space_hookimportspace_is_running_lowifawaitspace_is_running_low(datasette):print("Disk space is running low")The idea is for plugins such asdatasette-upload-csvsanddatasette-socratato call this hook before writing any new data into Datasette, to check if they should continue.Other plugins can then implement the hook to warn when Datasette is running out of space.Working together, this will help plugins avoid filling the disk entirely with data which could cause Datasette instances to crash.Implementing the hookAn implementation of this hook (in yet another plugin) looks like this:fromdatasetteimporthookimplimportshutil@hookimpldeflow_disk_space(self,datasette):usage=shutil.disk_usage("/mnt")# Fail at 95% or more usedif(usage.used/usage.total)>0.95:returnTrueThe plugin can also return anasyncfunction if it needs to useawaitas part of its execution:fromdatasetteimporthookimplfromsomewhereimportcheck_disk_usage_percentage_async@hookimpldeflow_disk_space(self,datasette):asyncdefinner():usage=awaitcheck_disk_usage_percentage_async("/mnt")ifusage>0.95:returnTruereturninnerDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-low-disk-space-hook
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-mailto-links
datasette-mailto-linksDatasette plugin to render email addresses asmailto:linksInstallationpip install datasette-mailto-linksConfigurationBy default, when installed datasette-mailto-links will search for values in any column that look like an email address and replace them with amailto:link. To restrict this behaviour to only certain columns, the plugin behaviour can be configured inmetadata.json. e.g:{"databases":{"my_db":{"tables":{"email":{"plugins":{"datasette-mailto-links":{"columns":["sender","recipient"]}}}}}}}The plugin can be disabled entirely for certain tables using"columns": []For more detail on Datasette plugin configuration seehttps://docs.datasette.io/en/latest/plugins.html#plugin-configuration
Package: datasette-mask-columns
datasette-mask-columnsDatasette plugin that masks specified database columnsInstallationpip install datasette-mask-columnsThis depends on plugin hook changes in a not-yet released branch of Datasette. Seeissue #678for details.UsageIn yourmetadata.jsonfile add a section like this describing the database and table in which you wish to mask columns:{"databases":{"my-database":{"plugins":{"datasette-mask-columns":{"users":["password"]}}}}}All SQL queries against theuserstable inmy-database.dbwill now returnnullfor thepasswordcolumn, no matter what value that column actually holds.The table page foruserswill display the textREDACTEDin the masked column. This visual hint will only be available on the table page; it will not display his text for arbitrary queries against the table.
Package: datasette-matomo
datasette-matomoDatasette pluginthat addsMatomo Web AnalyticsJavaScript tracking code to a Datasette application.InstallationInstall this plugin in the same environment as Datasette.datasette install datasette-matomoUsageMake your configuration available to the Datasette process as environment variables:DATASETTE_MATOMO_SERVER_URL=https://example.com/
DATASETTE_MATOMO_SITE_ID=1The server URL must include a final slash.If you usedatasette publish:datasette publish heroku example.db --install datasette-matomo \
    --plugin-secret datasette-matomo server_url http://example.com/ \
    --plugin-secret datasette-matomo site_id 1Note: not alldatasette publishproviders currently support the--plugin-secretoption.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-matomo
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-metadata-editable
datasette-metadata-editableA Datasette plugin for editing metadata on-the-fly. Work in progress.InstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-metadata-editableUsageUsage instructions go here.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-metadata-editable
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-mp3-audio
datasette-mp3-audioTurn .mp3 URLs into an audio player in the Datasette interfaceInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-mp3-audioDemoTry this plugin athttps://scotrail.datasette.io/scotrail/announcementsThe demo uses ScotRail train announcements frommatteason/scotrail-announcements-june-2022.UsageOnce installed, any cells with a value that ends in.mp3and starts with eitherhttp://or/orhttps://will be turned into an embedded HTML audio element like this:<audiocontrolssrc="... value ...">Audio not supported</audio>A "Play X MP3s on this page" button will be added to athe top of any table page listing more than one MP3.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-mp3-audio
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-multiline-links
datasette-multiline-linksMake multiple newline separated URLs clickable in DatasetteInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-multiline-linksUsageOnce installed, if a cell has contents like this:https://example.com
Not a link
https://google.comIt will be rendered as:<ahref="https://example.com">https://example.com</a>Not a link<ahref="https://google.com">https://google.com</a>DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-multiline-links
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest