Expand for other commands ?
olymk2 opened this issue · 8 comments
I really like pythonic and the way it works well with continers and virtual env's.
I was curious if it could be easily expended to run other commands like pytest but automatically using the configured setup, ie make it a bit more generic would this be quite simple ?
I may give this a try if its not possible and I can find some time, or is this outside the scope of the project ?
Hi,
Maybe it's enough to write a wrapper function which calls start-pythonic with -m pytest?
Happy new year!
Great I will have a play with it and see if it is that simple and report back.
And Happy New year to you and thanks for an awesome library for emacs :)
Well that does seem to work using this snippet to test the display is not 100% correct yet.
(setq python-shell-interpreter "/usr/local/bin/python")
(set-process-sentinel
(pythonic-start-process :process "pytest" :buffer "*pytest*" :args (list "-m" "pytest"))
(lambda (p _m)
(when (eq 0 (process-exit-status p))
(with-current-buffer (process-buffer p)
(ansi-color-apply-on-region (point-min) (point-max))))))
Not sure if there is a way to handle the below normally that line is updated in place, if thats not possible new lining it may be better than its current display, alternatively curious if using a compilation buffer maybe better need to figure that out and give it a try.
^Mcollecting 0 items ^Mcollecting 1 items ^Mcollecting 2 items
:sentinel can be set using keywords. I'm sure you want :filter instead. See djangonaut run command for actual example.
Spot on cheers I just copied this function as is and pyt pytest in and removed :cwd.
https://github.com/proofit404/djangonaut/blob/master/djangonaut.el#L824
It even seems to resolve the file I am currently on which is a very nice unexpected feature, Will have to add run at point to that at some point as well :)
Thanks for the pointers got around to building a basic library if your Interested the link is below, I will close this issue for you.
https://gitlab.com/emacs-open-source-library-collection/pythonic-test
One issue I have noticed is if you stop and start your containers pythonic does not detect the new container presumably because it has a reference to the old id not sure if that would be easy to fix.
I have an idea how to fix it, just doesn't have time.
I want to rework pythonic-activate to be able not just set virtual environment directory, but read the directory structure.
If it contains docker-compose.yml ask for the container name.
If it contains Vagrantfile calculate virtual machine address.
If it contains tox.ini ask for the tox environment.
If it contains pyproject.toml with poetry.tool calculate virtual environment location.
This way we will ask docker-compose for container name before each run. Should not affect long-running processes like anaconda-mode.
All sounds good I can appreciate that time is what we all lack :)
If there are simple things to improve the docker integration I can try and find some time, I mainly work in containers or native the other tools I am not using so not as easy to test and work with.