[IPython-dev] Automatically saving notebooks as scripts has been removed

Erik Bray erik.m.bray at gmail.com
Fri Aug 8 17:55:14 EDT 2014


On Thu, Aug 7, 2014 at 12:02 PM, Brian Granger <ellisonbg at gmail.com> wrote:
> I agree with @minrk that the old `--script` is not something we want
> to bring back and that we should figure out a good way of having that
> particular conversion done in the notebook UI.

Would somebody please be willing to summarize the differences between

nbconvert --to python

and the aforementioned --script option?

I think that the format that is output from the notebook by "Save as
.py..." is very handy to have. And in fact I was just recently singing
its praises as a decent way to go between code in a notebook to an
importable Python module (and perhaps back again?)

So it's definitely a feature that should exist in some form I think.

Erik

> On Wed, Aug 6, 2014 at 2:08 PM, MinRK <benjaminrk at gmail.com> wrote:
>> The main reason it is removed is that nbformat had a notion of ‘save as
>> .py’, which is removed in IPython 3.0 because this functionality has moved
>> to nbconvert in IPython 1.0. We could, of course, let the appropriate
>> nbconvert --to python call be implied by --script instead of the removed
>> Python API, but I don’t think --script was a good idea in the first place.
>>
>> So it’s not a question of whether to use nbconvert or not - you have to use
>> nbconvert to get .py files from .ipynb. It’s just a question of whether you
>> can automatically use nbconvert on save via --script. I think if we want to
>> support this kind of thing, more generic save/rename hooks are better than a
>> single special-case flag.
>>
>> -MinRK
>>
>>
>>
>> On Mon, Aug 4, 2014 at 2:39 PM, Filipe Pires Alvarenga Fernandes
>> <ocefpaf at gmail.com> wrote:
>>>
>>> Got it.  Thanks for looking into this.
>>>
>>>
>>>
>>> On Mon, Aug 4, 2014 at 6:18 PM, Thomas Kluyver <takowl at gmail.com> wrote:
>>>>
>>>> I think we may have been a bit too hasty in getting rid of that. We've
>>>> been talking about it for a while amongst ourselves, because it doesn't fit
>>>> terribly neatly into our infrastructure, but we didn't formally deprecate
>>>> it, and I don't think the alternative approaches are quite as convenient
>>>> yet.
>>>>
>>>> I've put this in the agenda for the dev meeting on Thursday.
>>>>
>>>> Thanks,
>>>> Thomas
>>>>
>>>>
>>>> On 4 August 2014 12:55, Filipe Pires Alvarenga Fernandes
>>>> <ocefpaf at gmail.com> wrote:
>>>>>
>>>>> Hello IPython devs,
>>>>>
>>>>> I was trying the latest github checkout of the IPython source and got
>>>>> the following message:
>>>>>
>>>>> Automatically saving notebooks as scripts has been removed.
>>>>> Use `ipython nbconvert --to python [notebook]` instead.
>>>>>
>>>>> I am wondering why this had to be removed.  Security?
>>>>>
>>>>> I find the automatic script saving very helpful.  My work-group usually
>>>>> commits the `.ipynb` and the `.py` side-by-side to obtain a better diff.  I
>>>>> know that we can workaround this with nbconvert, but doing that manually is
>>>>> error prone, and having a script to do that will add another layer of
>>>>> complexity that we did not have with the automatic conversion.
>>>>>
>>>>> Well, if the automatic conversion had to go I understand, but if there
>>>>> is no reason can you guys consider leaving it there?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> -Filipe
>>>>>
>>>>> _______________________________________________
>>>>> IPython-dev mailing list
>>>>> IPython-dev at scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> IPython-dev mailing list
>>>> IPython-dev at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>>
>>>
>>>
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>
>
>
> --
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> @ellisonbg on Twitter and GitHub
> bgranger at calpoly.edu and ellisonbg at gmail.com
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list