Referencing python source code¶
If you want to add source code description to your page, you can use the following syntax.¶
my_project.two_numbers.TwoNumbers
dataclass
¶
Example class that adds two numbers.
Source code in src/my_project/two_numbers.py
add()
¶
Add two numbers together.
Examples:
Returns:
| Type | Description |
|---|---|
int
|
The sum of the two numbers. |
Note
This function only supports integers.
You can put title here.
- Add support for floats.
- Add support for strings.
Source code in src/my_project/two_numbers.py
If you want to include all submodules, you can use the following syntax.¶
two_numbers
¶
TwoNumbers
dataclass
¶
Example class that adds two numbers.
Source code in src/my_project/two_numbers.py
add()
¶
Add two numbers together.
Examples:
Returns:
| Type | Description |
|---|---|
int
|
The sum of the two numbers. |
Note
This function only supports integers.
You can put title here.
- Add support for floats.
- Add support for strings.
Source code in src/my_project/two_numbers.py
If you want to show only the source code, you can use the following syntax.¶
::: my_project.two_numbers.TwoNumbers
options:
show_docstring_attributes: false
show_docstring_functions: false
show_docstring_classes: false
show_docstring_modules: false
show_docstring_description: false
show_docstring_examples: false
show_docstring_other_parameters: false
show_docstring_parameters: false
show_docstring_raises: false
show_docstring_receives: false
show_docstring_returns: false
show_docstring_warns: false
show_docstring_yields: false
members: false
show_bases: false
show_source: true
Source code in src/my_project/two_numbers.py
See mkdocstrings for more about the options.
If you want to change the heading level in the table of contents, you can use the # as in markdown.¶
### ::: my_project.two_numbers.TwoNumbers
options:
show_docstring_description: false
show_docstring_examples: false
members: false
show_bases: false
show_source: true