Saravanan666/pypi-org huggingface dataset:
Package: datasette-remote-metadata
datasette-remote-metadataPeriodically refresh Datasette metadata from a remote URLInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-remote-metadataUsageAdd the following to yourmetadata.json:{"plugins":{"datasette-remote-metadata":{"url":"https://example.com/remote-metadata.yml"}}}The plugin will fetch the specified metadata  from that URL at startup and combine it with any existing metadata. You can use a URL to either a JSON file or a YAML file.It will periodically refresh that metadata - by default every 30 seconds, unless you specify an alternative"ttl"value in the plugin configuration.ConfigurationAvailable configuration options are as follows:"url"- the URL to retrieve remote metadata from. Can link to a JSON or a YAML file."ttl"- integer value in secords: how frequently should the script check for fresh metadata. Defaults to 30 seconds."headers"- a dictionary of additional request headers to send."cachebust"- if true, a random?0.29508value will be added to the query string of the remote metadata to bust any intermediary caches.This examplemetadata.jsonconfiguration refreshes every 10 seconds, uses cache busting and sends anAuthorization: Bearer xyzheader with the request:{"plugins":{"datasette-remote-metadata":{"url":"https://example.com/remote-metadata.yml","ttl":10,"cachebust":true,"headers":{"Authorization":"Bearer xyz"}}}}This example if you are usingmetadata.yamlfor configuration:plugins:datasette-remote-metadata:url:https://example.com/remote-metadata.ymlttl:10cachebust:trueheaders:Authorization:Bearer xyzDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-remote-metadata
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-render-html
datasette-render-htmlThis Datasette plugin lets you configure Datasette to render specific columns as HTML in the table and row interfaces.This means you can store HTML in those columns and have it rendered as such on those pages.If you have a database calleddocs.dbcontaining aglossarytable and you want thedefinitioncolumn in that table to be rendered as HTML, you would use ametadata.jsonfile that looks like this:{
    "databases": {
        "docs": {
            "tables": {
                "glossary": {
                    "plugins": {
                        "datasette-render-html": {
                            "columns": ["definition"]
                        }
                    }
                }
            }
        }
    }
}InstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-render-htmlUsageWith the plugin installed, launch Datasette with the abovemetadata.jsonconfiguration:$ datasette -m metadata.json docs.dbSecurityThis plugin allows HTML to be rendered exactly as it is stored in the database. As such, you should be sure only to use this against columns with content that you trust - otherwise you could open yourself up to anXSS attack.It's possible to configure this plugin to apply to columns with specific names across whole databases or the full Datasette instance, but doing so is not safe. It could open you up to XSS vulnerabilities where an attacker composes a SQL query that results in a column containing unsafe HTML.As such, you should only use this plugin against specific columns in specific tables, as shown in the example above.
Package: datasette-render-images
datasette-render-imagesA Datasette plugin that renders binary blob images with data-uris, using therender_cell() plugin hook.InstallationInstall this plugin in the same environment as Datasette.$ pip install datasette-render-imagesUsageIf a database row contains binary image data (PNG, GIF or JPEG), this plugin will detect that it is an image (using theimghdr moduleand render that cell using an<img src="data:image/png;base64,...">element.Here's ademo of the plugin in action.Creating a compatible database tableYou can use thesqlite-utils insert-filescommand to insert image files into a database table:$ pip install sqlite-utils
$ sqlite-utils insert-files gifs.db images *.gifSeeFun with binary data and SQLitefor more on this tool.ConfigurationBy default the plugin will only render images that are smaller than 100KB. You can adjust this limit using thesize_limitplugin configuration option - for example, to increase the limit to 1MB (1000000 bytes) use the following inmetadata.json:{"plugins":{"datasette-render-images":{"size_limit":1000000}}}
Package: datasette-render-image-tags
datasette-render-image-tagsTurn any URLs ending in .jpg/.png/.gif into img tags with width 200InstallationInstall this plugin in the same environment as Datasette.datasette install datasette-render-image-tagsUsageOnce installed, any cells contaning a URL that ends with.pngor.jpgor.jpegor.gifwill be rendered using an image tag, with a width of 200px.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-render-image-tags
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-render-local-images
datasette-render-local-imagesRender local images in the system using datasette pluginInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-render-local-imagesUsageRender local system images in the datasette displayed HTML.
The plugin reads the image and adds the base64 encoded data tosrcattribute,
the cell looks like<img src="data:image/png;base64,A.." height="-1" width="-1">By default plugin will figure out image and render with
default height and width of the image.To modify the image size and width, pass the configuration viametadata.json{"plugins":{"datasette-render-local-images":{"height":150,"width":150}}}When the local image path is missing or no image specified in the path,
the plugin will not render the value.Note: While running datasette command don't forget to pass the metadata file
using-moption likedatasette dataset.db -m metadata.json.Below screenshoot is from the sample table.Sample ScreenshootDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-render-local-images
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-render-timestamps
datasette-render-timestampsDatasette plugin for rendering timestamps.InstallationInstall this plugin in the same environment as Datasette to enable this new functionality:pip install datasette-render-timestampsThe plugin will then look out for integer numbers that are likely to be timestamps - anything that would be a number of seconds from 5 years ago to 5 years in the future.These will then be rendered in a more readable format.ConfigurationYou can disable automatic column detection in favour of explicitly listing the columns that you would like to render usingplugin configurationin ametadata.jsonfile.Add a"datasette-render-timestamps"configuration block and use a"columns"key to list the columns you would like to treat as timestamp values:{"plugins":{"datasette-render-timestamps":{"columns":["created","updated"]}}}This will cause anycreatedorupdatedcolumns in any table to be treated as timestamps and rendered.Save this tometadata.jsonand run datasette with the--metadataflag to load this configuration:datasette serve mydata.db --metadata metadata.jsonTo disable automatic timestamp detection entirely, you can use"columnns": [].This configuration block can be used at the top level, or it can be applied just to specific databases or tables. Here's how to apply it to just theentriestable in thenews.dbdatabase:{"databases":{"news":{"tables":{"entries":{"plugins":{"datasette-render-timestamps":{"columns":["created","updated"]}}}}}}}Customizing the date formatThe default format is%B %d, %Y - %H:%M:%S UTCwhich renders for example:October 10, 2019 - 07:18:29 UTC. If you want another format, the date format can be customized using plugin configuration. Any format string supported bystrftimemay be used. For example:{"plugins":{"datasette-render-timestamps":{"format":"%Y-%m-%d-%H:%M:%S"}}}
Package: datasette-render-xlsx
datasette-render-xlsxDownload Datasette table as xlsx-file using XlsxWriterInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-render-xlsxUsageThis plugin adds a link for downloading the current table as an xslx-file that can
be opened and edited in e.g. MS Excel or LibreOffice.The amount of rows rendered is limited by the valuemax_returned_rowsin Datasette's settings,
which defaults to 1000 rows. It is possible to set a
lower limit by using the plugin settings in Metadata:{
"databases": {
        "sf-trees": {
            "plugins": {
                "datasette-render-xsls": {
                    "max_rows": "500"
                }
            }
        }
    }
}`Tables containing columns with blobs can't yet be rendered.
Labels that are used to display value from another table (foreign keys)
can't be rendered. The actual value will be shown.You can turn off xlsx-rendering from specific databases or tables in the Metadata settings:{
  "databases": {
    "sakila": {
      "tables": {
        "category": {
          "plugins": {
            "datasette-render-xlsx": {
              "do_not_render": true
            }
          }
        }
      }
    }
  }
}In this case there will be no link for download.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-render-xlsx
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-rewrite-sql
datasette-rewrite-sqlAdds a rewrite_sql hook to DatasetteInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-rewrite-sqlUsageWrite a hook like:fromdatasetteimporthookimpl@hookimpldefrewrite_sql(sql):ifsql=='select 123':return'select 234'returnsqlDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-rewrite-sql
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-ripgrep
datasette-ripgrepWeb interface for searching your code usingripgrep, built as aDatasettepluginFor background on this project seedatasette-ripgrep: deploy a regular expression search engine for your source code.DemoTry this plugin out athttps://ripgrep.datasette.io/-/ripgrep- where you can run regular expression searches across the source code of Datasette and all of thedatasette-*plugins belonging to thesimonw GitHub user.Some example searches:with.*AsyncClient- regular expression search forwith.*AsyncClient.plugin_config, literal=on- a non-regular expression search for.plugin_config(with.*AsyncClient glob=datasette/**- search for that pattern only within thedatasette/top folder"sqlite-utils[">] glob=setup.py- a regular expression search for packages that depend on eithersqlite-utilsorsqlite-utils>=some-versiontest glob=!*.html- search for the stringtestbut exclude results in HTML filesInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-ripgrepThergexecutable needs to beinstalledsuch that it can be run by this tool.UsageThis plugin requires configuration: it needs to apathsetting so that it knows where to run searches.Create ametadata.jsonfile that looks like this:{"plugins":{"datasette-ripgrep":{"path":"/path/to/your/files"}}}Now run Datasette usingdatasette -m metadata.json. The plugin will add an interface at/-/ripgrepfor running searches.Plugin configurationThe"path"configuration is required. Optional extra configuration options are:time_limit- floating point number. Thergprocess will be terminated if it takes longer than this limit. The default is one second,1.0.max_lines- integer. Thergprocess will be terminated if it returns more than this number of lines. The default is2000.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-ripgrep
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-rure
datasette-rureDatasette plugin that adds a custom SQL function for executing matches using the Rust regular expression engineInstall this plugin in the same environment as Datasette to enable theregexp()SQL function.$ pip install datasette-rureThe plugin is built on top of therure-pythonlibrary by David Blewett.regexp() to test regular expressionsYou can test if a value matches a regular expression like this:select regexp('hi.*there', 'hi there')
-- returns 1
select regexp('not.*there', 'hi there')
-- returns 0You can also use SQLite's custom syntax to run matches:select 'hi there' REGEXP 'hi.*there'
-- returns 1This means you can select rows based on regular expression matches - for example, to select every article where the title begins with an E or an F:select * from articles where title REGEXP '^[EF]'Try this out:REGEXP interactive demoregexp_match() to extract groupsYou can extract captured subsets of a pattern usingregexp_match().select regexp_match('.*( and .*)', title) as n from articles where n is not null
-- Returns the ' and X' component of any matching titles, e.g.
--     and Recognition
--     and Transitions Their Place
-- etcThis will return the first parenthesis match when called with two arguments. You can call it with three arguments to indicate which match you would like to extract:select regexp_match('.*(and)(.*)', title, 2) as n from articles where n is not nullThe function will returnnullfor invalid inputs e.g. a pattern without capture groups.Try this out:regexp_match() interactive demoregexp_matches() to extract multiple matches at onceTheregexp_matches()function can be used to extract multiple patterns from a single string. The result is returned as a JSON array, which can then be further processed using SQLite'sJSON functions.The first argument is a regular expression with named capture groups. The second argument is the string to be matched.select regexp_matches(
    'hello (?P<name>\w+) the (?P<species>\w+)',
    'hello bob the dog, hello maggie the cat, hello tarquin the otter'
)This will return a list of JSON objects, each one representing the named captures from the original regular expression:[
    {"name": "bob", "species": "dog"},
    {"name": "maggie", "species": "cat"},
    {"name": "tarquin", "species": "otter"}
]Try this out:regexp_matches() interactive demo
Package: datasette-sandstorm-support
datasette-sandstorm-supportAuthentication and permissions for Datasette on SandstormInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-sandstorm-supportUsageThis plugin is part ofdatasette-sandstorm.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-sandstorm-support
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-saved-queries
datasette-saved-queriesDatasette plugin that lets users save and execute queriesInstallationInstall this plugin in the same environment as Datasette.$ pip install datasette-saved-queriesUsageWhen the plugin is installed Datasette will automatically create asaved_queriestable in the first connected database when it starts up.It also creates asave_querywritable canned query which you can use to save new queries.Queries that you save will be added to the query list on the database page.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-saved-queries
python -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-scale-to-zero
datasette-scale-to-zeroQuit Datasette if it has not received traffic for a specified time periodSome hosting providers such asFlyoffer a scale to zero mechanism, where servers can shut down and will be automatically started when new traffic arrives.This plugin can be used to configure Datasette to quit X minutes (or seconds, or hours) after the last request it received. It can also cause the Datasette server to exit after a configured maximum time whether or not it is receiving traffic.InstallationInstall this plugin in the same environment as Datasette.datasette install datasette-scale-to-zeroConfigurationThis plugin will only take effect if it has been configured.Add the following to yourmetadata.jsonormetadata.ymlconfiguration file:{"plugins":{"datasette-scale-to-zero":{"duration":"10m"}}}This will cause Datasette to quit if it has not received any HTTP traffic for 10 minutes.You can set this value using a suffix ofmfor minutes,hfor hours orsfor seconds.To cause Datasette to exit if the server has been running for longer than a specific time, use"max-age":{"plugins":{"datasette-scale-to-zero":{"max-age":"10h"}}}This example will exit the Datasette server if it has been running for more than ten hours.You can use"duration"and"max-age"together in the same configuration file:{"plugins":{"datasette-scale-to-zero":{"max-age":"10h","duration":"5m"}}}This example will quit if no traffic has been received in five minutes, or if the server has been running for ten hours.DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-scale-to-zero
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-seaborn
datasette-seabornStatistical visualizations for Datasette using SeabornInstallationInstall this plugin in the same environment as Datasette.$ datasette install datasette-seabornUsageNavigate to the new.seabornextension for any Datasette table.The_seabornargument specifies a method onsnsto execute, e.g.?_seaborn=relplot.Extra arguments to those methods can be specified using e.g.&_seaborn_x=column_name.ConfigurationThe plugin implements a default rendering time limit of five seconds. You can customize this limit using therender_time_limitsetting, which accepts a floating point number of seconds. Add this to yourmetadata.json:{"plugins":{"datasette-seaborn":{"render_time_limit":1.0}}}DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-seaborn
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-search-all
datasette-search-allDatasette plugin for searching all searchable tables at once.InstallationInstall the plugin in the same Python environment as Datasette:pip install datasette-search-allBackgroundSeedatasette-search-all: a new plugin for searching multiple Datasette tables at oncefor background on this project. You can try the plugin out athttps://fara.datasettes.com/UsageThis plugin only works if at least one of the tables connected to your Datasette instance has been configured for SQLite's full-text search.TheDatasette search documentationincludes details on how to enable full-text search for a table.You can also use the following tools:sqlite-utilsincludes a command-line tool for enabling full-text search.datasette-enable-ftsis a Datasette plugin that adds a web interface for enabling search for specific columns.If the plugin detects at least one searchable table it will add a search form to the homepage.You can also navigate to/-/searchon your Datasette instance to use the search interface directly.ScreenshotDevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cddatasette-search-all
python-mvenvvenvsourcevenv/bin/activateOr if you are usingpipenv:pipenvshellNow install the dependencies and tests:pipinstall-e'.[test]'To run the tests:pytestTo run the browser automation tests:pipinstall-e'.[test,playwright]'pytest
Package: datasette-secret-santa
datasette-secret-santaRun a secret santa using DatasetteInstallationInstall this plugin in the same environment as Datasette.datasette install datasette-secret-santaRunning this on Glitchhttps://glitch.com/is a great way to host this application.You canremix this project on Glitchto get your own copy.Or you can create a new application and paste the following into yourglitch.jsonfile:{"install":"pip3 install --user datasette datasette-secret-santa -U","start":"datasette --create .data/santa.db -p 3000"}Then visit your new app's homepage and click the link to create a new secret santa group.UsageThis plugin requires a database calledsanta.db. You can run it and create such a database like this:datasette santa.db --createIt expects to be the only plugin installed, and will take over the/homepage.To create a new Secret Santa, visit/santa/create_secret_santa(linked from the homepage).DevelopmentTo set up this plugin locally, first checkout the code. Then create a new virtual environment:cd datasette-secret-santa
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-sentry
datasette-sentryDatasette plugin for configuring Sentry for error reportingInstallationpipinstalldatasette-sentryUsageThis plugin only takes effect if yourmetadata.jsonfile contains relevant top-level plugin configuration in a"datasette-sentry"configuration key.You will need a Sentry DSN - see theirGetting Started instructions.Add it tometadata.jsonlike this:{"plugins":{"datasette-sentry":{"dsn":"https://KEY@sentry.io/PROJECTID"}}}Settings inmetadata.jsonare visible to anyone who visits the/-/metadataURL so this is a good place to take advantage of Datasette'ssecret configuration values, in which case your configuration will look more like this:{"plugins":{"datasette-sentry":{"dsn":{"$env":"SENTRY_DSN"}}}}Then make aSENTRY_DSNenvironment variable available to Datasette.ConfigurationIn addition to thedsnsetting, you can also configure the Sentrysample rateby settingsample_rateto a floating point number between 0 and 1.For example, to capture 25% of errors you would do this:{"plugins":{"datasette-sentry":{"dsn":{"$env":"SENTRY_DSN"},"sample_rate":0.25}}}Performance monitoringSentryPerformance Monitoringrecords full traces of page for further analysis, in addition to tracking errors.You can enable that by adding "enable_tracing" to your plugin configuration:{"plugins":{"datasette-sentry":{"dsn":{"$env":"SENTRY_DSN"},"enable_tracing":true}}}The default sample rate if you do this will be1.0, meaning every response will be traced. This can get expensive - you can adjust the tracing rate usingtraces_sample_rate. Set that to0.1to sample 10% of requests, for example:{"plugins":{"datasette-sentry":{"dsn":{"$env":"SENTRY_DSN"},"enable_tracing":true,"traces_sample_rate":0.1}}}