Saravanan666/pypi-org huggingface dataset:
Package: dash-mistletoe
dash_mistletoeAn extension ofmistletoethat converts markdown into dash components.PurposeWhile other Markdown parsers exist, they lack the ability to customize items at the component level.
This creates a barrier when we want to change styles or add ids to elements.
dash_mistletoe fixes this problem by providing a baseline framework for extending Markdown usingdash.We build an extension of mistletoe; a fast, spec-compliant, and customizable Markdown parser; for dash components.
mistletoe parses to an Abstract Syntax Tree allowing us to extend easily.InstallTo install and use, runpipinstalldash-mistletoeTo clone and run locally, rungitclonehttps://github.com/bradley-erickson/dash-mistletoe
pipinstall-rrequirements.txt
pythonusage.pyUsageFirst, mistletoe will parsemarkdown_to_renderusing theDashRenderer.
The output will contain all contents of the markdown wrapped in a Div.fromdashimporthtmlfromdash_mistletoe.dash_rendererimportDashRendererimportmistletoemarkdown_to_render="""# Heading level 1I like markdown"""component=mistletoe.markdown(markdown_to_render,DashRenderer)component# html.Div([html.H1('Heading level 1'), html.P('I like markdown')])Extending ComponentsTo extend a component, we will first make a sub class ofDashRendererto inherit all methods.
Next, we just need overwrite the methods we want to customize.
The possible methods to overwrite can be referenced in the code.classMyDashRenderer(DashRenderer):defrender_heading(self,token):Depending on what we need done with the content, we can create the component with the super class first.
Then, we change an attribute about it.
In the heading example, I add anidto each heading element.
Doing this allows for automatic scroll when changing the hash of the URL.
This is great for adding a table of contents to a blog post.classMyDashRenderer(DashRenderer):defrender_heading(self,token):# fetch the super class heading first i.e. an html.Hx componentheading=super().render_heading(token)# render the child (token) to as text (plain)id=self.render_to_plain(token).lower().replace(' ','')# set the id and returnheading.id=idreturnheadingYou can also completely ignore the super class method and return something brand new.
For example, we can return a P element with a specific className instead of Strong one.
This allows us to handle how the Strong text looks with CSS instead.classMyDashRenderer(DashRenderer):defrender_strong(self,token):# render the children (token)children=self.render_inner(token)returnhtml.P(children,className='strong-text')
Package: dash-mqtt
Dash with MQTTdash_mqttis a Dash component library for adding MQTT messaging functionality to your Dash apps.
It is essentially a wrapper aroundMQTT.js.UsageSimple echo example usingemqx.iotest MQTT broker.import dash_mqtt
import dash
from dash.dependencies import Input, Output, State
import dash_html_components as html
import dash_core_components as dcc

TEST_SERVER = 'broker.emqx.io'
TEST_SERVER_PORT = 8083
TEST_SERVER_PATH = 'mqtt'
MESSAGE_OUT_TOPIC = 'testtopic'
MESSAGE_IN_TOPIC = 'testtopic'

app = dash.Dash(__name__)

app.layout = html.Div([
    dash_mqtt.DashMqtt(
        id='mqtt',
        broker_url=TEST_SERVER,
        broker_port = TEST_SERVER_PORT,
        broker_path = TEST_SERVER_PATH,
        topics=[MESSAGE_IN_TOPIC]
    ),
    html.H1('MQTT echo'),
    html.P('MQTT echo server to ' + TEST_SERVER + ' on port ' + str(TEST_SERVER_PORT)),
    dcc.Input(
        id='message_to_send',
        placeholder='message to send',
        debounce = True),
    html.Button('Send',id='send'),
    html.Div(id='return_message')
])


@app.callback(
        Output('mqtt', 'message'),
        Input('send', 'n_clicks'),
        State('message_to_send', 'value')
    )
def display_output(n_clicks, message_payload):
    if n_clicks:
        return {
            'topic': MESSAGE_OUT_TOPIC,
            'payload' : message_payload
        }
    return dash.no_updateNOTEMQTT.js is running as an MQTT client in the browser in this implementation (As a React component as per typical Dash components). Subsequently, fromhere:There is no way for JavaScript running in browsers to open TCP sockets so "normal" MQTT is impossible in browser apps.To get around this limitation,MQTT.jsusesMQTT over WebSocketsinstead when it detects it's running in a browser.This means that you need to set thebroker_portup to point at the MQTT-over-WebSockets port of the MQTT broker you are using, or if you are setting up your own broker server, turn onMQTT-over-WebSocketsand expose a port.Help with developing the componentIf you are want to adapt or help develop the component, referREADME_DEV.mdCurrently written to suit author's needs - MQTT broker running in a DOcker Container on a local network for home IOT scenarion usingIOTStack, so have not put any effort into encrypted messaging.
Package: dash-multi
Dash Multi(Page)Wrapper on top of Dash to support multi page apps.Running ExamplesRun one of:index.pystandalone_page.pystandalone_section.pyIllustrative ExampleCreate a single page appserver = Flask(__name__)

app = Page1(name="home", server=server, url_base_pathname="/")

if __name__ == "__main__":
    server.run(host="0.0.0.0")Create a multipage app (Method 1)server = Flask(__name__)

index_app = IndexApp(name="home", server=server, url_base_pathname="/")
section_app = Section(name="section", server=server, url_base_pathname="/app1")

if __name__ == "__main__":
    server.run(host="0.0.0.0")Create a multipage app (Method 2)class MyApp(MultiPageApp):
    def get_routes(self):

        return [
            Route(IndexApp, "index", "/"),
            Route(Section, "home", "/app1")
        ]

server = Flask(__name__)

app = MyApp(name="", server=server, url_base_pathname="")
Package: dash-multipage
# dash-multipage
A framework to simplify some of the challenges in setting up multipage dash pagesThis can be used as is to reduce the boilerplate for a multipage app, or used as a template.The basic structure is to create an instance of dash_multipage.MultiPageDashController.This adds the layout and callbacks to the dash app passed in as an argument. It provides the
nav buttons on top, and handles selecting the page based on the URL.It expects that the app will load Bootstrap CSS for pretty navigation tabs.Each page is an implementation of dash_multipage.ControllerBase. The implementation gives the
link information, layout and callbacks.To handle loading a page with specific selections, the from dash_multipage.URLArgs provides
a way to generate links with the current input, dropdown, etc. selection preserved. This is
not required, and you can generate a multipage app without this functionality.As a minor note, there is also a set of classes that override dash’s Input, Output, and State.
These are merely a convenience wrapper to allow them to be initialized directly from the
components.# Example
An example app is found in example/To run with flask:
FLASK_DEBUG=1 FLASK_APP=example/multipage_app.py:SERVER flask run
Package: dash-notes
dash-notesdash-notes is a part ofDash Enterprise,
Plotly's end-to-end Dash application platform. This public copy of the package
is a stub published on pypi.org designed to shield Dash Enterprise users fromdependency confusion,
a remote code execution attack publicly disclosed in 2021 by Alex Birsan.If you are a Dash Enterprise user, you will only see this public package if your
app is not properly configured to find the local package repository built into
Dash Enterprise. Visit the docs for your Dash Enterprise installation for details.If you never see this public package, it's still doing its job of protecting you
from the dependency confusion attack!
Package: dash-obj-in-3dmesh
Wavefront OBJ importer for the plotly Dash frameworkDash is a Python framework for building analytical web applications. This library helps you to get 3D ObJ into the framework's 3dmesh graph typeSource is here:https://github.com/aegis1980/dash-obj-in-3dmesh.gitAlso on pypi, installed using:pip install dash-obj-in-3dmeshSome notes:File locationsPut your wavefront obj & mtl file in 'data/obj' directory in the root directory of your Dash app. Alternatively pass a path to:import_geometry(obj_names:List[str],path=_config.GEOMETRY_DIR)Geometryv4.0Added support importing OBJ files with quads. Dash graph.Mesh3d can only display triangulated meshes. Imported quad are split inmesh_tools.split_quad()into two tris with the fold line on the quad diagonal which produces the least curvature (i.e. the widest angle between the tri normals)Textures, normals and everything else are ignored - only vertices, faces, materials, groups and object names are parsed and passed to Dash graph as mesh data....so to speeden things up strip all that data out of your files pre-deploymentMaterialsobj file can have an accompanying materials file, but only basic materials supported in mtl file:
e.g:newmtl diffuse_Green
Ka 0.0000 0.0000 0.0000
Kd 0.0000 1.0000 0.0000
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0.0000Only the value forKdis used - so set this as your colour (in modelling software).Code exampleimportdashimportdash_obj_in_3dmeshmodel_name="test"#.obj & .mtl files in data/objaxis_template={"showbackground":False,"visible":False}plot_layout={"title":"","margin":{"t":0,"b":0,"l":0,"r":0},"font":{"size":12,"color":"white"},"showlegend":False,'uirevision':'same_all_the_time',#this keeps camera position etc the same when data changes."scene":{"xaxis":axis_template,"yaxis":axis_template,"zaxis":axis_template,"aspectmode":"data","camera":{"eye":{"x":1.25,"y":1.25,"z":1.25}},"annotations":[],},}deflayout():returnhtml.Div([dcc.Graph(id="graph",figure={"data":geometry_tools.import_geometry([model_name]),"layout":plot_layout,},config={"scrollZoom":True},# activates wheel thingy on mouse to zoom and wotnot)])app=Dash()app.layout=layoutapp.run_server()
Package: dash-oflog-components
dash_oflog_componentsdash_oflog_components is a Dash component library.Dash react components for use in oflog data productsGet started with:Install Dash and its dependencies:https://dash.plotly.com/installationRunpython usage.pyVisithttp://localhost:8050in your web browserContributingSeeCONTRIBUTING.mdInstall dependenciesIf you have selected install_dependencies during the prompt, you can skip this part.Install npm packages$ npm installCreate a virtual env and activate.$ virtualenv venv
$ . venv/bin/activateNote: venv\Scripts\activate for windowsInstall python packages required to build components.$ pip install -r requirements.txtInstall the python packages for testing (optional)$ pip install -r tests/requirements.txtWrite your component code insrc/lib/components/DualInput.react.js.The demo app is insrc/demoand you will import your example component code into your demo app.Test your code in a Python environment:Build your code$ npm run buildRun and modify theusage.pysample dash app:$ python usage.pyWrite tests for your component.A sample test is available intests/test_usage.py, it will loadusage.pyand you can then automate interactions with selenium.Run the tests with$ pytest tests.The Dash team uses these types of integration tests extensively. Browse the Dash component code on GitHub for more examples of testing (e.g.https://github.com/plotly/dash-core-components)Add custom styles to your component by putting your custom CSS files into your distribution folder (dash_oflog_components).Make sure that they are referenced inMANIFEST.inso that they get properly included when you're ready to publish your component.Make sure the stylesheets are added to the_css_distdict indash_oflog_components/__init__.pyso dash will serve them automatically when the component suite is requested.Review your codeCreate a production build and publish:Build your code:$ npm run buildCreate a Python distribution$ python setup.py sdist bdist_wheelThis will create source and wheel distribution in the generated thedist/folder.
SeePyPAfor more information.Test your tarball by copying it into a new environment and installing it locally:$ pip install dash_oflog_components-0.0.1.tar.gzIf it works, then you can publish the component to NPM and PyPI:Publish on PyPI$ twine upload dist/*Cleanup the dist folder (optional)$ rm -rf distPublish on NPM (Optional if chosen False inpublish_on_npm)$ npm publishPublishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash serves the component library's CSS and JS locally, but if you choose to publish the package to NPM you can setserve_locallytoFalseand you may see faster load times.Share your component with the community!https://community.plotly.com/c/dashPublish this repository to GitHubTag your GitHub repository with the plotly-dash tag so that it appears here:https://github.com/topics/plotly-dashCreate a post in the Dash community forum:https://community.plotly.com/c/dash
Package: dash-okta-auth
Dash Okta AuthDash Okta Auth is a simple library using Okta OAuth to authenticate and
view aDashapp.This Library usesFlask Danceand a modified version of Plotly's owndash authfor authentication.This Library is heavily inspired bydash-google-oauthcreated by Lucas ChapinBasic UseAuthentication can be added to your Dash application using theOktaOAuthclass, i.e.fromdashimportDashfromflaskimportFlaskfromdash_okta_authimportOktaOAuthserver=Flask(__name__)server.config.update({'OKTA_OAUTH_CLIENT_ID':...,'OKTA_OAUTH_CLIENT_SECRET':...,})app=Dash(__name__,server=server,url_base_pathname='/',auth='auth')additional_scopes=[...]auth=OktaOAuth(app,base_url='https://myoktadomain.okta-emea.com',additional_scopes)# your Dash app here :)...ExampleSteps to try this out yourself:Install thedash-okta-authlibrary usingpip:$pipinstalldash-okta-authFollow theFlask Dance Guideto create an app on the okta admin consoleMake a copy ofapp.pyand set the variables (or set the corresponding environment variables):server.config["OKTA_OAUTH_CLIENT_ID"]=...server.config["OKTA_OAUTH_CLIENT_SECRET"]=...with values from the Okta OAuth 2 application you should have set up earlier.
If you've set these up properly, you can find them atApplications > yourapp > Generalunder the sectionClient Credentials.Runpython app.pyand openlocalhostin a
browser window to try it out! If the app loads automatically without
prompting a Okta login, that means you're already authenticated -- try
using an inokta window in this case if you want to see the login
experience for a new user.
Package: dash-okta-oauth2
Dash Okta OAuth2Dash Okta Auth is a simple library using Okta OAuth2 to authenticate and
view aDashapp.This Library usesFlask Danceand a modified version of Plotly's owndash authfor authentication.This Library is heavily inspired bydash-google-oauthcreated by Lucas Chapin and forked fromdash-okta-authcreated by Frank Spijkerman.I decided to deploy to pip after I received no response to thisissue.Basic UseAuthentication can be added to your Dash application using theOktaOAuthclass, i.e.fromdashimportDashfromflaskimportFlaskfromdash_okta_oauth2importOktaOAuthserver=Flask(__name__)server.config.update({'OKTA_OAUTH_CLIENT_ID':...,'OKTA_OAUTH_CLIENT_SECRET':...,'OKTA_BASE_URL':...})app=Dash(__name__,server=server,url_base_pathname='/')additional_scopes=[...]auth=OktaOAuth(app,additional_scopes)# your Dash app here :)...ExampleSteps to try this out yourself:Install thedash-okta-authlibrary usingpip:$pipinstalldash-okta-oauth2Follow theFlask Dance Guideto create an app on the okta admin consoleMake a copy ofapp.pyand set the variables (or set the corresponding environment variables):server.config["OKTA_OAUTH_CLIENT_ID"]=...server.config["OKTA_OAUTH_CLIENT_SECRET"]=...with values from the Okta OAuth 2 application you should have set up earlier.
If you've set these up properly, you can find them atApplications > yourapp > Generalunder the sectionClient Credentials.Runpython app.pyand openlocalhostin a
browser window to try it out! If the app loads automatically without
prompting a Okta login, that means you're already authenticated -- try
using an inokta window in this case if you want to see the login
experience for a new user.
Package: dash-paperdragon
Dash PaperDragonDash PaperDragon is a Dash component library.OpenSeaDragon and PaperJS component for Dash and the DSAGet started with:Install Dash and its dependencies:https://dash.plotly.com/installationRunpython usage.pyVisithttp://localhost:8050in your web browserContributingSeeCONTRIBUTING.mdInstall dependenciesIf you have selected install_dependencies during the prompt, you can skip this part.Install npm packages$ npm installCreate a virtual env and activate.$ virtualenv venv
$ . venv/bin/activateNote: venv\Scripts\activate for windowsInstall python packages required to build components.$ pip install -r requirements.txtInstall the python packages for testing (optional)$ pip install -r tests/requirements.txtWrite your component code insrc/lib/components/DashPaperdragon.react.js.The demo app is insrc/demoand you will import your example component code into your demo app.Test your code in a Python environment:Build your code$ npm run buildRun and modify theusage.pysample dash app:$ python usage.pyWrite tests for your component.A sample test is available intests/test_usage.py, it will loadusage.pyand you can then automate interactions with selenium.Run the tests with$ pytest tests.The Dash team uses these types of integration tests extensively. Browse the Dash component code on GitHub for more examples of testing (e.g.https://github.com/plotly/dash-core-components)Add custom styles to your component by putting your custom CSS files into your distribution folder (dash_paperdragon).Make sure that they are referenced inMANIFEST.inso that they get properly included when you're ready to publish your component.Make sure the stylesheets are added to the_css_distdict indash_paperdragon/__init__.pyso dash will serve them automatically when the component suite is requested.Review your codeCreate a production build and publish:Build your code:$ npm run buildCreate a Python distribution$ python setup.py sdist bdist_wheelThis will create source and wheel distribution in the generated thedist/folder.
SeePyPAfor more information.Test your tarball by copying it into a new environment and installing it locally:$ pip install dash_paperdragon-0.0.1.tar.gzIf it works, then you can publish the component to NPM and PyPI:Publish on PyPI$ twine upload dist/*Cleanup the dist folder (optional)$ rm -rf distPublish on NPM (Optional if chosen False inpublish_on_npm)$ npm publishPublishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash serves the component library's CSS and JS locally, but if you choose to publish the package to NPM you can setserve_locallytoFalseand you may see faster load times.Share your component with the community!https://community.plotly.com/c/dashPublish this repository to GitHubTag your GitHub repository with the plotly-dash tag so that it appears here:https://github.com/topics/plotly-dashCreate a post in the Dash community forum:https://community.plotly.com/c/dashNote may need to pip install wheel into the environment to build the packages
Package: dash-prefix
dash-prefixPlotly/Dashutility library that allows component IDs to use prefixed
namespaces. This greatly reduces Dash component ID conflicts. A component ID
is only defined once when the component is created. It is then used by
reference in associated Dash callbacks:pip install dash-prefixprefix()Returns a lambda that will prefix all component IDs with the given prefix. If no
prefix is given one will be assigned.from dash import html, callback
from dash_prefix import prefix

pfx = prefix()

user_name = dbc.Input(id=pfx('user'), placeholder="Enter name")
password = dhc.PasswordInput("Password", name='password', id=pfx('password'), placeholder="Enter password")
btn = html.Button('Enter', id=pfx('enter'), disabled=True)

@callback(btn.output.disabled, user_name.input.value, password.input.value)
def _cb_enter(user_name, password):
    return not db_validate_user(user_name, password)isTriggered()Returns true if the given dash component was the reason for the enclosing callback
being triggeredapp = dash.Dash(__name__)

  btn1 = html.Button("Button 1", id='btn1')
  btn2 = html.Button("Button 2", id='btn3')
  title = html.H1('Title', id='title')

  @app.callback(title.output.children, btn1.input.n_clicks,  btn2.input.n_clicks)
  def _update(btn1_clicks, btn2_clicks):

      if isTriggered(btn1.input.n_clicks):
          return "Button1 Clicked"

      if isTriggered(btn2.input.n_clicks):
          return "Button2 Clicked"

      return NOUPDATEmatch()andtrigger_index()ArePattern-Matching CallbackhelpersMatch = match({'type': 'buttons', 'idx': ALL})

    btn1 = html.Button('Button 1', id=Match.idx(1))
    btn2 = html.Button('Button 2', id=Match.idx(2))
    btn2 = html.Button('Button 3', id=Match.idx(3))

    title = html.Div(id='title')

    @callback(title.output.children, Match.input.n_clicks)
    def _update_(button_clicks):
        idx = trigger_index()
        if idx is not None:
            return f"Button {idx} triggered {button_clicks[idx]} times!"
        return NOUPDATEcss_idAll dash components are injected with acss_idproperty. This makes testing
with DashDuofar less taxing.title = html.Div('Title', id='title')

_title = dash_duo.find_element(title.css_id)Can also be used with dictionary IDsMatch = match({'type': 'buttons', 'idx': ALL})

btn1 = html.Button('Button 1', id=Match.idx(1))
btn2 = html.Button('Button 2', id=Match.idx(2))
btn3 = html.Button('Button 3', id=Match.idx(3))

_btn3 = dash_duo.find_element(btn3.css_id)Build the projectThe dash-prefix package is available onpypi. If needed, to create a local
tarball, first change the release version indash_spa/_version.py, then:rm -rf dist dash_spa.egg-info build

python setup.py sdist bdist_wheelThe tarball is indist/dash_spa-.tar.gzTo install the tarball in a dash project:pip install dash_spa-<version>.tar.gzTestingPytest andDash Duoare used for testing. To run
these tests both the Chrome browser and Chrome driver must be installed.To run the tests:pytestPublishtwine upload dist/*
Package: dash-pro-components
dash-pro-componentsdash-pro-components is a part ofDash Enterprise,
Plotly's end-to-end Dash application platform. This public copy of the package
is a stub published on pypi.org designed to shield Dash Enterprise users fromdependency confusion,
a remote code execution attack publicly disclosed in 2021 by Alex Birsan.If you are a Dash Enterprise user, you will only see this public package if your
app is not properly configured to find the local package repository built into
Dash Enterprise. Visit the docs for your Dash Enterprise installation for details.If you never see this public package, it's still doing its job of protecting you
from the dependency confusion attack!
Package: dash.py
Dash.py is a tool that helps you install python documents to Dash easily.UsageInstalling python documents to Dash via Dash.py is easydash.py install flask
dash.py install tornado jinja2 sqlalchemyInstallationYou can install dash.py via pippip install dash.pyIf you don’t have pip, you should install it firstcurl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | pythonAdding a packageNoteYou don’t need to add a package which is hosted on rtfd.org . Dash.py can download docset from rtfd.org automatically.It’s pretty easy to add a new package in Dash.py :Fork the projectAdd a new file in dash_py/packages folder.Filename should bepackage_name.yaml. Now that package name should be lower case.It should be a vailed yaml file.It looks likename: Jinja2 # Package name
type: html # Type. Supported types are ``html`` , ``docset`` and ``sphinx``
format: zip  # Format. Should be either ``zip``, ``tar`` or ``git``. Note that Gzipped Tar file should be ``tar``
url: http://jinja.pocoo.org/docs/jinja-docs.zip  # URL to download the file or to clone the git repo.
icon: _static/jinja-small.png  # OPTIONAL. path to icon file.
sphinx_doc_path: doc  # OPTIONAL. If the type is sphinx and sphinx conf file isn't in the root path, you need to provide this.git add && git commitSend a pull request.