Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to document global variables #46

Closed
KyleKing opened this issue Mar 28, 2019 · 2 comments

Comments

2 participants
@KyleKing
Copy link
Contributor

commented Mar 28, 2019

For example, in a definitions.py file, I might have:

"""Definitions: Create Global Reference Variables."""

import math
from pathlib import Path

# Base directory path
PTH_PROJ = Path.home() / 'Program Files (x86)/FooBar'

# Some Dictionary
COUNT_MAP = {
    'one': 1,
    'eleven': 11,
    'septendecillion': math.pow(10, 54),
}

Is there a way to show these public global variables (PTH_PROJ and COUNT_MAP) in the generated pdoc documentation?

@kernc kernc added the question label Mar 28, 2019

@kernc

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2019

Yes, you can document public variables by using PEP 224-proposed docstrings for variables, i.e. string literal directly following variable assignment:

PTH_PROJ = Path.home()
"""Base directory path"""

COUNT_MAP = {}
"""Some dictionary"""

@kernc kernc closed this Mar 28, 2019

@kernc kernc changed the title Dispaly Global Variables in pdoc How to document global variables Mar 29, 2019

@KyleKing

This comment has been minimized.

Copy link
Contributor Author

commented Mar 29, 2019

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.