A Docker-like thing for apps
A rough proposal for a shebang-meets-dockerfile thingy, so that a .py file can specify its dependencies, and a “nitro run” command can directly launch an app from a file or gist or code snippet anywhere on the interwebs.
Goal
Execute apps locally given one of:
nitro run foo.pynitro run https://gist.github.com/user/hash
Notes
The deps for the app are self-contained in the .py file using a shebang-meets-dockerfile thingy:
# --- env ---
# USE venv
# RUN pip install pandas bokeh flask h2o-nitro
# RUN FLASK_APP=app.py flask run
# --- !env ---
def main():
pass
or
# --- env ---
# USE venv
# FILE requirements.txt EOF
# pandas==4.5
# bokeh>=0.4.2
# flask
# h2o-nitro>0.8.2
# EOF
# RUN pip install -r requirements.txt
# RUN FLASK_APP=app.py flask run
# --- !env ---
def main():
pass
Supported commands are
USEuses venv, conda, poetry, pipenv, etc.FILEcreates a file relative to cwd.RUNexecutes a shell command.GETfetches a file given a relative or absolute URL.COPYcopies, moves, renames local files.