Question

Environment preamble:

I write Python code in Vim for Maya on Linux. I'm using nose for test discovery and execution, and I'm using its attribute plugin to decorate Maya-only test classes. I have mappings in Vim to run the non-Maya tests in regular Python, and the Maya tests through Maya's mayapy executable, which gives me access to the scene, and the maya.cmds module.

Actual problem:

mayapy takes 6 seconds to start up every time I hit my in-Maya tests Vim mapping. It gets really tedious. The non-Maya tests happen as fast as I can hit their mapping. It's helped me abstract more away from Maya, to avoid that tiny, all-day pain, but I'd still like it gone. 6 seconds starts to feel like a long time. There are tricks for working asynchronously in Vim, but I don't like to move ahead without seeing if my tests passed. I've asked Autodesk (makers of Maya), and they say there's no way around the startup time.

Question:

What I think I want is to fire up mayapy in the background, and then when I hit my Vim mapping, have it connect to the waiting Python instance and call the nose.run() command. I feel like mkfifo is the way to go, but I'm unsure of the particulars. How can I do this (through mkfifo or otherwise)?

Was it helpful?

Solution

I am assuming mayapy is like a repl and you can hit commands on to it like the mentioned nose.run(). If that is the case, I would recommend using the vim plugin tslime which allows you to be able to send stuff from a vim buffer to another tmux pane / window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top