Getting started#
This getting started guide walks you through using Anaconda Project for the first time.
After completing this guide, you will be able to:
Create a new reproducible project.
Run the project with a single command.
Package and share the project.
If you have not yet installed and started anaconda-project, follow the Installation instructions.
Create a new project#
The following steps will create a project called “demo_app”:
Open a Command Prompt or terminal window.
Initialize the project in a new directory:
$ anaconda-project init -y --directory demo_app
Navigate into your project directory:
$ cd demo_app
Add the package dependencies:
$ anaconda-project add-packages python=3.8 notebook hvplot=0.7.3 panel=0.12.6 xarray=0.20 pooch=1.4 netCDF4
Create an example notebook-based Panel app#
In this section, we will create a new notebook called
Interactive.ipynb via either of the following methods:
Download this quickstart example:
Right-click the link and “Save As”, naming the file
Interactive.ipynband saving it into your new demo_app folder, orUse the
curlcommand below. This can be used on a unix-like platform.
$ curl https://raw.githubusercontent.com/Anaconda-Platform/anaconda-project/master/examples/quickstart/Interactive.ipynb -o Interactive.ipynb
Note
This example is taken from a larger, more full-featured hvPlot interactive, one that will work as well, if you would prefer to download that.
Alternatively, you can launch a Jupyter notebook session with:
$ anaconda-project run jupyter notebook
Click the New button and choose the Python3 option. Paste the following contents into a cell and click File|Save as…, naming the file
Interactive.import xarray as xr, hvplot.xarray, hvplot.pandas, panel as pn, panel.widgets as pnw ds = xr.tutorial.load_dataset('air_temperature') diff = ds.air.interactive.sel(time=pnw.DiscreteSlider) - ds.air.mean('time') kind = pnw.Select(options=['contourf', 'contour', 'image'], value='image') plot = diff.hvplot(cmap='RdBu_r', clim=(-20, 20), kind=kind) hvlogo = pn.panel("https://hvplot.holoviz.org/assets/hvplot-wm.png", width=100) pnlogo = pn.panel("https://panel.holoviz.org/_static/logo_stacked.png", width=100) text = pn.panel("## Select a time and type of plot", width=400) pn.Column( pn.Row(hvlogo, pn.Spacer(width=20), pn.Column(text, plot.widgets()), pnlogo), plot.panel()).servable()You can exit the running Jupyter Notebook program using CTRL+C in your terminal or command line.
Run your project#
Register a new command to launch the notebook as a Panel app:
$ anaconda-project add-command --type unix dashboard "panel serve Interactive.ipynb"
Note
The
unixcommand type may be used for linux & macOS. For Windows, replace--type unixwith--type windows
Run your new project:
$ anaconda-project run dashboard --show
Your application should now be running and available at http://localhost:5006/Interactive. Once you’re finished with it, you can close the running program using CTRL+C in your terminal or command line.
Next steps#
Learn more about what you can do with anaconda-project, including how to download data with your project and how to configure your project with environment variables.
Learn more about the anaconda-project.yml format.