---
title: README
emoji: 👀
colorFrom: blue
colorTo: red
sdk: static
pinned: false
---
Spaces Dev Mode is currently in beta. It's available for
PRO users (personnal Spaces) or
Enterprise organizations (org Spaces).
If you're using the Streamlit or Gradio SDK, or if your application is Pyhton-based, note that requirements are not installed automatically.
You will need to manually run `pip install` from VS Code or SSH.
### Persisting changes
The changes you make when the Dev Mode is enabled are not persisted to the Space repo automatically.
By default, they will be discarded when the Dev Mode is disabled or when the Space goes to sleep.
If you wish to persist changes made while the Dev Mode is enabled, you need to use `git` from inside the Space container (using VS Code or SSH). For example:
```shell
# Add changes and commit them
git add .
git commit -m "Persist changes from Dev Mode"
# Push the commit to persist them in the repo
git push
```
The modal will display a warning if you have uncommitted or unpushed changes in the Space:
![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/r6Uk1YyvE2-hzsKTSRvnR.png)
### How to enable the Dev Mode
Go to your Space's settings and click on "Enable Dev Mode".
![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/31fExSYIPyxgXm-B9uL4d.png)
You can also enable the Dev Mode from the quick actions dropdown.
![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/t2nQI_5kXY53QIVqBkIx6.png)
## Limitations
The Dev Mode is currently not available for static Spaces. Docker Spaces also have some additional requirements.
### Docker Spaces
Dev Mode is supported for Docker Spaces. However, your Space needs to comply with the following rules for the Dev Mode to work properly.
1. The following packages must be installed:
- `bash` (required to establish SSH connections)
- `curl`, `wget` and `procps` (required by the VS Code server process)
- `git` and `git-lfs` to be able to commit and push changes from your Dev Mode environment
2. Your application code must be located in the `/app` folder for the Dev Mode daemon to be able to detect changes.
3. The `/app` folder must be owned by the user with uid `1000` to allow you to make changes to the code.
4. The Dockerfile must contain a `CMD` instruction for startup. Checkout [Docker's documentation](https://docs.docker.com/reference/dockerfile/#cmd) about the `CMD` instruction for more details.
The Dev Mode works well when the base image is debian-based (eg, ubuntu).
More exotic linux distros (eg, alpine) are not tested and the Dev Mode is not guaranteed to work on them.
### Example of compatible Dockerfiles
This is an example of a Dockerfile compatible with Spaces Dev Mode.
It installs the required packages with `apt-get`, along with a couple more for developer convenience (namely: `top`, `vim` and `nano`).
It then starts a NodeJS application from `/app`.
```Dockerfile
FROM node:19-slim
RUN apt-get update && \
apt-get install -y \
bash \
git git-lfs \
wget curl procps \
htop vim nano && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --link ./ /app
RUN npm i
RUN chown 1000 /app
USER 1000
CMD ["node", "index.js"]
```
There are several examples of Dev Mode compatible Docker Spaces in this organization.
Feel free to duplicate them in your namespace!
Example Python app (FastAPI HTTP server): https://huggingface.co/spaces/dev-mode-explorers/dev-mode-python
Example Javascript app (Express.js HTTP server): https://huggingface.co/spaces/dev-mode-explorers/dev-mode-javascript