create account

QueryJane | Python code Autodoc configuration - Documented Account module. by kit.andres

View this thread on: hive.blogpeakd.comecency.com
· @kit.andres ·
$32.30
QueryJane | Python code Autodoc configuration - Documented Account module.
Repository
[https://github.com/roadhousestudio/queryjane_app](https://github.com/roadhousestudio/queryjane_app)

QueryJane is a web application developed with Django that allows to connect with companies and experts in different sectors of the cannabis industry. Beta version is available here.

<center>
![Screen Shot 2018-06-04 at 10.46.34 PM.png](https://cdn.steemitimages.com/DQmQGs71ZPHUVMe2hLQtoXG52WcjptAq3kRW6HcpjRYG2kZ/Screen%20Shot%202018-06-04%20at%2010.46.34%20PM.png)
</center>

#### Details

I have been working to activate the [Sphinx autodoc module](http://www.sphinx-doc.org/es/stable/ext/autodoc.html). This allows to include in our project documentation the docstrings include in our python code. In this way, we can add documentation to our Python modules and pull it in our final official documentation in a semi-automatic way.

Take a look to the correct way to add docstring to our Python code:

<center>
![Screen Shot 2018-06-22 at 10.27.24 PM.png](https://cdn.steemitimages.com/DQmQfR4Ye48Eqq58VhDRrW7VHg3civGTvN6moVF2MJxAEug/Screen%20Shot%202018-06-22%20at%2010.27.24%20PM.png)
</center>

In this way, Sphinx will recognize the added docstrings and will include them in the generated documentation.

I will show you how to indicate to Sphinx that a documented file must be included. Per example, if we want to include to docstrings from the [account.models.py](https://github.com/augustakingfoundation/queryjane_app/blob/master/account/models.py) file, we must add the following code into the .rst files:

<center>
![Screen Shot 2018-06-22 at 10.35.14 PM.png](https://cdn.steemitimages.com/DQmNf7udbkgrhXgqsnnqFh6yqzmdcGTtTrru5LZxbDvvwe8/Screen%20Shot%202018-06-22%20at%2010.35.14%20PM.png)
</center>

In this way, we are telling to Sphinx that must include all the members of the *account/models.py* module into the final documentation. Also, we are including all the inherited members and we are including the inheritance path. To goal of include the  inheritance documentation, is that in most cases the classes and functions that we are generation have some type of inheritance, and many times we want to override these  inherited members. Include this in the documentation allow us to find the members structure in a easy way, without having to go look in the Django repository.

In this documentation update, I have documented the [account](https://github.com/augustakingfoundation/queryjane_app/tree/master/account) app Python files. [This](https://github.com/augustakingfoundation/queryjane_app/tree/master/docs/source/code_documentation) is the detailed structure of the new documentation module, in which I'm adding all Python files of this module.

To include docstrings from Python files, we must add some lines to the [conf.py](https://github.com/augustakingfoundation/queryjane_app/blob/master/docs/source/conf.py) file. really, and because I'm new using Sphinx, find the correct lines to include the docstring from the Python files in the correct way took me a long time. These are the necessary Sphinx configuration to include docstrings from Python files in a Django project.

``import os``
``import sys``
``sys.path.insert(0, os.path.abspath('../../')) # Path the the project root from the current file location``

``os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')``

``# Setup Django``
``import django``
``django.setup()``

It takes a lot of time to me and, after a lot of failed attempts, I have created [this question](https://stackoverflow.com/questions/50879154/cant-generate-autodoc-using-sphinx-in-my-django-project)  in Stackoverflow. Somebody give me the solution and for this reason I was able to create the new documentation module.

#### Components
The new documented parts are all the classes and functions defined in the Python files in the [account app](https://github.com/augustakingfoundation/queryjane_app/tree/master/account).

#### Difference
The impact is that now the defined classes and functions can be easily found, including their inherited members. Per now, I'm including only the Python files of one specific module, but the necessary settings to run Sphinx autodoc in the project in a correct way has been configured and it will allows to document the other modules very fast.

#### Links

New documentation module is available in the following url:

[http://docs.queryjane.net/code_documentation.html](http://docs.queryjane.net/code_documentation.html)

Documentation homepage:

[http://docs.queryjane.net/](http://docs.queryjane.net/)

#### GitHub Proof of Authorship
- [https://github.com/aaquirogal](https://github.com/aaquirogal)

[This update includes PRs From 103 to 114](https://github.com/augustakingfoundation/queryjane_app/pulls?utf8=%E2%9C%93&q=), but many of these PRs are about some fixes, typo bugs and changes to testing the correct configuration. The following list shows the most relevant PRs.

[103](https://github.com/augustakingfoundation/queryjane_app/pull/103/files)
[104](https://github.com/augustakingfoundation/queryjane_app/pull/104/files)
[109](https://github.com/augustakingfoundation/queryjane_app/pull/109/files)
[113](https://github.com/augustakingfoundation/queryjane_app/pull/113/files)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 160 others
properties (23)
authorkit.andres
permlinkqueryjane-or-python-code-autodoc-configuration-documented-account-module
categoryutopian-io
json_metadata{"tags":["utopian-io","documentation","sphinx","industry","cannabis"],"image":["https://cdn.steemitimages.com/DQmQGs71ZPHUVMe2hLQtoXG52WcjptAq3kRW6HcpjRYG2kZ/Screen%20Shot%202018-06-04%20at%2010.46.34%20PM.png","https://cdn.steemitimages.com/DQmQfR4Ye48Eqq58VhDRrW7VHg3civGTvN6moVF2MJxAEug/Screen%20Shot%202018-06-22%20at%2010.27.24%20PM.png","https://cdn.steemitimages.com/DQmNf7udbkgrhXgqsnnqFh6yqzmdcGTtTrru5LZxbDvvwe8/Screen%20Shot%202018-06-22%20at%2010.35.14%20PM.png"],"links":["https://github.com/roadhousestudio/queryjane_app","http://www.sphinx-doc.org/es/stable/ext/autodoc.html","https://github.com/augustakingfoundation/queryjane_app/blob/master/account/models.py","https://github.com/augustakingfoundation/queryjane_app/tree/master/account","https://github.com/augustakingfoundation/queryjane_app/tree/master/docs/source/code_documentation","https://github.com/augustakingfoundation/queryjane_app/blob/master/docs/source/conf.py","https://stackoverflow.com/questions/50879154/cant-generate-autodoc-using-sphinx-in-my-django-project","http://docs.queryjane.net/code_documentation.html","http://docs.queryjane.net/","https://github.com/aaquirogal","https://github.com/augustakingfoundation/queryjane_app/pulls?utf8=%E2%9C%93&q=","https://github.com/augustakingfoundation/queryjane_app/pull/103/files","https://github.com/augustakingfoundation/queryjane_app/pull/104/files","https://github.com/augustakingfoundation/queryjane_app/pull/109/files","https://github.com/augustakingfoundation/queryjane_app/pull/113/files"],"app":"steemit/0.1","format":"markdown"}
created2018-06-23 04:15:00
last_update2018-06-23 04:15:00
depth0
children5
last_payout2018-06-30 04:15:00
cashout_time1969-12-31 23:59:59
total_payout_value24.781 HBD
curator_payout_value7.523 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,209
author_reputation31,454,326,251,184
root_title"QueryJane | Python code Autodoc configuration - Documented Account module."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id61,859,296
net_rshares16,275,902,577,018
author_curate_reward""
vote details (224)
@a-a-a ·
Please Upvote➜https://steemit.com/christianity/@bible.com/verse-of-the-day-revelation-21-8-niv
properties (22)
authora-a-a
permlinkre-kitandres-queryjane-or-python-code-autodoc-configuration-documented-account-module-20180623t041531053z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://steemit.com/christianity/@bible.com/verse-of-the-day-revelation-21-8-niv"],"app":"steemit/0.1"}
created2018-06-23 04:15:42
last_update2018-06-23 04:15:42
depth1
children0
last_payout2018-06-30 04:15:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length94
author_reputation-3,087,833,994,273
root_title"QueryJane | Python code Autodoc configuration - Documented Account module."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id61,859,353
net_rshares0
@ms10398 ·
Good Work with the documentation of the project.

I really think the documentation part can be impoved a lot more.

Good Luck for it. 

Thanks!

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/4/3221123).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
properties (22)
authorms10398
permlinkre-kitandres-queryjane-or-python-code-autodoc-configuration-documented-account-module-20180626t003237980z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/4/3221123","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-06-26 00:32:39
last_update2018-06-26 00:32:39
depth1
children0
last_payout2018-07-03 00:32:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length634
author_reputation27,572,487,973,390
root_title"QueryJane | Python code Autodoc configuration - Documented Account module."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,269,384
net_rshares0
@pdtrain ·
$0.50
cool code, will have to check it out, cannabis and code a good combination
👍  ,
properties (23)
authorpdtrain
permlinkre-kitandres-queryjane-or-python-code-autodoc-configuration-documented-account-module-20180626t215338531z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-06-26 21:53:39
last_update2018-06-26 21:53:39
depth1
children0
last_payout2018-07-03 21:53:39
cashout_time1969-12-31 23:59:59
total_payout_value0.456 HBD
curator_payout_value0.039 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length74
author_reputation2,875,601,193,957
root_title"QueryJane | Python code Autodoc configuration - Documented Account module."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,401,755
net_rshares201,624,350,840
author_curate_reward""
vote details (2)
@trufflepig ·
**Congratulations!** Your post has been selected as a daily Steemit truffle! It is listed on **rank 11** of all contributions awarded today. You can find the [TOP DAILY TRUFFLE PICKS HERE.](https://steemit.com/@trufflepig/daily-truffle-picks-2018-06-23) 
    
I upvoted your contribution because to my mind your post is at least **18 SBD** worth and should receive **37 votes**. It's now up to the lovely Steemit community to make this come true.

I am `TrufflePig`, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, [you can find an explanation here!](https://steemit.com/steemit/@trufflepig/weekly-truffle-updates-2018-24)
    
Have a nice day and sincerely yours,
![trufflepig](https://raw.githubusercontent.com/SmokinCaterpillar/TrufflePig/master/img/trufflepig17_small.png)
*`TrufflePig`*
    
properties (22)
authortrufflepig
permlinkre-queryjane-or-python-code-autodoc-configuration-documented-account-module-20180623t161833
categoryutopian-io
json_metadata""
created2018-06-23 16:18:33
last_update2018-06-23 16:18:33
depth1
children0
last_payout2018-06-30 16:18:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length884
author_reputation21,266,577,867,113
root_title"QueryJane | Python code Autodoc configuration - Documented Account module."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id61,930,719
net_rshares0
@utopian-io ·
Hey @kit.andres
**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-queryjane-or-python-code-autodoc-configuration-documented-account-module-20180626t003509z
categoryutopian-io
json_metadata"{"app": "beem/0.19.29"}"
created2018-06-26 00:35:09
last_update2018-06-26 00:35:09
depth1
children0
last_payout2018-07-03 00:35:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length302
author_reputation152,955,367,999,756
root_title"QueryJane | Python code Autodoc configuration - Documented Account module."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id62,269,544
net_rshares0