top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Python: Doc generation from annotated source code?

+4 votes
277 views

I just started rewritting my project from python 2 to python 3. I noticed that there are these new parameter and return value annotations. I have docstrings everywhere in my project, but I plan to convert many of them into annotations. The question is: what kind of auto documenting system should I use for this? Previously I have used Sphinx. Is it okay to use that for python 3 source code? Is there a better alternative?

posted Nov 18, 2013 by Jai Prakash

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+2 votes

I have started looking into distutils because I need to write an extension module in C (for performance reasons) and distutils seems to be the most straight-forward way.

I have had success building a C file into a Python extension module using "python setup.py build" but I am wondering what the recommended way for using that module during development is. While writing Python code I am used to just run the code from the source directory. But the built extension modules .so of course does not just end up on sys.path magically.

So how do I run my code so it will find the built extension module? Do I pass the output directory on the command line manually or is there some other solution? I would like to still be able to run the code from the source directory as I am using PyCharm to edit and debug the code.

+1 vote

I'd like to have the option to download the source code as text/plain from the docs.python.org pages.

For example: when I'm a docs page, such as:
http://docs.python.org/2/library/string.html

and I click the source code link I'm taken to a Mercurial page:
http://hg.python.org/cpython/file/2.7/Lib/string.py

but over there there's no way to get a clean text/plain version of the code because the line numbers are included.

A link to the text/plain version on that page would be nice!

0 votes

Given string input such as:
foo=5 AND a=6 AND date=now OR date='2013/6' AND bar='hello'

I am going to implement:

  • boolean understanding (which operator takes precendence)
  • spliting off of attributes into my function which computes their table in the SQL database
  • piece everything together into an SQL query

However, it came to me that this is probably a very generic thing; and there might be a library for it.

If that's so, can you recommend it?

0 votes

I stumbled on a problem transforming a standalone Mongo instance to a replicaset. The standalone already had authorization enabled.When I transformed it to a replicaset and started adding the members, it failed.

Googling around, I found that I needed to setup internal authentication with keyfiles for this. But I cant find in the documentation where it says that this is mandatory.I found that enabling internal authentication also enables authorisation, but not the other way around.

Have I found a missing piece in the documentation or is there a piece in the documentation that I have not found yet?

...