← Back to team overview

yade-users team mailing list archive

Re: Python documentation : yade-epydoc

 

> I'd like to really learn python. So here is a first main question, 
> following by other less important :
> 
> - I tried to run yade-epydoc.py, but it did not work :
> 
> jduriez@c1solimara-l:~/YADE/bin$ ./yade-trunk 
> /home/3S-LAB/jduriez/yade/doc/yade-epydoc.py
> ...BLABLABLA....
> Running script /home/3S-LAB/jduriez/yade/doc/yade-epydoc.py
> Traceback (most recent call last):
>   File "./yade-trunk", line 112, in <module>
>     execfile(args[0])
>   File "/home/3S-LAB/jduriez/yade/doc/yade-epydoc.py", line 13, in <module>
>     from epydoc.cli import cli
> ImportError: No module named epydoc.cli

You need to install python-epydoc package. But I doubt the script will
really generate docs, as we moved away from epydoc to sphinx. Everything
that is in epydoc (with some minro differences) is in sphinx as well.
(there is still older https://www.yade-dem.org/epydoc/ and current
https://www.yade-dem.org/sphinx/)

> - Is there in Yade documentation already a "real reference" for python ? 
> I saw in https://www.yade-dem.org/sphinx/basics.html#creating-simulation 
> this phrase about python "Since this topic is more involved, it is 
> explained elsewhere FIXME", but I could not find anything. This is 
> probably linked with the "FIXME", but I wanted to be sure. (there is 
> here obviously no offense, I love this growing documentation !)

If you need documentation for python itself, then go to
http://doc.python.org. For yade, there is not yet some good manual on
creating simulations, though you can gather something from reading
scripts in scripts/test (most of them create a mini-simulation to be
run). Stay tuned, I am working on this.

> - I saw that I can have help in the python shell of yade itself by 
> typing "?" at the end of the python command I want to discover. So just 
> a remark about what I read in utils.sphere? : some example lines let 
> appear a function sphere(...) which gives me an error when I try this 
> ("name 'sphere' is not defined")

That documentation is what you find at
https://www.yade-dem.org/sphinx/yade.utils.html#yade.utils.sphere as
well.

For function sphere: it is really the utils.sphere function, but it
depends how you import it. If you do

  from yade.utils import *

then you will have all utils' functions in the current scope (sphere,
box, PWaveTimeStep, ...). If you do

  for yade import utils

instead (which is done automatically I believe), then you will have
utils.sphere, utils.box, utils.PWaveTimeStep.

Good point, though, I will fix the docstring to use utils.sphere, to
make it clear.

Cheers, Vaclav




Follow ups

References