Saravanan666/pypi-org huggingface dataset:
Package: datasette-debug-permissions
datasette-debug-permissionsA Datasette plugin that outputs debug information about permission checks.Installationdatasetteinstalldatasette-debug-permissionsUsageThis plugin adds debugging output to standard error as Datasette is running showing any times thepermission_allowed()plugin hook is called.SeeAuthentication and permissionsin the Datasette documentation for more on why this is useful.Example outputINFO:     Uvicorn running on http://127.0.0.1:8833 (Press CTRL+C to quit)
permission_allowed: action=view-instance, resource=<None>, actor=<None>
permission_allowed: action=view-database, resource=_internal, actor=<None>
permission_allowed: action=view-database, resource=mydatabase, actor=<None>
permission_allowed: action=view-database, resource=mydatabase, actor=<None>
permission_allowed: action=view-table, resource=('mydatabase', 'mytable'), actor=<None>
permission_allowed: action=view-table, resource=('mydatabase', 'mytable'), actor=<None>
permission_allowed: action=view-instance, resource=<None>, actor=<None>
permission_allowed: action=view-instance, resource=<None>, actor=<None>
permission_allowed: action=debug-menu, resource=<None>, actor=<None>DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-debug-permissions
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To install the JavaScript build dependencies, run this:npminstallYou can use theJustcommand runner to build the TypeScript to minified JavaScript like this:justjsTo run the tests:pytest
Package: datasette-dns
datasette-dnsCustom SQL function for making DNS lookupsInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-dnsUsageSo far the only supported SQL function is:select dns_txt("oreilly.com");Try this out inthe live demo.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-dns
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-doublemetaphone
datasette-doublemetaphoneDatasette plugin that adds custom SQL functions for fuzzy string matching,
built on top of theDouble MetaphonePython library.As SQLite custom functions must return a string, we have separate calls for
the two results, or one that returns a JSON array of the two results.Examples:SELECT double_metaphone_main("richard");
    -- Outputs 'RXRT'
SELECT double_metaphone_alt("richard");
    -- Outputs 'RKRT'
SELECT double_metaphone_json("richard");
    -- Outputs '["RXRT", "RKRT"]'
Package: datasette-edit-schema
datasette-edit-schemaDatasette plugin for modifying table schemasFeaturesAdd new columns to a tableRename columns in a tableModify the type of columns in a tableRe-order the columns in a tableRename a tableDelete a tableChange the primary key of a table to another column containing unique valuesUpdate the foreign key constraints on a tableAdd an index (or unique index) to a column on a tableDrop an index from a tableInstallationInstall this plugin in the same environment as Datasette.pipinstalldatasette-edit-schemaUsageNavigate to/-/edit-schema/dbname/tablenameon your Datasette instance to edit a specific table.Use/-/edit-schema/dbnameto create a new table in a specific database.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.PermissionsTheedit-schemapermission governs access. You can use permission plugins such asdatasette-permissions-sqlto grant additional access to the write interface.These permission checks will call thepermission_allowed()plugin hook with three arguments:actionwill be the string"edit-schema"actorwill be the currently authenticated actor - usually a dictionaryresourcewill be the string name of the databaseScreenshotDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-edit-schema
python3-mvenvvenvsourcevenv/bin/activateOr if you are usingpipenv:pipenvshellNow install the dependencies and tests:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-edit-templates
datasette-edit-templatesPlugin allowing Datasette templates to be edited within Datasette.InstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-edit-templatesUsageOn startup. a_templates_table will be created in the database you are running Datasette against.Use the app menu to navigate to the/-/edit-templatespage, and edit templates there.Changes should become visible instantly, and will be persisted to your database.The interface is only available to users with theedit-templatespermission.Therootuser is granted this permission by default. You can sign in as the root user usingdatasette mydb.db --root.ConfigurationTo put the_templates_table in a specific database, set thedatasette-edit-templates: databaseplugin configuration option:{"plugins":{"datasette-edit-templates":{"database":"some_database"}}}On Datasette1.0a5or higher you can use theinternal databasewith"internal_db: true":{"plugins":{"datasette-edit-templates":{"internal_db":true}}}By default theprepare_jinja2_environment()hook will be used to load the custom templates.You can disable this behavior using theskip_prepare_jinja2_environmentplugin configuration option:{"plugins":{"datasette-edit-templates":{"skip_prepare_jinja2_environment":true}}}Set this option if you want to further customize how the templates are loaded using another plugin.The menu item used to access this plugin is labeled "Edit templates" by default. You can customize this using themenu_labelplugin configuration option:{"plugins":{"datasette-edit-templates":{"menu_label":"Custom templates"}}}Set that tonullto hide the menu option entirely.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-edit-templates
python3-mvenvvenvsourcevenv/bin/activateOr if you are usingpipenv:pipenvshellNow install the dependencies and tests:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-enrichments
datasette-enrichmentsTools for running enrichments against data stored in DatasettePotential use-cases for enrichments include:Geocoding an address and populating a latitude and longitude columnExecuting a template to generate output based on the values in each rowFetching data from a URL and populating a column with the resultExecuting OCR against a linked image or PDF fileDocumentation for this plugin lives atenrichments.datasette.io.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-enrichments
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-enrichments-gmap-geocode
datasette-enrichments-gmap-geocodeGeocoding enrichment using Google Maps API
Everything in this repository is a refinement of theOpenCagerepository adapted to use Google Maps insteadInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-enrichments-gmap-geocodeUsageThis plugin adds an enrichment for geocoding using theGoogle Maps Geocoder.You will need an API key from Google Maps - you can sign up for a key that includes free usage that's fairly largeGoogle Maps API Key.Filter for data that you wish to geocode, then apply the Google Maps API geocoder enrichment.You'll need to specify a template to be passed to the geocoder, specifying which templates should be used as the input.If you have a single column containing the address, you can use this:{{ address }}If you have separate columns for the street, city, state and country, you can use this:{{ street }}, {{ city }}, {{ state }}, {{ country }}If your address column is missing the country, but all of the addresses are in the USA, you could use this:{{ address }}, USASee the Googlel Maps Geocodingdocsfor tips on how to get the best results.By default only the latitude and longitude from the geocoder will be stored, in thelatitudeandlongitudecolumns on your table. These columns will be created if they do not yet exist.You can optionally specify a column to store the full JSON output of the geocoder. This column will also be created if it does not exist.The full JSON format isdescribed here.ConfigurationYou can use this plugin without configuration, but you'll need to enter your API key every time you run an enrichment.To avoid that, you can set your API key as plugin configuration like this:exportMAPS_API_KEY="your-api-key"Then inmetadata.yml:plugins:datasette-enrichments-gmap-geocode:api_key:$env:MAPS_API_KEYThen run Datasette like this:datasettemydatabase.db-mmetadata.yml--rootThis well give you a URL to sign in as the "root" user, which grants you access to the enrichment.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-gmap-geocode
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytestCommand for testing with freedrawpython3-mdatasettegm_test.db--metadataqso_loc.yml--load-extension=/usr/lib/x86_64-linux-gnu/mod_spatialite.so--template-dirplugins/templates--root
Package: datasette-enrichments-gpt
datasette-enrichments-gptDatasette enrichment for analyzing row data using OpenAI's GPT modelsInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-enrichments-gptConfigurationThis plugin needs an OpenAI API key. Configure that inmetadata.ymllike soplugins:datasette-enrichments-gpt:api_key:sk-..Or to avoid that key being visible on/-/metadataset it as an environment variable and use this:plugins:datasette-enrichments-gpt:api_key:$env:OPENAI_API_KEYUsageOnce installed, this plugin will allow users to select rows to enrich and run them through prompts usinggpt-3.5-turbo, saving the result of the prompt in the specified column.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-gpt
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-enrichments-jinja
datasette-enrichments-jinjaDatasette enrichmentfor evaluating templates in a Jinja sandboxInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-enrichments-jinjaUsageThis enrichment allows you to select rows from a table and specify a Jinja template to use to generate new text for each of those rows.The text can then be saved to a new or existing column on the table.Code runs in aJinja sandbox. This should protect against innocent mistakes, but may not be robust against malicious attackers - so only make this enrichment available to users who you trust not to abuse it.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-jinja
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-enrichments-ollama
datasette-enrichments-ollamaDatasette enrichment for analyzing row data using a locally hosted Ollama instanceI'm not a programmer so feel free to takeover this repo through a fork.Requirementyou must have a running instance of ollama to use this plugin. At present this is only avialable on Linux or Macos. See more here:https://github.com/ollama/ollamaThis is a straight fork fromdatasette-enrichment-gptInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-enrichments-ollamaConfigurationThis plugin needs an API url for the ollama instance. Configure that inmetadata.ymllike soplugins:datasette-enrichments-ollama:api_url:"http://localhost:11434/api/generate"Or to avoid that key being visible on/-/metadataset it as an environment variable and use this:plugins:datasette-enrichments-ollama:api_url:$env:OLLAMA_API_URLUsageOnce installed, this plugin will allow users to select rows to enrich and run them through prompts using models that are installed and registered in the ollama service, then saving the result of the prompt in the specified column.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-ollama
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-enrichments-opencage
datasette-enrichments-opencageGeocoding enrichment using OpenCageInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-enrichments-opencageUsageThis plugin adds an enrichment for geocoding using theOpenCage Geocoder.You will need an API key from OpenCage - you can sign up for a free trial athttps://opencagedata.com/users/sign_up.Filter for data that you wish to geocode, then apply the OpenCage geocoder enrichment.You'll need to specify a template to be passed to the geocoder, specifying which templates should be used as the input.If you have a single column containing the address, you can use this:{{ address }}If you have separate columns for the street, city, state and country, you can use this:{{ street }}, {{ city }}, {{ state }}, {{ country }}If your address column is missing the country, but all of the addresses are in the USA, you could use this:{{ address }}, USASee theOpenCage guidefor tips on how to get the best results.By default only the latitude and longitude from the geocoder will be stored, in thelatitudeandlongitudecolumns on your table. These columns will be created if they do not yet exist.You can optionally specify a column to store the full JSON output of the geocoder. This column will also be created if it does not exist.The full JSON format isdescribed here.ConfigurationYou can use this plugin without configuration, but you'll need to enter your API key every time you run an enrichment.To avoid that, you can set your API key as plugin configuration like this:exportOPENCAGE_API_KEY="your-api-key"Then inmetadata.yml:plugins:datasette-enrichments-opencage:api_key:$env:OPENCAGE_API_KEYThen run Datasette like this:datasettemydatabase.db-mmetadata.yml--rootThis well give you a URL to sign in as the "root" user, which grants you access to the enrichment.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-opencage
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-enrichments-quickjs
datasette-enrichments-quickjsEnrich data with a custom JavaScript functionInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-enrichments-quickjsUsageUsage instructions go here.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-quickjs
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-enrichments-re2
datasette-enrichments-re2Enrich data using regular expressionsInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-enrichments-re2UsageThis enrichment allows you to run a regular expression against a column and perform one of the following:Execute a search and replace against that columnExtract the first matching result and store that in the specified column (adding a column if necessary)Extract all matching results and store them as a JSON array in the specified column. If the regular expression uses named capture groups this will be an array of objects, otherwise it will be an array of strings.Execute a regular expression with named capture groups and store the results in multiple columns, one for each of those named groupsDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-re2
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest
Package: datasette-enrichments-shell
datasette-enrichments-shellSomething I've always wanted to do is to be able to easily run a map reduce operation on a CSV. This is something that all the nifty command line tools (zq, jq, etc) don't allow you to do.However, I noticed that Datasette recently added the ability to write enrichment plugins. I hacked together this enrichment plugin that allows you to run an arbitrary shell script and if the script was successful, save the resulting output to a new column.InstallationInstall this plugin in the same environment as Datasette.datasetteinstall-Udatasette-enrichments-shellOr, if you are hacking on this locally:datasetteinstall-U~/Projects/python/datasette-enrichments-shellUsageAfter installing the plugin, you'll see the shell enrichment option in the UI. You can use this to run a shell command and save the output to a new column.ExamplesHere's how to test a shell script before plugging it into the web UI:echo'{"rowid": 1, "firstName": "Forest", "lastName": "Tree"}'|\jq-r'"-p firstName \(.firstName) -p lastName \(.lastName)"'|\xargs-I{}/Users/mike/.asdf/shims/sqlite-utilsqueryemail_personal.db"SELECT * FROM address_book WHERE first_name = :firstName AND last_name = :lastName LIMIT 1"{}DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-enrichments-shell
poetryinstall
Package: datasette-ephemeral-tables
datasette-ephemeral-tablesProvide tables that expire after a time limitInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-ephemeral-tablesUsageOnce installed, this plugin will ensure Datasette starts running with a new named in-memory database calledephemeral.Any tables created in this database will be automatically dropped five minutes after creation.ConfigurationAll plugin settings are optional. The full set of settings inmetadata.ymllooks like this:plugins:datasette-ephemeral-tables:# The name of the in-memory database created by the plugin:database:ephemeral# After how many seconds should tables be dropped?table_ttl:300# How often should the plugin check for expired tables (in seconds)?check_interval:2The figures shown here are the default values.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-ephemeral-tables
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-ersatz-table-valued-functions
datasette-ersatz-table-valued-functionsersatz(adj.): made or used as a substitute, typically an inferior one, for something else.Enable a limited form of table-valued functions.See alsoersatz-table-valued-functions.InstallationInstall this plugin in the same environment as Datasette.datasette install datasette-ersatz-table-valued-functionsUsageWrite a plugin that registers a table-valued function in thestartuphook:fromdatasetteimporthookimplfromdatasette_ersatz_table_valued_functionsimportcreate_table_functiondeftbl_squares(n):return[(i,i*i)foriinrange(n)]@hookimpldefstartup():create_table_function('tbl_squares',1,tbl_squares,['root','square'])You can then query this in Datasette:SELECTrootFROMtbl_squares(10)WHEREsquare%2=0ANDsquare<50will emit 0, 2, 4, 6.The parameters to the function can come from a subselect, which could target
any table and be arbitrarily complex:SELECTrootFROMtbl_squares((SELECT10))You can do whatever with the output of this function -- join it, aggregate it, etc.What you can't do is use a join as the source ofinputto the function:WITHxsAS(SELECT10ASx)SELECTrootFROMtbl_squares(x),xsQueries that aren't supported are passed as-is to SQLite, which will itself
then reject them since no such table function is registered.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-ersatz-table-valued-functions
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-events-db
datasette-events-dbLog Datasette events to a database tableInstallationInstall this plugin in the same environment as Datasette.datasetteinstalldatasette-events-dbUsageOnce installed, allDatasette eventswill be logged to a table calleddatasette_events. This table will be created in the_internaldatabase, but can be moved to another database using the following plugin configuration option:plugins:datasette-events-db:database:my_databaseThe table will be created when Datasette starts up, if it does not already exist.Table schemacreatetableifnotexistsdatasette_events(idintegerprimarykey,eventtext,createdtext,actor_idtext,database_nametext,table_nametext,propertiestext-- JSON other properties)eventis the text name of the event, for examplecreate-tablecreatedis an ISO formatted UTC timestampactor_idwill be populated with the ID of the responsible actor, ornullif not availabledatabase_namewill be thedatabaseproperty recorded by the event, if presenttable_namewill be thetableproperty recorded by the event, if presentpropertieswill be a JSON object containing any other properties recorded by the eventDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-events-db
python3-mvenvvenvsourcevenv/bin/activateNow install the dependencies and test dependencies:pipinstall-e'.[test]'To run the tests:pytest