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
create a ipynbv3 json schema and a validator #2396
Conversation
I added a quick implementation off json-references, so that you could references other part of the json file, the validation seem to work :
and should be refined. Here is a test example, where I require
and indeed, some code cell have an empty prompt number. Thought ? |
When I wrote the python code to create the various notebook parts, I tried to not assume that various elements would always be present as much as possible. If we move to a schema (I like the idea) we might want to revisit that code to make sure that notebooks created using that Python code have all the right elements. |
Well, we can put element as not required, this is not a problem. I would just like to have a nice descriptive of what the ipynb format is, even if for now it only gives warning for non conform instances. I wrote that to be able to validate some test I made to generate notebook, and it can make a solid base to discuss the notebook format or make it evolve. Especially if we do cell by cell syncing, it would be great to be sure the format is always consistent. We could also validate the messaging api with schema also. I still have to take a look ad wether there is a way to validate value and not only keys and structures. |
Again, I really like the idea of having a validator. For example, the On Sun, Sep 9, 2012 at 1:01 PM, Bussonnier Matthias <
Brian E. Granger |
That's seem fine with me. |
So, here we go. biggest changes are :
result of
One thing that could be added is to require name for worksheets. |
Put dependencies in external with licences. Thought ? |
@@ -0,0 +1,222 @@ | |||
# -*- coding: utf-8 -*- |
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.
Why is this not in externals?
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.
Because mv != git mv
?
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.
will fix it tomorrow.
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.
Not following you, why is mv
relevant?
On Tue, Oct 2, 2012 at 2:00 PM, Bussonnier Matthias <
notifications@github.com> wrote:
In IPython/nbformat/v3/jsonpointer.py:
@@ -0,0 +1,222 @@
+# -- coding: utf-8 --Because mv != git mv ?
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/2396/files#r1743857.
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com
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.
Just to say that I moved it to external and git add
it (so it's duplicated and I should remove this one).
I should have make a git mv
which would have told git not to track this particular file.
@Carreau what else do you think needs discussion on this. Did you have a chance to look through the nbformat and decide which attributes can be null? |
I don't saw anything obvious, and I don't want to spend too much time on this as draft4 should come out "soon". I also have to study if we can validate further (like check if instance of sting ends with |
removed |
cf http://json-schema.org/ http://tools.ietf.org/html/draft-zyp-json-schema-03 autogenerated from http://www.jsonschema.net/index.html# then tweeked. This version makes all our notedooks in docs/example/notebooks valid
removed |
prompt number type was number or string ('*', ' ') require it to be either number, or null
removed |
Did the updated draft come out? What do you think we should do with this PR? It would be great to get it merged, but I am not quite sure what else needs to be done/answered. |
well, I so that draft 4 was due "soon" but I didn't looked at what "soon" was meaning between draft 2 and 3... So i'll look at why it is failing on travis and after we can merge. |
hum... travis build passes, but github say 'merge with caution'...why ? |
@Carreau I would like to merge this soon, but I see one issue. The command line script will be buried deep in the IPython package, so no one will know it is there and few will ever run it. Do you think it would make sense to create a top level subcommand/application so users could do:
|
Also, the top level |
Short from my phone. The problems are that: I would suggest a 3 step approach.
How does that sound?
|
Matthias, On Thu, Jan 10, 2013 at 12:20 AM, Bussonnier Matthias <
Sounds good. I think the first step would be to write a top -level Cheers, Brian
Brian E. Granger |
Almost nothing, some not converted to v3
It make sens as it can't really now what you ment. Assuming you have a cell that have only 'input' and 'level' attribute,
I would personally merge as is. All or Nothing is already quite good. We can build custom test as we feel the need. Let still wait until monday so I have some time to look at it again and see if I can upgrade (if needed) the embeded version of the lib I use. If I don't I can still upgrade this later. |
Matthias, On Thu, Jan 10, 2013 at 11:22 AM, Bussonnier Matthias <
OK I understand, probably the best we can do it to just return True or
OK I am fine with merging as is, but I will let you have a look and do the
Brian E. Granger |
@Carreau did you get a chance to look at this? |
Not quite with all the PR around. |
Ok I will merge and create an issue. On Mon, Jan 14, 2013 at 10:49 AM, Bussonnier Matthias <
Brian E. Granger |
Merging this. I have created an issue #2786 to track further work. Thanks for the code! |
create a ipynbv3 json schema and a validator
create a ipynbv3 json schema and a validator
Json Schema is a draft ment to describe the structure of a Json format.
It could be used to validate which file are valid ipynb files.
This is a first draft a ipynb schema and validator, mostly auto generated.
There are still things that could be added, like 'cell level' is 'optional' but could be added as 'required only if cell is of type heading', or added description.
IIUC, one could even create it's own subtype like codecell/markdowncell and reference it to have more fine grained validation.
cf http://json-schema.org/
http://tools.ietf.org/html/draft-zyp-json-schema-03
schema is autogenerated from
http://www.jsonschema.net/index.html#
Then tweeked a little