These are chat archives for ipython/ipython

30th
Nov 2014
Aristide
@laowantong
Nov 30 2014 10:19
Hello @Carreau, thank you for your guidance. I had cloned instead of forked the repo. Now, I've cloned it, but I guess the presence of the clone in my git folder prevents git to create the fork on my machine: https://www.dropbox.com/s/ez8mil4xf82boeu/Capture%20d%27%C3%A9cran%202014-11-30%2011.18.52.PNG?dl=0
Create Repo is grayed out
Matthias Bussonnier
@Carreau
Nov 30 2014 10:20
hum, not used to GUI.
you shoudl be able to get many remotes.
let me think.
I'll can either download git for mac, or do you prefer to try by the command line ?
Aristide
@laowantong
Nov 30 2014 10:23
bah, I should be able to use the command line too... But i've not rtfm yet :-/
Matthias Bussonnier
@Carreau
Nov 30 2014 10:23
no it's fine.
can you cd into ipython directory and do git remote -v ?
we can slowly learn git :-)
for example for me, it tells be that I have 2 remote (name origin and github) one of them is my fork:
$ git remote -v
github    ssh://github/Carreau/ipython (fetch)
github    ssh://github/Carreau/ipython (push)
origin    https://github.com/ipython/ipython.git (fetch)
origin    https://github.com/ipython/ipython.git (push)
Aristide
@laowantong
Nov 30 2014 10:28
ls -la does not show any .gitdirectory too
this is a test
ok :-)
Matthias Bussonnier
@Carreau
Nov 30 2014 10:32
cd into ipython first :-)
Aristide
@laowantong
Nov 30 2014 10:32
macmini-2:git aristide$ cd ipython
macmini-2:ipython aristide$ git remote -v
origin    https://github.com/ipython/ipython.git (fetch)
origin    https://github.com/ipython/ipython.git (push)
yes, I figured this out in the mean time, sorry
Matthias Bussonnier
@Carreau
Nov 30 2014 10:34
ok, great, now we are going to create a new remote
git remote add laowantong https://github.com/laowantong/ipython.git
Aristide
@laowantong
Nov 30 2014 10:34
done, no output
Matthias Bussonnier
@Carreau
Nov 30 2014 10:34
so now, if you do again git remote -v you shoudl get 2 remotes.
Aristide
@laowantong
Nov 30 2014 10:35
yes
Matthias Bussonnier
@Carreau
Nov 30 2014 10:35
so the git syntax to push a branch is git push <remote> <localbaranchname>:<remotebranchname>
lets look at your current branch: what is the output of git branch ?
Aristide
@laowantong
Nov 30 2014 10:36
ok. But before pushing, I need to make my changes and commit them, right?
Matthias Bussonnier
@Carreau
Nov 30 2014 10:36
Oh, yes, I thought you already did !
Aristide
@laowantong
Nov 30 2014 10:37
I did it in my clone, not in the fork... Not sure this means :-)
macmini-2:ipython aristide$ git branch
* add-ensure_ascii-nb-option
 master
Matthias Bussonnier
@Carreau
Nov 30 2014 10:37
so it's fine.
Aristide
@laowantong
Nov 30 2014 10:37
this is the name I gave to my branch one hour ago
so, my changes are still here
Matthias Bussonnier
@Carreau
Nov 30 2014 10:38
what you can do is git push laowantong add-ensure_ascii-nb-option:add-ensure_ascii-nb-option
It will push your local changes to your fork
Aristide
@laowantong
Nov 30 2014 10:39
ok, I need to authenticate, just a minute (1Password, you know)
Matthias Bussonnier
@Carreau
Nov 30 2014 10:39
see git as working in a triangular manner: You pull/clone a project locally. You make the changes locally. You push the changes to your fork. The original project get your change from a pull-request.
Aristide
@laowantong
Nov 30 2014 10:40
I'm used to subversion, but never used it with other guys though :-(
Matthias Bussonnier
@Carreau
Nov 30 2014 10:40
(to avoid 1password I would set up github with ssh keys at some point in the future :-) )
Aristide
@laowantong
Nov 30 2014 10:40
yes, I thought the GUI app had made this for me!
Matthias Bussonnier
@Carreau
Nov 30 2014 10:41
subversion does not work well in triangular way. That one of the advantage of git.
Aristide
@laowantong
Nov 30 2014 10:41
anyway, your push seems to have worked
Matthias Bussonnier
@Carreau
Nov 30 2014 10:41
Yeah, the gui app does some auth, but not ssh keys. There might be a way to share credential but I'm not sure.
Aristide
@laowantong
Nov 30 2014 10:41
ok, I'll read the docs after our discussion, thanks!
Matthias Bussonnier
@Carreau
Nov 30 2014 10:42
No problem ! You can open a PR now ! I'll guide you on how to get a working patch !
Aristide
@laowantong
Nov 30 2014 10:43
ah? I thought this push was enough to open the pull request
Matthias Bussonnier
@Carreau
Nov 30 2014 10:44
No, you need to get on github page and click on the gree button 'open a pr'
Aristide
@laowantong
Nov 30 2014 10:44
sigh
Matthias Bussonnier
@Carreau
Nov 30 2014 10:44
because you can push super often, have a work in progress, and only propose the PR when you are ready.
Aristide
@laowantong
Nov 30 2014 10:44
ok, makes sense
Matthias Bussonnier
@Carreau
Nov 30 2014 10:44
otherwise we woudl drown under PR :-)
And PR are non destructive, so don't be afraid to open them often and early. You can always undo things, or close. And you can't break anything. And we don't bite :-)
Aristide
@laowantong
Nov 30 2014 10:46
yes, as you can see, I've tried to undo my first tentative, but Git never forgets! :-/
the PR should be created now
Matthias Bussonnier
@Carreau
Nov 30 2014 10:48
Yes it it ! Awesome !
it's a feature that git never forget ! See you on the PR !
Aristide
@laowantong
Nov 30 2014 10:48
I'm an excellent typist, you know ;-)
ok, thanks for your kindness. And thanks for this awesome project too. This year, all my programming 101 students work on IPython Notebook and they love it!
Matthias Bussonnier
@Carreau
Nov 30 2014 10:53
Thanks for your PR !
Matthias Bussonnier
@Carreau
Nov 30 2014 10:59
Side question, do you have assignment as IPython notebook ?
If so have you seen https://github.com/jupyter/nbgrader ?
Aristide
@laowantong
Nov 30 2014 11:01
As a side note, my more important, but rather personal motivation for requesting this feature was related to my programming course. All my course is divided into separated chapters, each one being a notebook. I would like to make my students write a small function they can use to search a certain term in the different chapters, using os.listdir, you know. Obviously, I've not introduced yet JSON or the encoding problems, my students are complete beginners. Then, if the notebooks have escaped characters, I'll need to write a small wrapper for them. Not a difficult requirement, but I would prefer to avoid such a workaround if possible.
no, my assignments are on paper so far
No, never heard of it. Thanks for the tip!
I use extensively the slideshow capabilities of IPython Notebook to make some quizzes, but that's all. The 2D layout feature is very convenient in this usage.
Matthias Bussonnier
@Carreau
Nov 30 2014 11:09
Ok, thanks for the description. You should havea look ad nbgrep : https://gist.github.com/jbarratt/fa1d3473048e5f856aeb
I think there are a few variation of this script.
Aristide
@laowantong
Nov 30 2014 11:11
Ok, didn't know either. Indeed, my goal is to make my students write something like this (in Python).
lunch time, see you later, have a good day
Matthias Bussonnier
@Carreau
Nov 30 2014 11:13
That would be great too ! You could blend it with https://github.com/takluyver/astsearch that use Ast for extensive python searching (see http://takluyver.github.io/posts/astsearch-code-searching-that-knows-about-code.html)
Aristide
@laowantong
Nov 30 2014 11:14
wow
I already use AST in order to "tag" the programs I want to present to my students, i. e., is there a loop, two nested loops, two nested loops with a triangular scheme on the iteration variables, and so on
that's great to find an ordering for the notions to introduce, it's guided by the exercises, sort of
Matthias Bussonnier
@Carreau
Nov 30 2014 11:18
Your student are advanced if you use AST !
Aristide
@laowantong
Nov 30 2014 11:19
No, I use it for me, and give them a magic command, for instance:
%%tags
def find_longest_word(words):
    longest_word_so_far = None
    max_length_so_far = -1
    for word in words:
        if len(word) > max_length_so_far:
            longest_word_so_far = word
            max_length_so_far = len(word)
    return longest_word_so_far
output is:
  2  call/function/len
  1  control_flow/conditional
  1  control_flow/loop/sequential
  1  function_definition
  1  pattern/elements/accumulate
  1  pattern/elements/accumulate/find/best
  1  style/procedural
  1  test/inequality
  1  type/elementary/None
  1  type/elementary/num
  1  variable/assignment/argument
  1  variable/assignment/iteration_variable
  2  variable/assignment/single
  3  variable/scope/local
  1  variable/scope/local/argument
Matthias Bussonnier
@Carreau
Nov 30 2014 11:43
Oh, I see. Nice !
Aristide
@laowantong
Nov 30 2014 12:14
This was my aha moment when I started preparing this course last summer :-)