This repo has been replaced by kingofsnake.
Docker example: a Python package which builds its own Python.
I want my code to have the Python it needs, even when it's deployed remotely.
Suneku uses Docker Compose to:
- build an image from instructions in its Dockerfile
- download packages listed in requirements.txt
- run custom services defined in docker-compose.yaml
- run its own Jupyter notebook server
Suneku installs software to a Docker image, not to the host machine. It never modifies anaconda, pip, brew, virtualenv, nor your system Python(s).
- Install Docker for Mac or Windows or Linux.
- Clone this repository to any folder on your machine.
- Open a terminal and
cd
to that folder. - Enter
docker-compose run clock
to run an example service.
Docker will download everything it needs to build a suneku:latest
image.
Subsequent runs re-use this image and are much faster.
See the dockerbash repository for a short list of common Docker commands.
docker-compose run python
starts an interactive Python session.docker-compose run tests
runs all automated tests.
docker-compose up clock
prints a timestamp every 1 second.docker-compose up jupyter
starts a Jupyter server.
- Open a terminal and
cd
to wherever you cloned this repository. docker-compose down
stops and deletes allsuneku
containers.
- Delete the folder where you cloned the
suneku
repository. - Run
docker rmi suneku:latest
to delete the image. - Run
docker system prune
to delete any Docker leftovers.
The
suneku
folder is a Python package.
To comply with
PEP 423,
it has the same name as this repository.
The suneku:latest
image includes it as an
editable pip install.
See the examples folder for notebooks demonstrating the package. Notebooks can be viewed in GitHub without running Jupyter.
- Enter
docker-compose up jupyter
to ensure the server is running. - Open a browser and enter
127.0.0.1:8888
in the address bar. - If Jupyter demands a token, then copypaste it from the terminal.
The Jupyter server ignores requests from all other addresses. The address can be modified in docker-compose.yaml.
Suneku stores its IPython and Jupyter settings in the
config folder.
To use your own settings,
symlink
to your .ipython
and/or .jupyter
folders:
ln -s config/.ipython /path/to/your/.ipython
ln -s config/.jupyter /path/to/your/.jupyter
The config folder is for configuration files. The data folder is for datasets.
Files here are not copied into images nor uploaded to GitHub. Containers can access these folders only by mounting them or their parents. The only exceptions are config/README.md and these example datasets:
- data/NewYorkEnergy.csv from data.ny.gov GWh of electricity generated in New York since 1980.
- ZonalTempAnomaly.csv from data.giss.nasa.gov Global surface temperature anomalies since 1880.