I found that I can use decorators to archive partially what I'm looking for.
Using a solution similar to this answer (https://stackoverflow.com/a/2575999/), I can show in Sphinx docs the values instead of the variable names.
def fixdocstring(func):
constants_value = [..., constants.WIDTH, ...]
for i in range(len(constants_name)):
func.__doc__ = func.__doc__.replace("constants."+constants_name[i],str(constants_value[i]))
And use it in the functions that I want to change.
@fixdocstring
def train_network(...)
"""
...
Args:
width (int):
Width of the network from which the images will be processed. Must be a multiple of 32. The default is constants.WIDTH.
"""
In Sphinx docs: Result
Unfortunately, this is not recognized by Intellisense in VSCode.