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

Dashboard sorting #5153

Merged
merged 5 commits into from Mar 3, 2014
Merged

Dashboard sorting #5153

merged 5 commits into from Mar 3, 2014

Conversation

takluyver
Copy link
Member

Possibly ordering should be done by the frontend, but we're already relying on the order from the API to get index.ipynb and directory names before other things.

@takluyver
Copy link
Member Author

Removed the attempt at locale-aware sorting for now - the locale.strxfrm() function is bytes only on Python 2, and dealing with that properly seems like more trouble than it's worth.

@ivanov
Copy link
Member

ivanov commented Feb 19, 2014

in #5152 @minrk also suggested hiding directories that start with a ., do you disagree with that?

Personally, I think it's weird to hide directories that start with an underscore - some people rename files/directories to have a leading _ as a way to ensure they are listed first. But if we're going to hide those directories, we should also hide directories that start with a dot.

Hiding __pycache__ and only __pycache__ makes more sense to me - it is the least surprising behavior.

@minrk
Copy link
Member

minrk commented Feb 19, 2014

If special casing __pycache__ makes more sense to other people, I have no problem with that. It's better for people to see some uninteresting dirs listed than not see interesting ones.

@takluyver
Copy link
Member Author

I believe the existing logic hides folders that begin with a dot. I did add
a test for that.

No strong feelings on whether to hide everything with a leading underscore
or special case pycache.

@@ -175,13 +178,14 @@ def list_dirs(self, path):
dirs = []
for name in dir_names:
os_path = self.get_os_path(name, path)
if os.path.isdir(os_path) and not is_hidden(os_path, self.notebook_dir):
if os.path.isdir(os_path) and not is_hidden(os_path, self.notebook_dir)\
and not name.startswith('_'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other calls to is_hidden where we probably want to add the _ test as well:

  • I think a few other places in filenbmanager.py
  • /IPython/html/base/handlers.py L263
  • ./IPython/html/tree/handlers.py L65

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was deliberately leaving other locations so that _ directories were hidden from the list but still accessible (like _private attributes in Python), while we outright ban access to . directories like .ssh. I'm happy to reconsider that, though.

What do you feel about hiding all _ prefixed directories vs. special casing __pycache__?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I lean toward special-casing __pycache__ at this point.

@takluyver
Copy link
Member Author

After discussion with @minrk , we're back to special casing __pycache__, but there's now a configurable list of glob patterns to hide directories and files from the dashboard listing, in common with what many editors implement. The implementation is deliberately simple, but a more complex implementation could have better performance.

Our hiding of .hidden directories is still hardcoded, because we prevent access to them even if you could see them.

@richardeverson
Copy link
Contributor

It would be really useful to list notebooks and directories in reverse order of modification, so that one can easily navigate to recently used notebooks. Modifying the sort_key function easily achieves this, but changing the javascript etc to allow switching between alphabetic and modification time views is more complicated than I've time for now and has layout implications for the dashboard. An imperfect halfway house would be to configure the sort key from ipython_notebook_config.py.

@ivanov
Copy link
Member

ivanov commented Mar 2, 2014

We plan to have more sophisticated sorting in the dashboard in
IPython 3.0

minrk added a commit that referenced this pull request Mar 3, 2014
@minrk minrk merged commit 0da2644 into ipython:master Mar 3, 2014
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants