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.py
nitro 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
USE
uses venv, conda, poetry, pipenv, etc.FILE
creates a file relative to cwd.RUN
executes a shell command.GET
fetches a file given a relative or absolute URL.COPY
copies, moves, renames local files.