Skip to content

Commit

Permalink
release to test pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
ann-marie-ward committed Apr 28, 2021
1 parent 4eb8acd commit cd38617
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 122 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
- name: Build package
run: python -m build --sdist --wheel --outdir dist/

# - name: Publish dash-bootstrap-templates to TestPyPI
# uses: pypa/[email protected]
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
- name: Publish dash-bootstrap-templates to TestPyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

# - name: Publish dash-bootstrap-templates to PyPI
# uses: pypa/[email protected]
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This library has a template for each of the 22 Bootstrap/Bootswatch themes avail
[Dash Bootstrap Components Library](https://dash-bootstrap-components.opensource.faculty.ai/).

## Quickstart
```python"
pip install dash-bootstrap-templates
```

```python

Expand Down Expand Up @@ -106,3 +109,7 @@ valid_themes = [
"solar",
"superhero",
]

### Contributors
Special thanks to @tcbegley for [the pull request](https://github.com/AnnMarieW/dash-bootstrap-templates/pull/2) to
set up this library to publish to PyPI
117 changes: 0 additions & 117 deletions examples/dl_demo_4figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,120 +160,3 @@ def update_charts(indicator, continents, years):




from dash_bootstrap_templates import load_figure_template

import dash
import dash_labs as dl
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import dash_bootstrap_components as dbc



tpl = dl.templates.dbc.DbcSidebar(
title="Dash Bootstrap Template Demo",
sidebar_columns=3,
theme=dbc.themes.FLATLY, # change theme here
figure_template=True
)

app = dash.Dash(__name__, plugins=[dl.plugins.FlexibleCallbacks()])

df = px.data.gapminder()

dropdown = dcc.Dropdown(
id="indicator",
options=[{"label": str(i), "value": i} for i in ["gdpPercap", "lifeExp", "pop"]],
value="gdpPercap",
clearable=False,
)


checklist = dbc.Checklist(
id="continents",
options=[{"label": i, "value": i} for i in df.continent.unique()],
value=df.continent.unique()[1:],
inline=True,
)

years = df.year.unique()
range_slider = dcc.RangeSlider(
id="slider_years",
min=years[0],
max=years[-1],
step=5,
marks={int(i): str(i) for i in [1952,1962,1972,1982,1992,2002,2007]},
value=[1982, years[-1]],
)

badges = html.Div(
[
dbc.Badge("Primary", color="primary", className="mr-1"),
dbc.Badge("Secondary", color="secondary", className="mr-1"),
dbc.Badge("Success", color="success", className="mr-1"),
dbc.Badge("Warning", color="warning", className="mr-1"),
dbc.Badge("Danger", color="danger", className="mr-1"),
dbc.Badge("Info", color="info", className="mr-1"),
dbc.Badge("Light", color="light", className="mr-1"),
dbc.Badge("Dark", color="dark", className="mr-1"),
]
)


@app.callback(
dl.Input(dropdown, label="Select indicator (y-axis)"),
dl.Input(checklist, label="Select continents"),
dl.Input(range_slider, label="Select time period"),
template=tpl,
)
def update_charts(indicator, continents, years):
if continents == [] or indicator is None:
return {}, {}

dff = df[df.year.between(years[0], years[1])]
dff = dff[dff.continent.isin(continents)]
line_fig = px.line(
dff, x="year", y=indicator, color="continent", line_group="country"
)

dff = dff[dff.year == years[1]]
scatter_fig = px.scatter(
dff, x="lifeExp", y=indicator, size="pop", color="pop", size_max=60
).update_traces(marker_opacity=0.8)

avg_lifeExp = (dff["lifeExp"] * dff["pop"]).sum() / dff["pop"].sum()
map_fig = px.choropleth(
dff,
locations="iso_alpha",
color="lifeExp",
title="%.0f World Average Life Expectancy was %.1f years" % (years[1], avg_lifeExp),
)

hist_fig = px.histogram(dff, x="lifeExp", nbins=10, title="Life Expectancy")

return html.Div(
[
dbc.Row(
[
dbc.Col(dcc.Graph(figure=line_fig), lg=6),
dbc.Col(dcc.Graph(figure=scatter_fig), lg=6),
]
),
dbc.Row(
[
dbc.Col(dcc.Graph(figure=hist_fig), lg=6),
dbc.Col(dcc.Graph(figure=map_fig),lg=6),
]
),
]
)


tpl.add_component(badges, role="input", after=2)
app.layout = tpl.layout(app)


if __name__ == "__main__":
app.run_server(debug=True)

0 comments on commit cd38617

Please sign in to comment.