Skip to content

Cannot complete namespace packages (was Where did %rehash go?) #8875

Open

Description

@anntzer

Either %rehash was mistakenly removed, or the doc of %rehashx

In [9]: %rehashx?
Docstring:
Update the alias table with all executable files in $PATH.

This version explicitly checks that every entry in $PATH is a file
with execute access (os.X_OK), so it is much slower than %rehash.

Under Windows, it checks executability as a match against a
'|'-separated string of extensions, stored in the IPython config
variable win_exec_ext.  This defaults to 'exe|com|bat'.

This function also resets the root module cache of module completer,
used on slow filesystems.
File:      /usr/lib/python3.5/site-packages/IPython/core/magics/osm.py

In [10]: %rehash?
Object `%rehash` not found.

As a side note I noticed this when I realized that import mpl_ would not complete mpl_toolkits and tried to %rehash my cache; I still don't know how to get this to complete properly.

Activity

  1. added this to the 4.1 milestone on Oct 7, 2015
  2. minrk commented on Oct 7, 2015

    @minrk
    Member

    Wow, that's an out-of-date docstring. The last version with %rehash was 0.10 about five years ago. %rehashx is all that we have now. Does it not clear your module completer cache?

  3. anntzer commented on Oct 7, 2015

    @anntzer
    ContributorAuthor

    At least I still can't complete import mpl_ into import mpl_toolkits.

  4. minrk commented on Oct 9, 2015

    @minrk
    Member

    Hm. What's your Python, IPython and OS version? And what do you get for get_ipython().db.get('rootmodules_cache')? It only caches imports when it takes a long time to compute them, otherwise it computes them on the fly.

  5. jenshnielsen commented on Oct 9, 2015

    @jenshnielsen
    Contributor

    Could it be related to mpl_toolkits being a namespace package? Something that we (mpl developers that is) should perhaps change in the future due to other issues.

  6. minrk commented on Oct 9, 2015

    @minrk
    Member

    @jenshnielsen yes, it's possible, however I do find mpl_toolkits in my import completions, so I'm trying to figure out what is different between the two environments.

  7. anntzer commented on Oct 9, 2015

    @anntzer
    ContributorAuthor

    Arch Linux standard packages, on a clean (new) profile.

    Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
    IPython 4.0.0 -- An enhanced Interactive Python.
    

    get_ipython().db.get('rootmodules_cache') returns None.

  8. jenshnielsen commented on Oct 9, 2015

    @jenshnielsen
    Contributor

    @minrk I can reproduce the issue on OSX 10.11 with my pip installed dev ca .1.5.rc2 version of matplotlib but not in a Conda env on the same machine. Not sure what the difference is

  9. minrk commented on Oct 10, 2015

    @minrk
    Member

    @jenshnielsen thanks for narrowing it down. It may have something to do with namespace packages.

  10. added a commit that references this issue on Jan 19, 2016
  11. changed the title [-]Where did %rehash go?[/-] [+]Cannot complete namespace packages (was Where did %rehash go?)[/+] on Jan 19, 2016
  12. modified the milestones: 5.0, 4.1 on Jan 19, 2016
  13. Carreau commented on Jan 19, 2016

    @Carreau
    Member

    Rename to reflect remaining issue about completion of namespace packages.
    And bump to 5.0

  14. takluyver commented on Jan 19, 2016

    @takluyver
    Member

    If on Python 3 it's a PEP 420 namespace package, I don't think there's any simple way to identify it as a package for tab completion. The normal indicator of a package is that it contains an __init__.py file, and PEP 420 namespace packages don't have that. I don't think we should assume any directory could be a namespace package.

  15. Carreau commented on May 18, 2016

    @Carreau
    Member

    Bumping to 6.0 as there are few change we can actually so've it for 5.0 if we don't know the reason.

  16. modified the milestones: 6.0, 5.0 on May 18, 2016
  17. Carreau commented on Feb 9, 2017

    @Carreau
    Member

    Fixed by #10182 (Reintegrate Jedi), Jedi is able to find this and tell it's a module.

    screen shot 2017-02-09 at 13 04 47

    --jedi/ipython-- is just a visual delimiter between the 2 sources of completions.

    Closing, feel free to reopen if it's still failing on master for you.

  18. anntzer commented on Aug 19, 2017

    @anntzer
    ContributorAuthor

    This is still failing for me as of 6.1.0 and as of master (just pulled). Could the issue be reopened? Thanks.

  19. takluyver commented on Aug 21, 2017

    @takluyver
    Member

    Jupytercon starts tomorrow, so it may be a while before @Carreau can investigate.

  20. modified the milestones: 6.0, 6.2 on Aug 21, 2017
  21. modified the milestones: 6.2, wishlist on Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions