Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

samkennerly/suneku

Repository files navigation

suneku (ARCHIVED)

This repo has been replaced by kingofsnake.

Docker example: a Python package which builds its own Python.

bring your favorite Python everywhere

I want my code to have the Python it needs, even when it's deployed remotely.

Everybody strap in.

Suneku uses Docker Compose to:

Suneku installs software to a Docker image, not to the host machine. It never modifies anaconda, pip, brew, virtualenv, nor your system Python(s).

quickstart

  1. Install Docker for Mac or Windows or Linux.
  2. Clone this repository to any folder on your machine.
  3. Open a terminal and cd to that folder.
  4. 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.

run temporary services

  • docker-compose run python starts an interactive Python session.
  • docker-compose run tests runs all automated tests.

start persistent services

  • docker-compose up clock prints a timestamp every 1 second.
  • docker-compose up jupyter starts a Jupyter server.

terminate all services

  1. Open a terminal and cd to wherever you cloned this repository.
  2. docker-compose down stops and deletes all suneku containers.

uninstall suneku

  1. Delete the folder where you cloned the suneku repository.
  2. Run docker rmi suneku:latest to delete the image.
  3. Run docker system prune to delete any Docker leftovers.

suneku package

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.

jupyter server

  1. Enter docker-compose up jupyter to ensure the server is running.
  2. Open a browser and enter 127.0.0.1:8888 in the address bar.
  3. 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

private folders

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: