Did any one have a nice method to use the post-save-hook for commit to github
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
I use subprocess.call() to send the git commands, I think it is very rough; and I searched git packages for python3, but it`s not support any more.
```
def script_post_save(model, os_path, contents_manager, **kwargs):
if model['type'] != 'notebook':
return
log = contents_manager.log
""" Commit and push to GitHub
将 notebook 提交 github 分支 Algorithms。
"""
try:
subprocess.call("cd /home/notebook && git status", shell=True)
subprocess.call("cd /home/notebook && git add --all", shell=True)
subprocess.call("cd /home/notebook && git commit -m 'Jupyter notebook update'", shell=True)
subprocess.call("cd /home/notebook && git pull origin Algorithms", shell=True)
subprocess.call("cd /home/notebook && git push origin Algorithms", shell=True)
except:
subprocess.call("cd /home/notebook && git stash", shell=True)
```
Contributor guide
Research direction
No project file or test is named; start by tracing the post-save hook entry point represented by script_post_save and the subprocess calls in the issue. Done would require a documented approach for committing and pushing notebooks to GitHub, but the issue does not define one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github, jupyter-notebook, python
- Domain
- developer-experience
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100