Skip to content

Commit aa17376

Browse files
committed
Screenshot and metadata
1 parent 5092dd6 commit aa17376

File tree

4 files changed

+390
-0
lines changed

4 files changed

+390
-0
lines changed

.gitignore

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
.DS_Store
2+
.vscode/
3+
4+
# Build artifacts
5+
dash_ag_grid/*
6+
!dash_ag_grid/__init__.py
7+
R/
8+
deps/
9+
man/
10+
inst/
11+
DESCRIPTION
12+
NAMESPACE
13+
Project.toml
14+
src/*.jl
15+
src/jl/*.jl
16+
lib/
17+
18+
# Created by .ignore support plugin (hsz.mobi)
19+
### VisualStudioCode template
20+
.vscode/*
21+
!.vscode/settings.json
22+
!.vscode/tasks.json
23+
!.vscode/launch.json
24+
!.vscode/extensions.json
25+
### JetBrains template
26+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
27+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
28+
29+
# User-specific stuff
30+
.idea/**/workspace.xml
31+
.idea/**/tasks.xml
32+
.idea/**/usage.statistics.xml
33+
.idea/**/dictionaries
34+
.idea/**/shelf
35+
36+
# Sensitive or high-churn files
37+
.idea/**/dataSources/
38+
.idea/**/dataSources.ids
39+
.idea/**/dataSources.local.xml
40+
.idea/**/sqlDataSources.xml
41+
.idea/**/dynamic.xml
42+
.idea/**/uiDesigner.xml
43+
.idea/**/dbnavigator.xml
44+
45+
# Gradle
46+
.idea/**/gradle.xml
47+
.idea/**/libraries
48+
49+
# Gradle and Maven with auto-import
50+
# When using Gradle or Maven with auto-import, you should exclude module files,
51+
# since they will be recreated, and may cause churn. Uncomment if using
52+
# auto-import.
53+
# .idea/modules.xml
54+
# .idea/*.iml
55+
# .idea/modules
56+
57+
# CMake
58+
cmake-build-*/
59+
60+
# Mongo Explorer plugin
61+
.idea/**/mongoSettings.xml
62+
63+
# File-based project format
64+
*.iws
65+
66+
# IntelliJ
67+
out/
68+
69+
# mpeltonen/sbt-idea plugin
70+
.idea_modules/
71+
72+
# JIRA plugin
73+
atlassian-ide-plugin.xml
74+
75+
# Cursive Clojure plugin
76+
.idea/replstate.xml
77+
78+
# Crashlytics plugin (for Android Studio and IntelliJ)
79+
com_crashlytics_export_strings.xml
80+
crashlytics.properties
81+
crashlytics-build.properties
82+
fabric.properties
83+
84+
# Editor-based Rest Client
85+
.idea/httpRequests
86+
### Node template
87+
# Logs
88+
logs
89+
*.log
90+
npm-debug.log*
91+
yarn-debug.log*
92+
yarn-error.log*
93+
94+
# Runtime data
95+
pids
96+
*.pid
97+
*.seed
98+
*.pid.lock
99+
100+
# Directory for instrumented libs generated by jscoverage/JSCover
101+
lib-cov
102+
103+
# Coverage directory used by tools like istanbul
104+
coverage
105+
106+
# nyc test coverage
107+
.nyc_output
108+
109+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
110+
.grunt
111+
112+
# Bower dependency directory (https://bower.io/)
113+
bower_components
114+
115+
# node-waf configuration
116+
.lock-wscript
117+
118+
# Compiled binary addons (https://nodejs.org/api/addons.html)
119+
build/Release
120+
121+
# Dependency directories
122+
node_modules/
123+
jspm_packages/
124+
125+
# TypeScript v1 declaration files
126+
typings/
127+
128+
# Optional npm cache directory
129+
.npm
130+
131+
# Optional eslint cache
132+
.eslintcache
133+
134+
# Optional REPL history
135+
.node_repl_history
136+
137+
# Output of 'npm pack'
138+
*.tgz
139+
140+
# Yarn Integrity file
141+
.yarn-integrity
142+
143+
# dotenv environment variables file
144+
.env
145+
146+
# parcel-bundler cache (https://parceljs.org/)
147+
.cache
148+
149+
# next.js build output
150+
.next
151+
152+
# nuxt.js build output
153+
.nuxt
154+
155+
# vuepress build output
156+
.vuepress/dist
157+
158+
# Serverless directories
159+
.serverless
160+
### Python template
161+
# Byte-compiled / optimized / DLL files
162+
__pycache__/
163+
*.py[cod]
164+
*$py.class
165+
166+
# C extensions
167+
*.so
168+
169+
# Distribution / packaging
170+
.Python
171+
build/
172+
develop-eggs/
173+
dist/
174+
downloads/
175+
eggs/
176+
.eggs/
177+
lib64/
178+
parts/
179+
sdist/
180+
var/
181+
wheels/
182+
*.egg-info/
183+
.installed.cfg
184+
*.egg
185+
MANIFEST
186+
187+
# PyInstaller
188+
# Usually these files are written by a python script from a template
189+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
190+
*.manifest
191+
*.spec
192+
193+
# Installer logs
194+
pip-log.txt
195+
pip-delete-this-directory.txt
196+
197+
# Unit test / coverage reports
198+
htmlcov/
199+
.tox/
200+
.coverage
201+
.coverage.*
202+
nosetests.xml
203+
coverage.xml
204+
*.cover
205+
.hypothesis/
206+
.pytest_cache/
207+
208+
# Translations
209+
*.mo
210+
*.pot
211+
212+
# Django stuff:
213+
local_settings.py
214+
db.sqlite3
215+
216+
# Flask stuff:
217+
instance/
218+
.webassets-cache
219+
220+
# Scrapy stuff:
221+
.scrapy
222+
223+
# Sphinx documentation
224+
docs/_build/
225+
226+
# PyBuilder
227+
target/
228+
229+
# Jupyter Notebook
230+
.ipynb_checkpoints
231+
232+
# pyenv
233+
.python-version
234+
235+
# celery beat schedule file
236+
celerybeat-schedule
237+
238+
# SageMath parsed files
239+
*.sage.py
240+
241+
# Environments
242+
.venv
243+
env/
244+
venv/
245+
ENV/
246+
env.bak/
247+
venv.bak/
248+
249+
# Spyder project settings
250+
.spyderproject
251+
.spyproject
252+
253+
# Rope project settings
254+
.ropeproject
255+
256+
# mkdocs documentation
257+
/site
258+
259+
# mypy
260+
.mypy_cache/
261+
### SublimeText template
262+
# Cache files for Sublime Text
263+
*.tmlanguage.cache
264+
*.tmPreferences.cache
265+
*.stTheme.cache
266+
267+
# Workspace files are user-specific
268+
*.sublime-workspace
269+
270+
# Project files should be checked into the repository, unless a significant
271+
# proportion of contributors will probably not be using Sublime Text
272+
# *.sublime-project
273+
274+
# SFTP configuration file
275+
sftp-config.json
276+
277+
# Package control specific files
278+
Package Control.last-run
279+
Package Control.ca-list
280+
Package Control.ca-bundle
281+
Package Control.system-ca-bundle
282+
Package Control.cache/
283+
Package Control.ca-certs/
284+
Package Control.merged-ca-bundle
285+
Package Control.user-ca-bundle
286+
oscrypto-ca-bundle.crt
287+
bh_unicode_properties.cache
288+
289+
# Sublime-github package stores a github token in this file
290+
# https://packagecontrol.io/packages/sublime-github
291+
GitHub.sublime-settings

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:3.12
2+
COPY --from=ghcr.io/astral-sh/uv:0.4.20 /uv /bin/uv
3+
4+
RUN useradd -m -u 1000 user
5+
ENV PATH="/home/user/.local/bin:$PATH"
6+
ENV UV_SYSTEM_PYTHON=1
7+
8+
WORKDIR /app
9+
10+
COPY --chown=user ./requirements.txt requirements.txt
11+
RUN uv pip install -r requirements.txt
12+
13+
COPY --chown=user . /app
14+
USER user
15+
16+
CMD ["gunicorn", "app:server", "--workers", "4", "--bind", "0.0.0.0:7860"]

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Dash on Spaces
2+
3+
![Gapminder Dashboard Screenshot](screenshot.jpeg)
4+
5+
With Dash Open Source, you can create data apps on your laptop in pure Python, no JavaScript required.
6+
7+
Get familiar with Dash by building a [sample app](https://dash.plotly.com/tutorial) with open source. Scale up with [Dash Enterprise](https://plotly.com/dash/) when your Dash app is ready for department or company-wide consumption. Or, launch your initiative with Dash Enterprise from the start to unlock developer productivity gains and hands-on acceleration from Plotly's team.
8+
9+
## Deploy Dash on Spaces
10+
11+
To get started with Dash on Spaces, click the button below:
12+
13+
<a href="http://huggingface.co/new-space?template=plotly/dash-app-template" target="_blank">
14+
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg" alt="">
15+
</a>
16+
17+
This will start building your Space using Plotly's Dash Docker template. If successful, you should see a similar application to the [Dash template app](https://huggingface.co/spaces/dash/dash-app-template).
18+
19+
## Customizing your Dash app
20+
21+
If you have never built with Dash before, we recommend getting started with our [Dash in 20 minutes tutorial](https://dash.plotly.com/tutorial).
22+
23+
When you create a Dash Space, you'll get a few key files to help you get started:
24+
25+
### 1. app.py
26+
27+
This is the main app file that defines the core logic of your project. Dash apps are often structured as modules, and you can optionally seperate your layout, callbacks, and data into other files, like `layout.py`, etc.
28+
29+
Inside of `app.py` you will see:
30+
31+
1. `from dash import Dash, html`
32+
We import the `Dash` object to define our app, and the `html` library, which gives us building blocks to assemble our project.
33+
34+
2. `app = Dash()`
35+
Here, we define our app. Layout, server, and callbacks are _bound_ to the `app` object.
36+
37+
3. `server = app.server`
38+
Here, we define our server variable, which is used to run the app in production.
39+
40+
4. `app.layout = `
41+
The starter app layout is defined as a list of Dash components, an indivdual Dash component, or a function that returns either.
42+
43+
The `app.layout` is your initial layout that will be updated as a single-page application by callbacks and other logic in your project.
44+
45+
5. `if __name__ == '__main__': app.run(debug=True)`
46+
If you are running your project locally with `python app.py`, `app.run(...)` will execute and start up a development server to work on your project, with features including hot reloading, the callback graph, and more.
47+
48+
In production, we recommend `gunicorn`, which is a production-grade server. Debug features will not be enabled when running your project with `gunicorn`, so this line will never be reached.
49+
50+
### 2. Dockerfile
51+
52+
The Dockerfile for a Dash app is minimal since Dash has few system dependencies. The key requirements are:
53+
54+
- It installs the dependencies listed in `requirements.txt` (using `uv`)
55+
- It creates a non-root user for security
56+
- It runs the app with `gunicorn` using `gunicorn app:server --workers 4`
57+
58+
You may need to modify this file if your application requires additional system dependencies, permissions, or other CLI flags.
59+
60+
### 3. requirements.txt
61+
62+
The Space will automatically install dependencies listed in the `requirements.txt` file. At minimum, you must include `dash` and `gunicorn` in this file. You will want to add any other required packages your app needs.
63+
64+
The Dash Space template provides a basic setup that you can extend based on your needs.
65+
66+
## Additional Resources and Support
67+
68+
- [Dash documentation](https://dash.plotly.com)
69+
- [Dash GitHub repository](https://github.com/plotly/dash)
70+
- [Dash Community Forums](https://community.plotly.com)
71+
- [Dash Enterprise](https://plotly.com/dash)
72+
- [Dash template Space](https://huggingface.co/spaces/plotly/dash-app-template)
73+
74+
## Troubleshooting
75+
76+
If you encounter issues:
77+
78+
1. Make sure your notebook runs locally in app mode using `python app.py`
79+
2. Check that all required packages are listed in `requirements.txt`
80+
3. Verify the port configuration matches (7860 is the default for Spaces)
81+
4. Check Space logs for any Python errors
82+
83+
For more help, visit the [Plotly Community Forums](https://community.plotly.com) or [open an issue](https://github.com/plotly/dash/issues).

screenshot.jpeg

502 KB
Loading

0 commit comments

Comments
 (0)