Skip to content
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

Bad case with .ipynb and proposal for .jnb extensions files as new type standard #6977

Closed
7 tasks
ManPython opened this issue Jul 22, 2023 · 2 comments
Closed
7 tasks
Labels
enhancement status:Needs Triage Applied to issues that need triage

Comments

@ManPython
Copy link

ManPython commented Jul 22, 2023

Problem

  • I'm always frustrated when opening .ipynb because it's .json style, etc. eg.:
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from ipyleaflet import Map, WMSLayer, SearchControl, Marker, AwesomeIcon ,ScaleControl, FullScreenControl, basemaps\n",
  • I would like it if code be in standard .py files with option to import other, etc. coz can be more easy to operate and lighter, current files are often big

Proposed Solution

  • Proposal to solve is to do this in way in old style as:
  1. Normal python code
cells = [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": []
}
from ipyleaflet import Map, WMSLayer, SearchControl, Marker, AwesomeIcon ,ScaleControl, FullScreenControl, basemaps
  1. Morec onfiguration, stil can be ass json array
config = [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "1968473cdaee46cbb4dda2f214759397",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
  1. New option can be as .jnb not .ipynb to differentiate solutions for Jupyter
  2. We can more easy convert nomal python code to jupyter then and vice versa
  3. Jupyter/Lab can conver old style .ipynb to .jnb or .inb

Additional context

  • Another solution can be as:
cells = [
 {
  "cell_type": "code",
  "execution_count": 11,
  "metadata": {},
  "outputs": [],
  "source": [],
 "widgets": [] # more vars to control jupyter
}
from ipyleaflet import Map, WMSLayer, SearchControl, Marker, AwesomeIcon ,ScaleControl, FullScreenControl, basemaps
  • The configs can be allways up or down (depend options)*
 "metadata": {
  "interpreter": {
   "hash": "3456435634b5y34g3tj295ht8h4v83h45v87yh438h5y384vh58y38h458"
  },
  "kernelspec": {
   "display_name": "Python 3.8.5 64-bit (system)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

** But the important is to have normal python cone without quotes..**

What about asign code to the cel?
Wel.. decorator can be for this above comment..

@jupyter_cell = 1
# This program prints Hello, world!

print('Hello, world!')
@cell = 1
# Python Program to find the area of triangle

a = 5
b = 6
c = 7
@cell = 2
# Uncomment below to take inputs from the user
# a = float(input('Enter first side: '))
# b = float(input('Enter second side: '))
# c = float(input('Enter third side: '))


@cell = 3 # note about 2 lines enter, it's mind next cell and not need decorator @cell 
# calculate the semi-perimeter
s = (a + b + c) / 2

@cell = 4
# calculate the area
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is %0.2f' %area)

or with comment as philosophy, that if no decorator as @cell or @jupyter_cell then code is still in this same cell

# @cell = 4
# calculate the area
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is %0.2f' %area)

Soo.. all is about to move config json to object and steering this data by class/objects.
In some configs user can call decaorator to operate around by object eg.

test_object  = {"@cell" : "4"} #kill or reset, execute cyclical etc.

The decorator is not really required, eg. convention can be that 2 lines betwen rows mind that is opened next cell
Is some var are reserved for jupyter then decorator can be above as @jupyter or @ipynb to proxing var as free to solve conflicts.

Forward to community that evolution is coming ; )

Tasks

@ManPython ManPython added enhancement status:Needs Triage Applied to issues that need triage labels Jul 22, 2023
@jtpio
Copy link
Member

jtpio commented Jul 25, 2023

Thanks @ManPython for opening the issue.

Since this issue is more about the Notebook format and not necessarily related to the Notebook user interface, maybe the discussion could be moved to a different place so it gets more visibility from other folks working with notebooks?

For example this issue in the Jupyter Enhancement Proposal repo might be relevant: jupyter/enhancement-proposals#102

@JasonWeill
Copy link
Collaborator

Per @jtpio, this would be better submitted as a Jupyter Enhancement Proposal, either as a new JEP or as a comment to an existing JEP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement status:Needs Triage Applied to issues that need triage
Projects
None yet
Development

No branches or pull requests

3 participants