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

Control commands spawned by pipenv-run #15

Open
jsandovalc opened this issue Feb 18, 2018 · 8 comments
Open

Control commands spawned by pipenv-run #15

jsandovalc opened this issue Feb 18, 2018 · 8 comments
Assignees
Milestone

Comments

@jsandovalc
Copy link

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-shell 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.

@pwalsh pwalsh added the bug label Feb 18, 2018
@pwalsh pwalsh added this to the Current milestone Feb 18, 2018
@pwalsh
Copy link
Owner

pwalsh commented Feb 18, 2018

@jsandovalc thanks for the report.

I guess we could pipe pipenv-run commands into a pipenv-shell buffer (including creating it if it does not yet exist). That would be a slightly more automated way to do what you are now doing as a workaround.

Some better solutions might be:

  1. To give a dedicated buffer to any command run by pipenv-run
  2. To give info to the user via *Pipenv* about any running pipenv-run processes, and a way to manage these processes (i.e.: kill them).

Thoughts on what would work for your use case?

@pwalsh pwalsh self-assigned this Feb 18, 2018
@jsandovalc
Copy link
Author

I think both proposed solutions would work well for my workflow. But, I feel that pipenv run would be better off creating a dedicated buffer for this kind of command. Maybe in this buffer I could do things like g to restart (kill and run again) the command. I could eventually wrap it to create something similar to the elpy-django-runserver function but for my particular use case.

Thanks again :) I feel this project has a lot of potential because emacs needs a good pipenv integration.

@pwalsh
Copy link
Owner

pwalsh commented Feb 18, 2018

@jsandovalc great, thanks for the feedback.

My general thinking was to iterate on *Pipenv* towards a UI for pipenv.el, instead of just a log of command outputs as it is now. That fits well with the idea of killing and restarting commands etc., and is I think more manageable then a buffer per pipenv-run command, in the long run.

However, I'm not about to do that work anytime soon, so, I think the best solution for users as a next step will be to generate a new buffer for each pipenv-run command, and have keybindings for start (if stopped), stop (kill), and restart.

I'm not sure when I will get to this, but I will certainly try to look at it in the coming weeks, and of course, I'd definitely be happy for a PR from you or anyone that implements something similar.

@pwalsh pwalsh changed the title Stopping pipenv-run Control commands spawned by pipenv-run Feb 18, 2018
@jsandovalc
Copy link
Author

I understand. The UI on Pipenv sounds really interesting. Would it be something similar to the magit UI?

My elisp knowledge is very shallow to implement changes for pipenv.el fast. I'm not even even sure how to setup an environment to develop an elisp extension. But it's something I've wanted to learn. I've only created some small functions in my setup for some simple things in my workflow. But I really want to integrate pipenv with emacs, so, this could be the motivation.

@pwalsh
Copy link
Owner

pwalsh commented Feb 20, 2018

The UI on Pipenv sounds really interesting. Would it be something similar to the magit UI?

Yes. Less complex, but yes.

My elisp knowledge is very shallow ...

So was mine before pipenv.el ;). Happy to help you with setup if you want to help out. Hacking on this and Emacs in general has been really fun for me! In any event, I'll update this issue before I start any work on this directly myself, so we (and others) can be in sync.

@jsandovalc
Copy link
Author

Maybe it's a silly question, but I have doubts about how to develop an emacs extension I'm currently using. Should I disable it and import it from the github repo or maybe should I use a second clean instance of emacs for running the developing lib?.

Anyway, the first thing I'll try to do is run the tests.

Thanks!

@pwalsh
Copy link
Owner

pwalsh commented Feb 23, 2018

@jsandovalc not at all! It is one of those "easy, once you know how" things.

First, clone the pipenv.el repo:

cd ~/Code
git clone https://github.com/pwalsh/pipenv.el.git

If you use use-package, then adjust it to use :load-path. For example:

(use-package pipenv
  :demand t
  :ensure nil
  :load-path "~/Code/pipenv.el"
  :hook python-mode)

If you don't use use-package, then remove your normal way of loading pipenv.el, and then add this to your init file:

(load "~/Code/pipenv.el")

Also, see the tasks you can run in the Makefile, and look at the CI configuration for their use.

@pwalsh
Copy link
Owner

pwalsh commented Dec 6, 2018

#45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants