jupyterhub / nbgitpuller

Jupyter server extension to sync a git repository one-way to a local path
https://nbgitpuller.readthedocs.io
BSD 3-Clause "New" or "Revised" License
212 stars 86 forks source link

Execution of gitpuller in shell throws KeyError: 'branch' version tag 0.10.0 #184

Open aschiffler opened 3 years ago

aschiffler commented 3 years ago

Bug description

execute gitpuller from bash/shell like this: gitpuller https://github.com/jupyterhub/nbgitpuller.git fails.

Expected behaviour

Execution shall work with or without specifying a branch value on the command line see application of that eg. here https://zero-to-jupyterhub.readthedocs.io/en/latest/jupyterhub/customizing/user-environment.html?highlight=gitpuller#using-multiple-profiles-to-let-users-select-their-environment

Actual behaviour

File "/opt/conda/lib/python3.9/site-packages/nbgitpuller/pull.py", line 73, in __init__ self.branch_name = kwargs.pop("branch") KeyError: 'branch'

Source of Bug

Since in 0.10.0 the argument "branch" is removed by commit https://github.com/jupyterhub/nbgitpuller/commit/12f25dd45d09d140038a9f9c4b66d7b7cb3ea715#diff-50b85d13b73c3cf1fbf0047f5786d5e8ddba9f959b617c0354d15c399ab47539

https://github.com/jupyterhub/nbgitpuller/blob/3280fdde5d9abc64e4b6271375bd03e94886103d/nbgitpuller/pull.py#L73

set up

JupyterHub 1.3.0 20210609150206 on microk8s 1.21 with ubuntu 20.04 jupyter base notebook image

welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

sean-morris commented 3 years ago

Thank you for posting this issue. I had been handling issues related to specifying a default branch and did not realize there were users using this tool at the command line. I submitted a PR with the fix; I imagine we will get it in quickly.

aschiffler commented 3 years ago

👍 That's good news. Thank you. I use it via command line during startup of the jupyter notebook servers as a post-hook command. Like it is mentioned in the documentation for zero-to-JupyterHub with k8s.

meeseeksmachine commented 3 years ago

This issue has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/handling-failed-gitpuller-lifecyclehooks/5724/5

mr-z-ro commented 2 months ago

Bump. This seems to still be an issue in 1.2.1, which is the version that is packaged by default in the tooling mentioned by @aschiffler : https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/singleuser-sample/requirements.txt#L170