Coder Social home page Coder Social logo

Comments (6)

mwouts avatar mwouts commented on May 23, 2024 1

Available in v0.7.0 now! Please try it.

from jupytext.

mwouts avatar mwouts commented on May 23, 2024 1

Well, yes. You should add a least a second cell... this is briefly documented in the next README. Let me explain a bit more...

When no format information is given, jupytext classifies percent scripts as such if they contain at least two explicit cells. What's happening here is that jupytext opens your script as a standard Python script, using the light format.

Note that if you generate the percent script using Jupytext, a YAML header with an explicit information on the file format will be added, and Jupyter will open it with the right format.

from jupytext.

mwouts avatar mwouts commented on May 23, 2024 1

@danieltomasz , thanks for your example. I just changed the format parser to make sure your example will open as a 'percent' script. The identification of spyder scripts now requires just one cell in the script, that's a simpler criterion!

from jupytext.

mwouts avatar mwouts commented on May 23, 2024

This is implemented in the latest release candidate for Jupytext! Install the rc with

pip install jupytext==0.7.0rc0

Corresponding documentation is the v0.7.0 branch. Please comment here if it works, if it doesn't, if that's easy to use or not...

from jupytext.

mwouts avatar mwouts commented on May 23, 2024

Following suggestions by the Spyder team, I will change the cell header to

# %% Optional text [cell type] {optional JSON metadata}

with cell type either absent (code), or [markdown], or [raw].

from jupytext.

danieltomasz avatar danieltomasz commented on May 23, 2024

The code from spyder


#%%
def func1(x):
    # implement func1 (see the example function in chapter 1)
    if type(x) is list:
        x = [(i-1)**2 for i in x]
    if type(x) is tuple:
        x= (x-1)**2
    return x

def der_func1(x):
    # the derivative of func1
    if type(x) is list:
        x = [2*(i-1) for i in x]
    if type(x) is tuple:
        x= 2*(x-1)
  
    return x

is rendered as
2018-10-4-15-46-04

Is it supossed behaviour? (two cells rather than one, + visible percent signs)

Another thing: Maybe is good to have an exemple of percent cells in the demo?

from jupytext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.