Package: gsmo
gsmoCommonsense Git, Docker, and Jupyter integrations.mount local Git clones into purpose-built Docker containerseasily configure dependencies, set useful default Git configs, and mirror host user/group so that Git commits in container transparently exist on the hostrun scriptsnon-interactively, automatically Git-commit updated filesrun "remotely" against Git repositories, pushing changes upstream for static, serverless workflowseasily boot aJupyter serverorBash shellfrom a clone and its corresponding Docker image, for interactive work.Seegsmo.ymlfor configuration optionsUsageRun notebooks non-interactivelygsmohelps run notebooks and scripts in a reproducible fashion (inside Docker containers), and pass-through changes (Git commits) to the host machine:Running:gsmorunin a project directory will:load configs (gsmo.yml)build a Docker imagerun a container from that imagerun the project'srun.ipynbnotebook inside that containerGit-commit resultsRun interactivelyJupyter ServerBuild a Docker image from the current directory, configured bygsmo.yml, and launch a Jupyter server with the current directory mounted (and various Git- and OS-level configs set, so that changes/commits transparently pass through to the host machine):gsmojupyter# or: gsmo jruns at a "random" but stable port (derived from a hash of the module name)easily configure Python/Linux environment usinggsmo.ymlBash shellBuild a Docker image from the current directory, configured bygsmo.yml, and launch a Bash shell with it mounted (and various Git- and OS-level configs set, so that changes/commits transparently pass through to the host machine):gsmoshModule configuration:gsmo.ymlWhen you rungsmoin a directory, it will look for agsmo.ymlfile in the current directory with any of the following fields and build a corresponding Docker image:General configs(seegsmo -hfor full/authoritative list):name(str; default: project directory's basename): module name; also used as repository for built Docker imagepip(strorList[str]):piplibraries to installapt(strorList[str]):aptlibraries to installenv(strorList[str]): environment variables to setenv_file(str): file with environment variablesgroup(strorList[str]): OS groups to add to the user inside the containerpaths are accepted, in which case the group that owns that path will be usedtag(strorList[str]): additional Docker tags withinnamerepositorymount(strorList[str]): Docker mounts, in several convenient formats:<path>: equivalent to<path>:/<path>; easily pass local project subdirectories into Docker container, e.g.home/.bashrc,etc/pip.conf, etc.standard Docker<src>:<dst>syntax is also supportedin all cases,~and env vars are expandedimage(str; default:runsascoded/gsmo:<gsmo version>): base Docker image to build from;<gsmo version>will be the pip version ofgsmothat was installedroot(bool; defaultFalse)when set, run asrootinside containerby default, host-machine uid+gid are useddst(str: default/src): path inside container to mount current directory togsmo runconfigsThese configs are passed into the Docker container / pertain to the running of a script or notebook inside the container (seenon-interactive mode):run(str; default:run.ipynb): notebook to rundir(str; default: current directory): resolve paths (incl. mounts) relative to this directoryyaml(strorList[str]): YAML string(s) with configuration settings for the module being runyaml_path(strorList[str]): YAML file(s) with configuration settings for the module being runcommit(strorList[str]; default:outconfig dir): paths to Git commit after a run (in non-interactive mode)out(str; defaultnbs): directory to write executed notebooks togsmorun-husage: gsmo [input] run [-h] [-b BRANCH] [--clone] [--commit COMMIT] [-C DIR] [-o OUT] [--push PUSH] [-x RUN] [-y YAML] [-Y YAML_PATH]

optional arguments:
  -h, --help            show this help message and exit
  -b BRANCH, --branch BRANCH
                        Branch to clone, work in, and push results back to. Can also be passed as a trailing '@<branch>' slug on directory path or remote Git
                        repo URL. For local repositories, implies --clone
  --clone               Clone local directory into a temporary dir for duration of the run
  --commit COMMIT       Paths to `git add` and commit after running
  -C DIR, --dir DIR     Resolve paths (incl. mounts) relative to this directory (default: current directory)
  -o OUT, --out OUT     Path or directory to write output notebook to (relative to `--dir` directory; default: "nbs")
  --push PUSH           Push to this remote spec when done running
  -x RUN, --run RUN, --execute RUN
                        Notebook to run (default: run.ipynb)
  -y YAML, --yaml YAML  YAML string(s) with configuration settings for the module being run
  -Y YAML_PATH, --yaml-path YAML_PATH
                        YAML file(s) with configuration settings for the module being rungsmo jupyterconfigsgsmojupyter-husage: gsmo [input] jupyter [-h] [-d] [-D] [-O] [-s] [--dir DIR]

optional arguments:
  -h, --help       show this help message and exit
  -d, --detach     When booting into Jupyter server mode, detach the container
  -D, --no-docker  Run in the current shell instead of in Docker
  -O, --no-open    Skip opening Jupyter notebook server in browser
  -s, --shell      Open a /bin/bash shell in the container (instead of running a jupyter server)
  --dir DIR        Root dir for jupyter notebook server (default: --dst / `/src`DockerfileWhen building the Docker image (in any of the above modes), if aDockerfileis present in the repository, it will be built and used as the base image (and anygsmo.ymlconfigs applied on top of it).