Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sort (sorting) order of files in notebook list

How can I change the sort order of files in the notebook list? I would like it to be alphabetical for all file types and not case sensitive. Directories can appear before files or within the files.

Currently my list is sorted as follows: - Directories (starting with upper case) - directories (starting with lower case) - IPython notebooks (starting with upper case) - ipython noteooks (starting with lower case) - Other files (starting with upper case) - other files (staring with lower case)

I'm using Jupyter 3.0.0-f75fda4

like image 876
user2599816 Avatar asked Oct 19 '22 08:10

user2599816


2 Answers

just as an addition to the previous post:

edit ..\Anaconda\Lib\site-packages\notebook\static\tree\js\notebooklist.js for instance to sort last modified first:

this.sort_function = modified_sorter(0); // inserted
this.sort_id = 'last-modified';          // inserted
this.sort_direction = 0;                 // inserted
//this.sort_function = name_sorter(1);
// 0 => descending, 1 => ascending
//this.sort_id = 'sort-name';
//this.sort_direction = 1;

You will have to make the same changes to main.min.js in the same directory. Naturally, with every update of jupyter notebook this will be lost. Also, no guarantees as this is a quick and dirty fix.

EDIT: in case you have already created a virtual env make sure to do the same for ..\Anaconda\envs<venv>..

like image 151
GrimTrigger Avatar answered Oct 22 '22 20:10

GrimTrigger


If you are handy with jQuery, you can edit IPython's static files and customize the "tree" page you are referring to.

On my Ubuntu machine I could manipulate the page by editing the file /usr/local/lib/python2.7/dist-packages/IPython/html/static/tree/js/notebooklist.js

like image 37
nivix zixer Avatar answered Oct 22 '22 22:10

nivix zixer