Show and Tell - Dash CLI Tools

Hey everyone! First time poster here in the dash community, although I have been using dash for over a year now.

I haven’t yet found a great templating CLI for Dash - so I created one.

Installation is easy with pip:


pip install dash-tools

See dash-tools on PyPi

Here are some examples with a few different templates. I just made this project yesterday and so not many templates exist yet. I would love to hear the community’s feedback on this!

# Create a new multi-page Dash app called MyDashApp with clientside
# callbacks, error page, and javascript callbacks
dash-tools --init MyDashApp

Templates are also available using the optional template argument after --init:

# Create a new Dash app called MyDashApp using 'minimal' theme
dash-tools --init MyDashApp minimal

To list out available templates, use the --templates command:

# Display available templates
dash-tools --templates

>>> dash-tools: templates: List of available templates:
>>> default
>>> minimal
>>> heroku
3 Likes

Hi @andrew-hossack
Looks pretty cool. Thank you for sharing this with our community.
I tried running your example on Windows and PyCharm by, but I get an error after I install dash-tools. When I type:
dash-tools --init MyDashApp the only thing that happens is that a dash-tools file opens up inside PyCharm.

#!C:\Users\adams\PycharmProjects\Plotly\Sandbox\venv\Scripts\python.exe
import argparse
from dash_tools.cli import cli
from dash_tools.version import __version__
import os

parser = argparse.ArgumentParser(
    description='The dash-tools CLI for Plotly Dash.')

parser.add_argument(
    '--version',
    action='version',
    version=__version__)

parser.add_argument(
    '-i',
    '--init',
    help='Create a new Dash app. Args: REQUIRED: <app name> OPTIONAL: <template> (Default: "default").',
    nargs='+')

parser.add_argument(
    '--templates',
    help='List available templates.',
    default=False,
    action='store_true')

cli.main(parser=parser, invoke_directory=os.getcwd())

Can you please offer guidance?

Hey @adamschroeder

I am not familiar with using PyCharm. What should happen when you do dash-tools --init MyDashApp is that the package invokes a command line entry point script. What I think might be happening is that the command line script being invoked only works for linux machines.

I’ve changed the way that dash-tools invokes the command line client in this branch: GitHub - andrew-hossack/dash-tools at add-heroku-deploy

Does uninstalling your current dash-tools and reinstalling from the branch I’ve sent above with pip install . --upgrade work for you?

Hey @andrew-hossack

Thanks for this great tool! When I first started with Dash I used Pythonanywhere because it was so beginner friendly. But dash-tools makes deploying a Dash app a piece of cake :cake:

Thank you very much for your kind words! I’m very glad you enjoy using the tool!

1 Like

Hi @andrew-hossack

Now that Heroku is eliminating their free tier, have you considered making it possible to deploy to other hosting services?

2 Likes

@adamschroeder and I chatted a bit about this. I’m planning on doing some research on different deployment methods for python projects. So far I have come across a few platforms which look promising.

2 Likes

Pythonanywhere has free tier pricing with free web hosting. There is also a CLI which will make it easy to write into dash-tools. I’ll play around with pythonanywhere cli a bit to see if it’s possible to upload projects easily.

Hey @andrew-hossack

I use Pythonanywhere, and by the time you install dash and pandas in a virtual environment, you can’t install any other libraries without moving to a paid tier.

That’s a problem. Have you come across any other web hosts with a sufficient free tier?

I’ve only used Pythonanywhere and Heroku.
Here are two others that might be worth investigating: https://www.deta.sh/ and https://render.com/.

@snehilvj how is it going with render?

Has anyone else used either of these two services?

I didn’t like heroku that much but I had not come across render by that time. I have not faced any issues after migrating to render. So far I have not found it lacking in any feature. Using render for almost 6 months now.
I should say though, that render’s free tier option is not as good as heroku but the heroku one doesn’t exist now, so what can you do.