-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FAST_BUILD] Migrate runhooks
to python
#2007
Conversation
Based on > Stop using bash, haha 👍 from jupyter#1532. If there's more apetite for this, I'll try to migrate `start.sh` and `start-singleuser.sh` as well - I think they should all be merged together. We can remove the `.sh` suffixes for accuracy, and keep symlinks in so old config still works. Since the shebang is what is used to launch the correct interpreter, the `.sh` doesn't matter. Will help fix jupyter#1532, as I believe all those things are going to be easier to do from python than bash
-u can not be set by shebang, we must set the env var instead
Co-authored-by: Ayaz Salikhov <[email protected]>
- Primarily, implement the `source` method to emulate behavior of source command in bash - This won't actually be effective until start.sh is rewritten as well
@mathbunnyru take a look at this for the |
a594ab3
to
c002adc
Compare
That's a nice trick, and I love it! |
@yuvipanda I merged the previous PR, please rebase/merge/create new PR for start.sh and run-hooks.py (whichever you choose and makes git diff nice and small is ok for me). |
@mathbunnyru I've merged that in here. Since |
But do tell me your ideas, I'll revisit here wherever possible |
What happens with bash functions that are defined in one hook and used in another? |
I agree with @yuvipanda on @manics issue. Generally speaking, we haven't promised the order in which shell scripts are sourced/called (the current implementation is in order and tests use this though). |
@yuvipanda also, when you will be porting This package is not added in the images, but I am pretty sure it's tiny and without lots of additional dependencies. |
Co-authored-by: Ayaz Salikhov <[email protected]>
Co-authored-by: Ayaz Salikhov <[email protected]>
I'm pacing myself on this one, and spent another 15 minutes on it today addressing some of the review feedback :) |
runhooks
to pythonrunhooks
to python
Added a test for unset: #2022 |
Added a test for changing variable value: #2023 |
@@ -1,46 +1,6 @@ | |||
#!/bin/bash | |||
# Copyright (c) Jupyter Development Team. | |||
# Distributed under the terms of the Modified BSD License. | |||
# echo "WARNING: Use run-hooks.py instead" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we have to comment this line, otherwise, tests fail, because they do not expect warnings.
@yuvipanda I added some tests for run-hooks and rewrote the test file a little bit, to make adding new tests easier. |
@yuvipanda do you have plans to continue working on this? 🙂 |
Closing this PR, as there is no activity here |
This can't be merged without also migrating
start.sh
, but opening this primarily toshow the implementation of
source
. I think that is the biggest barrier to migratingstart.sh
to python, and this approach solves it quite neatly - am pretty proud of it :D
You can test it by creating a folder like this:
And the contents of the files are:
And then run:
you can see that
01-set-variable
exports a variable, which is then read by02-get-variable
!We can turn this into a unit test later
This is built on top of #2006, see yuvipanda/docker-stacks@start-notebook-python...yuvipanda:docker-stacks:runhooks-py for just the run-hooks change