Skip to main content

Vanilla HTML components for Dash

Project description

Notice

As of Dash 2, the development of dash-html-components has been moved to the main Dash repo

This package exists for backward compatibility


dash-html-components

Vanilla HTML components for Dash

Install dependencies

  1. Create a virtual env and activate.

    $ virtualenv venv
    $ venv/bin/activate
    

    Note: venv\Scripts\activate for Windows

  2. Install Python packages required to build components.

    $ pip install -r dev-requirements.txt
    
  3. Generate components and install npm packages

    $ npm install
    

Generating HTML Components

The components in src/components, as well as the export index in src/index.js are programmatically generated from element definitions in scripts/. To regenerate:

$ npm run generate-components

The list of attributes is regenerated by scraping the MDN HTML attribute reference.

Note: This step will have already been done for you when you ran npm install

Development

Testing your components in Dash

  1. Watch for changes

     $ npm run build:watch
    
  2. Install module locally (after every change)

     # Generate metadata, and build the JavaScript bundle
     $ npm run install-local
    
     # Now you're done. For subsequent changes, if you've got `npm run build:watch`
     $ python setup.py install
    
  3. Run the Dash layout you want to test

     # Import dash_html_components to your layout, then run it:
     $ python my_dash_layout.py
    

Installing Python package locally

Before publishing to PyPi, you can test installing the module locally:

# Install in `site-packages` on your machine
$ npm run install-local

Uninstalling Python package locally

$ npm run uninstall-local

Contributing

See the contributing guide for guidelines on contributing to this project.

Create a production build and publish:

  1. Build your code:

    $ npm run build
    
  2. Create a Python tarball

    $ python setup.py sdist
    

    This distribution tarball will get generated in the dist/ folder

  3. Test your tarball by copying it into a new environment and installing it locally:

    $ pip install dash-html-components-<new-version>.tar.gz
    
  4. If it works, then you can publish the component to NPM and PyPI:

    1. Publish on PyPI
      $ twine upload dist/*
      
    2. Cleanup the dist folder (optional)
      $ rm -rf dist
      
    3. Publish on NPM (Optional if chosen False in publish_on_npm)
      $ npm publish
      
      Publishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash servers the component library's CSS and JS from the remote unpkg CDN, so if you haven't published the component package to NPM you'll need to set the serve_locally flags to True (unless you choose False on publish_on_npm). We will eventually make serve_locally=True the default, follow our progress in this issue.

Project details


Release history Release notifications | RSS feed

This version

2.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dash_html_components-2.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

dash_html_components-2.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file dash_html_components-2.0.0.tar.gz.

File metadata

  • Download URL: dash_html_components-2.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.5

File hashes

Hashes for dash_html_components-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8703a601080f02619a6390998e0b3da4a5daabe97a1fd7a9cebc09d015f26e50
MD5 a516a44b1fb347f44b2fb958440b2abf
BLAKE2b-256 14c6957d5e83b620473eb3c8557a253fb01c6a817b10ca43d3ff9d31796f32a6

See more details on using hashes here.

File details

Details for the file dash_html_components-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: dash_html_components-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for dash_html_components-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b42cc903713c9706af03b3f2548bda4be7307a7cf89b7d6eae3da872717d1b63
MD5 c14f3f81c14879862a5390d82c730086
BLAKE2b-256 75651b16b853844ef59b2742a7de74a598f376ac0ab581f0dcc34db294e5c90e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page