Skip to content

Commit

Permalink
ip and port options for play
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidcarbon authored Sep 12, 2024
1 parent efe396e commit e345fd3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pup.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def new_venv(where):
default="notebook",
help="jupyter flavor"
)
@click.option("--ip, "-i", default="0.0.0.0", help="Jupyter Server IP (default: 0.0.0.0)")
@click.option("--port, "-p", default="8880", help="Jupyter Server port (default: 8880)")
@click.option("--name", "-n", default=None, help="notebook name (default: timestamp)")
@click.option("--kernel-name", "-k", default="python3", help="kernel name")
# @click.option("--modify", "-M", is_flag=True, default=False, help="modify existing notebook (no_prompt)")
Expand Down Expand Up @@ -206,7 +208,7 @@ def new_venv(where):
------------------------------------------------
"""
)
def do_jupyter(jupyter, name, kernel_name, ex, start, code):
def do_jupyter(jupyter, ip, port, name, kernel_name, ex, start, code):
"""Generate, execute, or open jupyter notebook with added code cells."""

PUP_NOTEBOOKS.mkdir(exist_ok=True)
Expand Down Expand Up @@ -251,7 +253,7 @@ def do_jupyter(jupyter, name, kernel_name, ex, start, code):
tee(f"done")

if start:
cmd = f"""pixi run jupyter {jupyter} {nb_file} --notebook-dir "{PUP_HOME}" """
cmd = f"""pixi run jupyter {jupyter} {nb_file} --notebook-dir "{PUP_HOME}" --ip {ip} --port {port}"""
tee(cmd)
subprocess.run(cmd.split())

Expand Down

0 comments on commit e345fd3

Please sign in to comment.