Giter Club home page Giter Club logo

Comments (10)

mbrukman avatar mbrukman commented on June 20, 2024

@wangtz — this is an interesting question, because *.ipynb files are actually JSON files, so including a comment-style preamble as we do for other files will not work, because then it would no longer be valid JSON, since JSON disallows anything outside of { ... } top-level object).

So how would you expect us to embed a license into it? Do you have any sample *.ipynb files we can take a look at to see what the typical standard is for these files?

Maybe the metadata section would be a reasonable place to put it, perhaps with the license key?

Or maybe since it's JSON, we should follow the Node.js package style for specifying licenses? Though I think including the full license text is, in general, preferred by lawyers, so maybe we could have a license key with SPDX identifier, and license_txt for the full contents of the license?

What do you think?

from autogen.

wangtz avatar wangtz commented on June 20, 2024

.ipynb file represents a series of Python code blocks. I'm suggesting to add license on top of the first code block so that it's visible to users. I don't think normal users would look into the JSON source code.

from autogen.

mbrukman avatar mbrukman commented on June 20, 2024

@wangtz — what do you think of this?

from autogen.

wangtz avatar wangtz commented on June 20, 2024

Looks good. Thanks. :-)

I see that you added a text block instead of code block for these comments. I'm fine with either.

from autogen.

mbrukman avatar mbrukman commented on June 20, 2024

@wangtz — I tried adding just a code block with those comments earlier, but it didn't work, but that was probably because I didn't have the right metadata at the end of the file, though. Just changed it to use code and metadata, and now it appears to work. Take another look?

from autogen.

wangtz avatar wangtz commented on June 20, 2024

Eh. I didn't find any related commit. Most recent one is adding .bat support. Do you mean a pull request?

from autogen.

mbrukman avatar mbrukman commented on June 20, 2024

@wangtz -- it's in a branch on this repository; you can see the preview using the same links as above (I modified a sample file in-place). If you want to see what it looks like in practice, see the ipynb-support in this repo, it's not a PR yet as I'm still iterating on it.

from autogen.

wangtz avatar wangtz commented on June 20, 2024

Ah I see. I had a quick look at your ipynb.py but didn't quite understand the logic. Are you replacing the metadata section when a header is added.

I thought the metadata section is provided by the users (e.g. they may not be using PYthon3), and all we need to in this case is to prepend an element in cells.source.

What do you think?

from autogen.

mbrukman avatar mbrukman commented on June 20, 2024

@wangtz — without the metadata section, the notebook didn't load in the tools I tried it in, it just failed, so it wasn't usable. How would a user get to a usable state if the boilerplate we generate (without the metadata section) is insufficient to load into a notebook viewer?

I presume the metadata should be modifiable by users after the notebook is loaded.

Here's my sample file:
https://github.com/mbrukman/autogen/blob/ipynb-support/tests/testdata/sample.ipynb

Do you want to try it out with your notebook environment, and then delete the metadata section and see if it still loads for you?

from autogen.

mbrukman avatar mbrukman commented on June 20, 2024

I've merged #66 to add support for Jupyter notebooks.

from autogen.

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.