pwalsh / pipenv.el Goto Github PK
View Code? Open in Web Editor NEWA Pipenv porcelain inside Emacs.
A Pipenv porcelain inside Emacs.
This is currently just a set of functions. What I need, and others too, is delivery as a proper minor mode for python, and integration with projectile and anaconda.
Calling pipenv-activate
will often hang my emacs indefinitely. I started noticing this when I last updated a week or 2 ago.
I believe the problem is a race condition in pipenv--force-wait
, if the process finishes before the sentinel is set then it will never be called.
A reliable way to reproduce this problem is to add a sit-for
at the top of pipenv--force-wait
, so that the process finishes before the sentinel is set. Then the sentinel is never called and we get stuck in the infinite while loop.
Check is Py.Test able to work with pipenv
out of the box (locate pytest
executable).
On Windows,
(pipenv-executable-find "python")
is nil
whereas
(pipenv-executable-find "python.exe")
evaluates to the correct path. Is this intended?
Plus, now it looks like flycheck is working well even when pipenv-with-flycheck
is set to nil
.
I've tested it with Emacs 26.1 both on Ubuntu 18.04 and Windows 10.
There's this package pyvenv
that is basically an Emacs alternative to virtualenvwrapper
with its pyvenv-activate
command and its easier to use pyvenv-workon
counterpart. I wonder if there's benefit in integrating pipenv.el
with pyvenv
or even offloading the activation command completely and use a more established package to do a thing as tricky as path management.
@pwalsh First of all, thank you for plugin.
It would be convenient to set flycheck
python executables automatically (or update PATH for it) to avoid setup it like pipenv run flake8
(which fragile, because depend on current CMD).
Also consider possibility for better projectile
integration.
pipenv-where
– no output, simple:
Finished /Users/netsu/Library/Python/2.7/bin/pipenv --where
in *Messages*.
Maybe, there's needed also something like pipenv-exec
to run commands like scripts, but pipenv-run
use for interactive shell only (not sure, which one it should be, iterm, or so).
I've implemented most of Pipenv's interface, but not all of it.
--envs
--rm
--bare
--completion
--two
--three
--python
open
run
shell
Thank you for this new plugin, progress amazes.
I'm trying to test it a little now.
M-x run-python
apply: Searching for program: No such file or directory, ipython
However, pipenv-run RET ipython
works (not as interactive shell, as may be expected, but it find ipython
at least).
The problem is I got tailing color code like ^[[0m
in the pipenv venv responses.
In the case, it's not going to consider this response as a directory. A quick fix is:
(defun pipenv--clean-response (response)
"Clean up RESPONSE from shell command."
(replace-regexp-in-string "\n�\\[0m$" "" (s-chomp response)))
But maybe there are more color codes need to be deleted. And I don't know how to prevent this happening.
Please, add to Installation
subsection for el-get
Here's recipe (until it not in recipes repository yet):
(:name pipenv
:type github
:pkgname "pwalsh/pipenv.el"
:description "Manage Pythons with Pipenv in Emacs."
:depends (s f))
See pypa/pipenv#2305
pipenv-shell
fails on windows due to:
'exec' is not recognized as an internal or external command,
operable program or batch file.
Relevant line:
Line 70 in b730bb5
With
'(python-shell-interpreter "ipython")
There's error:
eldoc error: (file-error Searching for program No such file or directory ipython)
In *Messages*.
The function f-expand
is called in line 182 of pipenv.el
. This results in the following error message if the f.el
package isn't installed.
pipenv--f-parent: Symbol’s function definition is void: f-expand
It appears this was missed when f.el
was removed as a dependency.
By default, C-c C-p
runs the command run-python
under python mode. It would be better to allow users to define the prefix key by themselves.
Running pipenv-activate
in buffer in pipenv project returns: Searching for program: No such file or directory, pipenv
.
I saw #59 and ran (executable-find "pipenv")
which return nil
.
I ensured the pipenv.el as well as pipenv are installed and that pipenv is on path.
Info:
Thanks
Hi all,
I don't plan on continuing to work on pipenv.el.
The reason for this is that I am not using Pipenv anymore. Using Pipenv has been a pretty frustrating experience for me generally, and while I was excited about the potential for Python packaging, I find the implementation sub par, the dynamics on the Pipenv issue tracker not welcoming, and the original messaging about it implying it was the officially recommended Python packaging tool misleading.
I've simply moved over to pip-tools which solidly works with no weird bugs for my use cases
I'm happy to transfer the repo to anyone interested in maintaining this package going forward.
If I switch projects (C-c p p
) and then select a .py file, I correctly get a buffer with the right environment activated, the right flycheck executable paths, but all checkers disabled. Everything is fine if I open another Python file afterward. I suspect there's a race between when flycheck is enabled and when the executable path is updated, causing the checkers to be disabled on the first buffer.
Is there something that I might have misconfigured, is this expected, or is there something pipenv.el can do to toggle flycheck on/off or re-enable the Python checkers after hooking the executable path?
Shell command calls to pipenv currently run synchronously. This is not fun. For example, running (pipenv-update)
blocks Emacs until it is done, which is a non-trivial length of time even for a couple of dependencies.
shell-command-to-string
asynchronouslyRunning pipenv-activate freezes on windows.
Hi.
First of all, thanks for the effort with pipenv.el.
I work with python and a JS frontend. I have a command in npm that starts the python server on a port. When I use pipenv, I usually run pipenv run npm run start
to execute the server in the virtualenv. I tried to do the same in emacs with pipenv.el and it works, but, I have no simple way to kill or restart the process (and it blocks a port). I had to kill the Pipenv buffer.
Right now I'm using pipenv-shel
l to run npm run start
. I'm not sure if it would be a good idea to add a way to cancel the process running with pipenv-run.
Thanks. I had been expecting a package for pipenv for a couple of months.
Hi, a nice package you have here :)
I didn't find an intended way of installing dev-packages, but from observing the source code I was able to do it this way:
M-x pipenv-install
# it asks then
Which Python packages should be installed (separate with space)?
And then I provide --dev package1 package2 ... packageN
, which works just fine, packages appear in the [dev-packages]
section.
The question is - did you intended to allow this, or it's an accidental side effect of how things are implemented?
If it's intended (or if it's not, but you think it's ok to do it this way) - we should document that it's possible to pass additional args this way.
Cheers!
v10.0.0 is out, and has some improved commands.
pipenv sync
)pipenv --version
)Pythonic is a mature library with a range of utility functions around managing Python processes, setting vars for Python environments, etc.
I have the following in my emacs init file:
(use-package pipenv
:hook (python-mode . pipenv-mode)
:diminish)
Now, I visit the file a.py
in a directory structure:
.:
Pipfile GRTAGS GTAGS GPATH x/
./x:
y/
./x/y:
a.py
and try to do pipenv-activate
. It ends with:
No virtualenv has been created for this project yet!
Process Pipenv exited abnormally with code 1
I have projectile mode enabled. Shouldn't activation happen at project root?
I'm running in a pipenv venv, and I run M-x pipenv-venv
, and I get a message that says Finished pipenv --venv
, but I don't see the result of pipenv --venv
anywhere. What's the right way to use this?
Having originally filed an issue with the spacemacs project, I have been asked to file the same here.
Having activated my pipenv virtualenv (pipenv-activate
), entering live-py-mode
fails to use the active virtualenv.
Eg: Attempting to import a module which is installed in the virtualenv fails.
Note that if I execute a local file (python-execute-file-focus
) the code runs inside my virtualenv, and works as expected
Hi, running a recent develop version of Spacemacs I'm observing the following problem:
After adding this option into python layer
'python-pipenv-activate t'
and opening a python file within properly configured virtualenv everything works as expected and virt. environment gets initialized properly.
When I kill the buffer and reopen the same file I'm not getting into the virt. env and even if I run pipenv-activate manually nothing changes, all I receive is message
pipenv --venv finished File mode specification error: (user-error /home/cqs/.local/bin/pylint is no executable)
When I run flycheck verify setup it cannot find any executable either, even though I have them installed in both, virt. env as well as host system.
Except error I've already mentioned I haven't spotted any suspicious messages.
Any help appreciated. Thanks
I'm running spacemacs on the syl20bnr/spacemacs@0fa3658 of the develop branch. When I run the pipenv-shell
function, it properly launches a shell in the appropriate environment, which I can verify by running pip freeze
and viewing installed libraries.
When I run pipenv-activate
, it doesn't seem like much of anything happens. I do get some output to two buffers:
*Pipenv*
/home/bill/.local/share/virtualenvs/{valid-path-to-my-venv}
Process Pipenv finished
*Messages*
Finished pipenv --venv
My virtual environment's packages are not available to emacs, and running pip freeze
from the editor confirms this. Dropping down to the pyvenv functions does work.
I'd provide more information, but this about the extent of my emacs-lisp debugging experience.
Recently, projectile changed their default prefix to from C-c p
to C-c C-p
i've got a bunch of Pipenv shell buffers and don't know which is which. It would be handy to name them when you create them, like I can do with ^U M-x shell. (I tend to name my shell buffers for the dir I'm in working in to help me remember).
Thanks for pipenv.el.
Hello,
Projectile integration does not work to me. I have to activate pipenv manually. In addition, to activate flycheck integration I have to close the file and reopen it.
Here is my configuration:
;; projectile
;; https://github.com/bbatsov/projectile
(use-package projectile
:delight '(:eval (concat " " (projectile-project-name)))
:defer 1
:init (setq projectile-keymap-prefix (kbd "<menu>"))
:config
(projectile-mode)
(add-to-list 'projectile-project-root-files "platformio.ini")
(setq projectile-completion-system 'ivy
projectile-enable-caching t
projectile-track-known-projects-automatically nil
projectile-files-cache-expire 2592000))
;; flycheck
;; http://www.flycheck.org
;; Dep pylint, clang, tidy, csslint
(use-package flycheck
:defer 1
:bind (:map flycheck-mode-map ("C-c ! !" . hydra-flycheck/body))
:config
(global-flycheck-mode)
(setq-default flycheck-global-modes '(not org-mode)
flycheck-disabled-checkers '(python-flake8))
(defhydra hydra-flycheck
(:pre (progn (setq hydra-lv t) (flycheck-list-errors))
:post (progn (setq hydra-lv nil) (quit-windows-on "*Flycheck errors*"))
:hint nil)
"Errors"
("f" flycheck-error-list-set-filter "Filter")
("n" flycheck-next-error "Next")
("p" flycheck-previous-error "Previous")
("q" nil "Quit")))
;; pipenv.el
;; https://github.com/pwalsh/pipenv.el
;; Dep pipenv
(use-package pipenv
:hook (python-mode . pipenv-mode)
:config
(setq pipenv-projectile-after-switch-function #'pipenv-projectile-after-switch-extended))
See how a ls -la
is printed before the actual command output.
(thesis-W6OBZlR6) [g@x220 thesis]$ ls -la
ls -la
total 156
drwxr-xr-x 10 g g 4096 Jul 18 17:44 .
drwx------ 25 g g 4096 Jul 18 19:41 ..
-rw-r--r-- 1 g g 2226 Jul 14 17:15 attacks.py
drwxr-xr-x 2 g g 4096 Jul 16 12:02 bin
-rw-r--r-- 1 g g 21 Jun 12 02:59 .coveragerc
-rw-r--r-- 1 g g 46 Jun 10 11:51 .coveralls.yml
-rw-r--r-- 1 g g 2330 Jul 15 12:18 datasets.py
-rw-r--r-- 1 g g 533 Jun 15 00:20 Dockerfile
...
Hi, when I'm installing (or uninstalling) packages, pipenv.el bombs minbuffer and *Messages*
buffer with status messages, effectively blocking me from using another M-x
commands for a while (10 seconds easily).
Samples from *Messages*
:
After installing:
Finished pipenv install --dev pylint objgraph [18 times]
Reverting buffer ‘Pipfile’.
Finished pipenv install --dev pylint objgraph [52 times]
Reverting buffer ‘Pipfile’.
Finished pipenv install --dev pylint objgraph [8 times]
After uninstalling:
Finished pipenv uninstall pylint objgraph [2 times]
Reverting buffer ‘Pipfile’.
Finished pipenv uninstall pylint objgraph [5 times]
Reverting buffer ‘Pipfile’.
Finished pipenv uninstall pylint objgraph [2 times]
Hi:
When I enable pipenv, with (add-hook 'python-mode-hook #'pipenv-mode)
. I get
5File mode specification error: (void-function pipenv-mode)
Hit C-c C-c:
6run-hooks: Symbol's function definition is void: pipenv-mode
so I attempted:
(use-package pipenv
:hook (python-mode . pipenv-mode)
:init
(setq
pipenv-projectile-after-switch-function
#'pipenv-projectile-after-switch-extended))
-UU-:----F1 tst.py Top (1,0) (Python Undo-Tree) ----------------------------------------------
1Warning (initialization): An error occurred while loading /home/hoon/.emacs.d/init.el': 2 3Symbol's function definition is void: use-package 4 5To ensure normal operation, you should investigate and remove the 6cause of the error in your initialization file. Start Emacs with 7the
--debug-init' option to view a complete error backtrace.
on:
GNU Emacs 24.5.1
(simulation-RVBo82bs) ~/warehousing$ uname -a
Linux 4.13.0-1019-gcp #23-Ubuntu SMP Thu May 31 16:13:34 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 16.04 on gCloud
I am also using evil mode.
Is there way to get my python C-c C-c back with pipenv.el?
Thank u much,
SHY
Sometimes (pipenv-activate)
hangs. It appears to happen in the (pipenv--force-wait (pipenv-venv))
call. The while loop in pipenv--force-wait
spins forever when it happens but it doesn't always happen. At first it appears that emacs locks up but I can get back control with a C-g
. I put a (message "waiting...")
in that loop and that seemed to fix it or at least caused it to happen less often so it feels kind of like a race condition.
The code is currently a spike solution for my needs. Before it is inflicted on others, there needs to be reasonable test coverage, and CI.
Missing pyvenv depency gives the following error on loading pipenv-mode :
File mode specification error: (file-missing Cannot open load file No such file or directory pyvenv)
Problem: Calling M-x pipenv-activate
in a buffer in a valid pipenv project fails to configure anything. Eval-ing (pipenv-venv)
in that same buffer results in the process exiting with code 1, and reporting
'No virtualenv has been created for this project yet!'
Emacs: 26.0.90
OS: macOS 10.13.4
pipenv: 11.10.1
Some responses from Pipenv are chunks of text proper (e.g.: (pipenv-graph)
). How they display depends on where you call from (e.g.: responses are currently nice in eshell
, not so nice in ielm
). Fix display for reasonable cases.
Emacs 27.2
pipenv, version 2021.5.29 installed via pip
Python 3.9.6 on Fedora 34
Config:
(use-package pipenv
:hook (python-mode . pipenv-mode)
:init
(setq
pipenv-projectile-after-switch-function
#'pipenv-projectile-after-switch-extended))
Whenever I enter a python file or activate pipenv-mode I get:
Cannot open load file: No such file or directory, pipenv
Pipenv is executable from the cli and is on my shell PATH.
Check is RealGud able to find several python debuggers like ipdb
in pipenv
path.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.