Comments (6)
Available in v0.7.0 now! Please try it.
from jupytext.
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.
@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.
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.
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.
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 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)
- reinstate `:` in valid metadata keys ? HOT 4
- Extension fails to load in ServerApp HOT 1
- Use callback to frontend extension Settings change to add/remove entries to launcher and main menu
- Unable to unpair ipynb in jupyter notebook HOT 7
- Add Galata UI tests for notebook
- Replace toml package with tomli HOT 3
- Panel widget event triggers are not working in py:percent notebooks HOT 2
- Write temporary notebooks to a `TemporaryDirectory` rather than `NamedTemporaryFile`
- feature request: automatic creation of missing notebooks for use after git clone
- Using jupytext in a nested project can result in re-import of the current module HOT 2
- Enable the discussions section for the repository HOT 2
- The Jupytext pre-commit hook fails to install when node is not available HOT 2
- Ability to specify jupytext as the viewer via URL HOT 5
- --sync: avoid updating timestamp of *.py if nothing changes HOT 11
- jupytext-config set-default-viewer failing with a miniconda install on Windows 10 HOT 2
- Convert Jupyter Notebooks with R code cells to ```r code cells
- Automatic code cell detection HOT 3
- Jupytext corrupts original notebook with base64 of pair HOT 1
- Allow to provide the output argument when providing multiple files with --set-formats HOT 1
- indented magic commands block all magic commands HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jupytext.