Git Product home page Git Product logo

pydoc's People

Contributors

0fiscalentropy avatar anrddh avatar dantlev01 avatar djr7c4 avatar jgarte avatar jkitchin avatar jonmoore avatar kyleam avatar ninzine avatar patxoca avatar purcell avatar statmobile avatar syohex avatar tarsius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pydoc's Issues

Support enviroment with Python 3 only

In a system with only Python3 installed, the python command is not provided. This may result in a command not found: python issue. I think it is better to concatenate pydoc-command for the two lines

pydoc/pydoc.el

Line 463 in 1dfbab7

(read (shell-command-to-string "python -c \"import sys; print('({})'.format(' '.join(['\"{}\"'.format(x) for x in sys.builtin_module_names])))\""))))

pydoc/pydoc.el

Line 494 in 1dfbab7

(read (shell-command-to-string "python -c \"import pkgutil; print('({})'.format(' '.join(['\"{}\"'.format(x[1]) for x in pkgutil.iter_modules()])))\""))))

On Windows, trying to run "pydoc" as a program does not work

On Windows, pydoc-browse suffers from non-availability of a "pydoc" executable, as here. Elsewhere pydoc uses pydoc-command instead of "pydoc" and that may be better here too.

Also, "-b" is not a recognized argument for pydoc in Python 2.

I will try to submit a fix.

Overall, thanks for a very useful project.

AttributeError: 'Evaluator' object has no attribute 'modules'

When I run pydoc-at-point, in buffer *pydoc* it reports:
Traceback (most recent call last):
File "/var/folders/3h/s9r7m0xn1s5gp0s8_jrjnv6h0000gn/T/py-504JjY", line 17, in
script_modules = gd[0]._evaluator.modules
AttributeError: 'Evaluator' object has no attribute 'modules'

In modeline, it show error message:
Invalid regexp: "Unmatched [ or [^"

My python script is:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import threading

def fun1():
    pass

if __name__ == '__main__':
    t1 = threading.Thread(target=fun1)
    t1.start()

My cursor is under threading keyword in line 10.

My system env:

$ python --version
Python 3.6.5
$ uname
Darwin

Use pydoc also for pydoc-at-point, instead of jedi?

Let me begin by thanking the authors and maintainers of this package for such a useful tool. What follows is just a comment/question that I have concerning the way in which the documentation is gathered when using pydoc-at-point, and possibly a suggestion to improve it.

I don't know if this is due to my installation (and configuration) but, for instance, when using pydoc-at-point for the matplotlib.pyplot.plot function, I get a docstring that is different (much sparser, just one line) from the one I get if I do pydoc "matplotlib.pyplot.plot". Does anyone else get this behavior? It's also worth noting that I do get the same docstrings for functions inside NumPy and SciPy, for instance.

Reading the code, I see that it uses Jedi to get the docstrings when invoking pydoc-at-point, whereas for the rest it uses pydoc (the command line tool). Could it be possible to reduce the use of Jedi in the code just for getting the inference of the full name of the function at point, and then pass that to pydoc? I guess doing that would lead to a more consistent output throughout the package, as using (pydoc "matplotlib.pyplot.plot") would be (literally) the same as using pydoc-at-point over the plot part.

Probably the use of Jedi to get the docstring (instead of using pydoc as I suggest above) for pydoc-at-point has its advantages and was therefore a conscious design choice (for reasons I fail to see as I'm a noob in `elisp), in which case I apologize for the noise.

Thanks for reading!

Escaped characters break pydoc-at-point

For example, in the file


import functools as ft
s.find('\n') == -1:
whitespace = '\n'

def f(f):
@ft.wraps(f)


when the cursor is over the '.' following the '@ft' when one runs pydoc-at-point, the pydoc buffer shown contains a backtrace instead of useful information.

I have found that this problem is caused by the escaped newlines (i.e., '\n's). I have found a fix and will submit a pull request shortly.

Weird behaviour of 'q' key binding

It seems a bit weird that pydoc asks for a buffer when hitting the q key within the pydoc buffer.

May be you could consider using bury-buffer or quit-window instead of kill-buffer.

Not working with pip 10.0.0

M-x pydoc fails

Debugger entered--Lisp error: (wrong-type-argument sequencep Traceback)
  mapcar(symbol-name Traceback)
  (if (executable-find "pip") (mapcar 'symbol-name (read (shell-command-to-string "python -c \"import pip; mods = sorted([i.key for i in pip.get_installed_distributions()]); print('({})'.format(' '.join(['\"{}\"'.format(x) for x in mods])))  \""))) (message "pip not found. No user-installed modules found.") 'nil)
  pydoc-user-modules()
  (append (pydoc-topics) (pydoc-keywords) (pydoc-builtin-modules) (pydoc-user-modules) (pydoc-pkg-modules))
  (sort (append (pydoc-topics) (pydoc-keywords) (pydoc-builtin-modules) (pydoc-user-modules) (pydoc-pkg-modules)) 'string<)
  (setq *pydoc-all-modules* (sort (append (pydoc-topics) (pydoc-keywords) (pydoc-builtin-modules) (pydoc-user-modules) (pydoc-pkg-modules)) 'string<))
  (if (and (not reload) *pydoc-all-modules*) *pydoc-all-modules* (setq *pydoc-all-modules* (sort (append (pydoc-topics) (pydoc-keywords) (pydoc-builtin-modules) (pydoc-user-modules) (pydoc-pkg-modules)) 'string<)))
  pydoc-all-modules(nil)
  (completing-read "Name of function or module: " (pydoc-all-modules current-prefix-arg))
  (list (completing-read "Name of function or module: " (pydoc-all-modules current-prefix-arg)))
  call-interactively(pydoc record nil)
  command-execute(pydoc record)
  helm-M-x(nil "pydoc")
  funcall-interactively(helm-M-x nil "pydoc")
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

it is because pip 10 no longer provides get_installed_distributions

bash-4.4$ python -m pip --version
pip 10.0.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

bash-4.4$ python -c "import pip; mods = sorted([i.key for i in pip.get_installed_distributions()]); print('({})'.format(' '.join(['"{}"'.format(x) for x in mods])))  "
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'pip' has no attribute 'get_installed_distributions'

bash-4.4$

the following change fixes the issue for me, but I guess it should require a relatively new version of pip.

diff --git a/pydoc.el b/pydoc.el
index 467487e..3651971 100644
--- a/pydoc.el
+++ b/pydoc.el
@@ -466,10 +466,10 @@ Adapted from `help-make-xrefs'."
   "Return a list of strings for user-installed modules."
   (if (executable-find "pip")
       (mapcar
-       'symbol-name
-       (read
-	(shell-command-to-string
-	 "python -c \"import pip; mods = sorted([i.key for i in pip.get_installed_distributions()]); print('({})'.format(' '.join(['\"{}\"'.format(x) for x in mods])))  \"")))
+       (lambda (alist)
+         (alist-get 'name alist))
+       (json-read-from-string
+        (shell-command-to-string "pip list --format=json")))
     (message "pip not found. No user-installed modules found.")
     '()))

pydoc-at-point not working with jedi 0.17+

I have jedi 0.17.2 installed and when I call pydoc-at-point I get the following output. (point was at UUID function):

/tmp/py-KvISWP:2: DeprecationWarning: Providing the line is now done in the functions themselves like `Script(...).complete(line, column)`
  s = jedi.Script("""from uuid import UUID
/tmp/py-KvISWP:2: DeprecationWarning: Providing the column is now done in the functions themselves like `Script(...).complete(line, column)`
  s = jedi.Script("""from uuid import UUID
/tmp/py-KvISWP:81: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).infer instead.
  gd = s.goto_definitions()
Traceback (most recent call last):
  File "/tmp/py-KvISWP", line 89, in <module>
    script_modules = list(gd[0]._evaluator.module_cache.iterate_modules_with_names())
AttributeError: 'Name' object has no attribute '_evaluator'

New release?

Hi are there any plans to make a new release?

The last release is from 2016.

Unsupported use of pip.get_installed_modules()

See pypa/pip#5243. pip.get_installed_modules() is used in the function pydoc-user-modules at pydoc.el:466. As detailed in the link, the correct way to access this functionality is to use pkg_resources instead of pip and then access pkg_resources.working_set. If I have time I'll make a pull request soon.

Tag for Melpa-Stable

Hello and thank you for your wonderful package!

I would love to use your package, but I don't want to include MELPA into my package list. I would be delighted if you could upload your package to MELPA-stable. This is usually as easy as tagging your code with the current version number.

Thank you very much!

pydoc-user-modules: Wrong type argument: sequencep, Traceback

Versions:

  • GNU Emacs 24.5.1 (i586-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-08 on x86-csail-01, modified by Debian
  • pydoc 20160403.1733 from Melpa, installed from list-packages

When I run M-x pydoc and hit enter, I immediately get this error message:

pydoc-user-modules: Wrong type argument: sequencep, Traceback

I am not prompted for the python module/function name.

I have determined that this happened because I did not have pip installed globally, I tend to use pip exclusively in virtualenvs.

Is it implicit that one's emacs must be virtualenv-aware to use this? Or would it be a good idea to specify in the readme that a pip needs to be accessible, either globally or through virtualenv-awareness in emacs?

dash dependency

pydoc uses some functionality from dash but does not require it.

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.