docStrings/PyDoc functionality with Sikuli?

Asked by Simon Pearson

Does Sikuli support some type of inline documentation format like docStrings?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

This is not directly a feature that Sikuli supports with any functionality.

But since you are writing Python code, you can do everything, that is allowed and possible in Python, as long as it is supported by the Jython interpreter.

The Python code as such is accessible through the .py file, that is contained in the .sikuli bundle/folder, so it might be post processed by e.g PyDoc.

Revision history for this message
Simon Pearson (spearson) said :
#2

Thanks for the response.

For completeness:

I was trying to post-process the Sikuli scripts with PyDoc through Python 2.7. Because Python can't read the .jar files it could not import the Sikuli .py files. Creating a local copy of the .jar directories should work, but this would need to be done for each new revision of Sikuli.

I need to use PyDoc through Jython which is able to investigate the .jar files. I have not completed this task, but the post below documents most of the process:

https://answers.launchpad.net/sikuli/+question/188385

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

I just used in a Sikuli script:

import pydoc
pydoc.writedoc("pydoc")

which produced the nice pydoc.html of the pydoc module.

This works for every module found on the sys.path.

So no need to fiddle around with Python and jar's.
Just use the appropriate pydoc functions from inside Sikuli script.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

Since
pydoc.writedoc()

writes to the current directory, it is a good idea to run this script from command line being in a directory, that is writable.

I have not checked in pydoc yet, how to set a different output directory in advance.

Revision history for this message
Simon Pearson (spearson) said :
#5

Thanks RaiMan, that solved my question.