From: edgar@openmail.cc
To: emacs-orgmode@gnu.org
Subject: How to use Org with Python as an IDE?
Date: Sat, 04 Sep 2021 04:58:00 +0000 [thread overview]
Message-ID: <20210904045800.Horde.q8-nbz1dNR2O47UBMvOa7-A@www.vfemail.net> (raw)
Hi!
* Brief
I want to use Emacs to program in Python and combine it with Org. I am
unable to setup Gtags (my first option), Elpy nor Jedi. I would like
to stay away from LSP, but I am willing to heed. What you see [[*What
I have tried][below]] is to show that I really tried.
You should really read this as an Emacs Org file
Why do I write this to the Org community? Because I would like to have
a solution which works with the best way of organising my life (Org
and Org Babel). Thanks!
* What I want
I would like to
- be able to have a way to navigate through code similar to
CEDET/Semantic (some key strokes, and go to the definition of
something, change into appropriate files, go back, etc.).
- find symbols or tags
- get contextual help about the signature of functions and the like
- have code completion from the current project and system's libraries
(it would be nice if I can refer to more than one project)
P.S. https://web.libera.chat/ does not let me connect (Tor not accepted?)
P.S.S. StackOverflow's CloudFlare did not let me register
* What I have tried
** Gtags
** Elpy
I think that the creator of Elpy got completely fed up and left the
project (I could be wrong). The project is now a side-project of
someone else. It used to work, except for some quirks in Org src
buffers.
#+begin_src elisp
;; https://realpython.com/emacs-the-best-python-editor/
;; Install these first: (emacs) epc, deferred, ctable, jedi,
;; company, (python) sexpdata, epc, jedi, black
(use-package elpy
;; :ensure elpy
:defer t ;:defer 1
:init
(advice-add 'python-mode :before 'elpy-enable)
:config
(setq elpy-rpc-python-command "python3"
;; For interactive shell
python-shell-interpreter "python3"
;; Don't use the root of the project, open the shell
;; in current directory
elpy-shell-use-project-root nil)
(defun custom-python-mode-hook ()
(setq python-indent-offset 4)
(setq tab-width 4)
(setq indent-tabs-mode nil))
(add-hook 'python-mode-hook 'custom-python-mode-hook)
(define-key elpy-mode-map (kbd "C-c C-k") 'org-edit-src-abort)
(define-key elpy-mode-map (kbd "C-c K") 'elpy-shell-kill-all))
#+end_src
I don't know if I am supposed to be running a server ouuside Emacs
(Jedi?), but I don't get any completion. Didn't even try to get
documentation on-request. I don't have a virtual environment.
** Jedi alone
I get an error about some =libpython3.7m=
#+begin_src elisp
(require 'jedi)
(jedi:install-server)
#+end_src
#+RESULTS:
#+begin_example
#s(deferred (closure ((callback closure ((it . #0) t) (_) (progn
(set-default 'jedi:server-command (jedi:-env-server-command))))
(callback closure ((it . #0) t) (_) (progn (set-default
'jedi:server-command (jedi:-env-server-command)))) (d . #s(deferred
(closure ((callback . #[128 "\302\300\303\301\x04\"\"\207" [(lambda (msg
output) (message "%s...Done" msg) (if python-environment--verbose
(progn (message output)))) ("Running: pip install --upgrade
~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #8) (d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #4 nil nil)) cl-struct-deferred-tags t)
(x) (condition-case nil (progn (deferred:call-lambda callback x))
(error nil)) x) (closure ((normal closure ((callback . #[128
"\302\300\303\301\x04\"\"\207" [(lambda (msg output) (message "%s...Done"
msg) (if python-environment--verbose (progn (message output))))
("Running: pip install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/")
apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #10) (d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #4 nil nil)) cl-struct-deferred-tags t)
(x) (condition-case nil (progn (deferred:call-lambda callback x))
(error nil)) x) (callback . #[128 "\302\300\303\301\x04\"\"\207" [(lambda
(msg output) (message "%s...Done" msg) (if python-environment--verbose
(progn (message output)))) ("Running: pip install --upgrade
~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #8) (d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #4 nil nil)) cl-struct-deferred-tags t)
(e) (condition-case nil (progn (deferred:call-lambda callback e))
(error nil)) (deferred:resignal e)) deferred:default-cancel #0 nil
nil)) cl-struct-deferred-tags t) (x) (condition-case nil (progn
(deferred:call-lambda callback x)) (error nil)) x) (closure ((normal
closure ((callback closure ((it . #0) t) (_) (progn (set-default
'jedi:server-command (jedi:-env-server-command)))) (callback closure
((it . #0) t) (_) (progn (set-default 'jedi:server-command
(jedi:-env-server-command)))) (d . #s(deferred (closure ((callback .
#[128 "\302\300\303\301\x04\"\"\207" [(lambda (msg output) (message
"%s...Done" msg) (if python-environment--verbose (progn (message
output)))) ("Running: pip install --upgrade
~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #10) (d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #6 nil nil)) cl-struct-deferred-tags t)
(x) (condition-case nil (progn (deferred:call-lambda callback x))
(error nil)) x) (closure ((normal closure ((callback . #[128
"\302\300\303\301\x04\"\"\207" [(lambda (msg output) (message "%s...Done"
msg) (if python-environment--verbose (progn (message output))))
("Running: pip install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/")
apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #12) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #12 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #12) (d . #12) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #12 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #6 nil nil)) cl-struct-deferred-tags t)
(x) (condition-case nil (progn (deferred:call-lambda callback x))
(error nil)) x) (callback . #[128 "\302\300\303\301\x04\"\"\207" [(lambda
(msg output) (message "%s...Done" msg) (if python-environment--verbose
(progn (message output)))) ("Running: pip install --upgrade
~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #10) (d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #6 nil nil)) cl-struct-deferred-tags t)
(e) (condition-case nil (progn (deferred:call-lambda callback e))
(error nil)) (deferred:resignal e)) deferred:default-cancel #0 nil
nil)) cl-struct-deferred-tags t) (x) (condition-case nil (progn
(deferred:call-lambda callback x)) (error nil)) x) (callback closure
((it . #0) t) (_) (progn (set-default 'jedi:server-command
(jedi:-env-server-command)))) (callback closure ((it . #0) t) (_)
(progn (set-default 'jedi:server-command (jedi:-env-server-command))))
(d . #s(deferred (closure ((callback . #[128
"\302\300\303\301\x04\"\"\207" [(lambda (msg output) (message "%s...Done"
msg) (if python-environment--verbose (progn (message output))))
("Running: pip install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/")
apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #8) (d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #4 nil nil)) cl-struct-deferred-tags t)
(x) (condition-case nil (progn (deferred:call-lambda callback x))
(error nil)) x) (closure ((normal closure ((callback . #[128
"\302\300\303\301\x04\"\"\207" [(lambda (msg output) (message "%s...Done"
msg) (if python-environment--verbose (progn (message output))))
("Running: pip install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/")
apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #10) (d . #10) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #10 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #4 nil nil)) cl-struct-deferred-tags t)
(x) (condition-case nil (progn (deferred:call-lambda callback x))
(error nil)) x) (callback . #[128 "\302\300\303\301\x04\"\"\207" [(lambda
(msg output) (message "%s...Done" msg) (if python-environment--verbose
(progn (message output)))) ("Running: pip install --upgrade
~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (callback . #[128 "\302\300\303\301\x04\"\"\207"
[(lambda (msg output) (message "%s...Done" msg) (if
python-environment--verbose (progn (message output)))) ("Running: pip
install --upgrade ~/.emacs.d/elpa/jedi-core-0.2.8/") apply append] 6 "
(fn &rest ARGS2)"]) (d . #s(deferred (closure ((d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (buf) (prog1 (save-current-buffer
(set-buffer buf) (buffer-string)) (kill-buffer buf)))
deferred:default-errorback (closure ((v . #8) (d . #8) (pd .
#s(deferred deferred:default-callback deferred:default-errorback
deferred:default-cancel #8 nil nil)) (args "install" "--upgrade"
"~/.emacs.d/elpa/jedi-core-0.2.8/") (command .
"~/.emacs.d/.python-environments/default/bin/pip") (f . start-process)
cl-struct-deferred-tags t) (_x) (deferred:default-cancel d)
(deferred:default-cancel pd)) #4 nil nil)) cl-struct-deferred-tags t)
(e) (condition-case nil (progn (deferred:call-lambda callback e))
(error nil)) (deferred:resignal e)) deferred:default-cancel #0 nil
nil)) cl-struct-deferred-tags t) (e) (condition-case nil (progn
(deferred:call-lambda callback e)) (error nil)) (deferred:resignal e))
deferred:default-cancel nil nil nil)
#+end_example
Plus this:
#+begin_example
deferred error : (error "Deferred process exited abnormally:
command: /home/edgar/.emacs.d/.python-environments/default/bin/pip
exit status: exit 127
event: exited abnormally with code 127
buffer contents:
\"~/.emacs.d/.python-environments/default/bin/python: error while
loading shared libraries: libpython3.7m.so.1.0: cannot open shared
object file: No such file or directory
#+end_example
-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!
next reply other threads:[~2021-09-04 12:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-04 4:58 edgar [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-04 22:29 Fwd: How to use Org with Python as an IDE? edgar
2021-09-05 1:03 ` edgar
2021-09-06 22:20 ` Dr. Arne Babenhauserheide
2021-09-07 3:37 ` edgar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210904045800.Horde.q8-nbz1dNR2O47UBMvOa7-A@www.vfemail.net \
--to=edgar@openmail.cc \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).