So far we've demonstrated how to build and view reports locally; however, one of the most powerful features of Datapane is the ability to publish your report straight from your code and share it directly with your team or the wider world.
Once you've logged in to your chosen Datapane server, call
publish(name='your-report-name') in your script and your report will be published to your Datapane instance for viewing online. This will return the URL of the report that you can share.
If we take the report from the previous example, all we need to do is change
.publish and choose a name for our report.
simple_report.pyimport pandas as pdimport altair as altimport datapane as dpdataset = pd.read_csv('https://covid.ourworldindata.org/data/owid-covid-data.csv')df = dataset.groupby(['continent', 'date'])['new_cases_smoothed_per_million'].mean().reset_index()plot = alt.Chart(df).mark_area(opacity=0.4, stroke='black').encode(x='date:T',y=alt.Y('new_cases_smoothed_per_million:Q', stack=None),color=alt.Color('continent:N', scale=alt.Scale(scheme='set1')),tooltip='continent:N').interactive().properties(width='container')dp.Report(dp.Plot(plot),dp.Table(df)).publish(name='covid_report', open=True)
Once published, you can share the link with others.
Reports published to Datapane Public and Datapane for Teams are versioned. If you publish a report with the same name as a previous report, it will increment the version. Using the Datapane web UI, you can view previous versions of reports.
In the next section, we will explore how to embed your report into a range of other platforms.