Hi Martin - 

I've also experienced this kind of tedium.  Depending on the type of extension 
it is, you could also consider writing tests for your function that can be run 
by either:

a) importing PyMOL commands into a python (.py) script and running e.g. 
`nosetests` or other unit testing software

```extension_tests.pml
import pymol
from pymol import cmd
pymol.finish_launching()
...do stuff here...
```

or,

b) run PyMOL (.pml) scripts in command line only mode.

For example, I've used approach (b) before with a setup something like this:

```test1.pml
from pymol import cmd
frag ala
python
if 'ala' in cmd.get_names(): 
   print 'OK'
else: 
   print 'Not OK'
python end
```

Then run each test from the shell:

```
pymol -cq test1.pml
```

For running many tests automatically, I've also used a "run_tests.sh" that 
looks something like this:

```run_tests.sh
#!/bin/bash
function run_test() {
 PML="test${1}.pml"
 if [ -f "$PML" ]; then
   echo ""
   echo 
"################################################################################"
   echo "Running Test ${1}: $PML"
   echo ""
   pymol -ckq $PML
   echo ""
 fi
}

# call `./run_tests.sh` with no args to run all the tests (up to 100)
if [ $# -lt 1 ]; then
 for i in {1..100}  # increase if you have more than 100 tests
 do
   run_test $i
 done

# call with args, e.g. `./run_tests.sh 1 2 4 7` to run specific test(s)
else
 for i in $@
 do
   run_test $i
 done
fi 
```

Hope this is helpful.  Good luck!

Cheers,
Jared




> On Apr 25, 2016, at 11:06 AM, Thomas Holder <thomas.hol...@schrodinger.com> 
> wrote:
> 
> Hi Martin,
> 
> how about:
> 
> set_key F1, run script.py; function_from_script()
> 
> Reduces step 3) and 4) to hitting "F1" on the keyboard.
> 
> Cheers,
> Thomas
> 
> On 24 Apr 2016, at 06:36, Martin Hediger <ma....@bluewin.ch> wrote:
> 
>> Hi all
>> 
>> When working on a PyMOL extension script, my workflow is currently something 
>> like this:
>> 
>> 1) Start PyMOL
>> 2) Work on script
>> 3) PyMOL> run script.py
>> 4) PyMOL> function_from_script()
>> 5) See if function works, go back to 2)
>> 
>> Is it possible to have PyMOL automatically re-run the script everytime i 
>> save it?
>> 
>> Thanks and best regards
>> Martin
>> 
>> -- 
>> Martin R. Hediger, PhD
>> Mittlere Strasse 65
>> 4056 Basel
> 
> -- 
> Thomas Holder
> PyMOL Principal Developer
> Schrödinger, Inc.
> 
> 
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to