0

In a package, I define a global variable MyPackage.Data_path in the __init__.py as:

Data_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'database')

This variable is the default argument for multiple functions in my package. When I compile the automatic documentation with Sphinx, the variable is automatically converted into its value (the path string), but I need its name only to be printed in the documentation.

What Sphinx currently prints in the docs:

download_data(data_dir='/mnt/home/UserName/Path/to/data', ...)

What I need Sphinx to print in the docs:

download_data(data_dir=MyPackage.Data_path, ...)

I have tried with :meta hide-value: but it does not work (maybe I didn't use it right). I know the best way should be not to have a similar variable, but it's very complex to change in this moment. I am planning on doing it ASAP.

mzjn
  • 48,958
  • 13
  • 128
  • 248

0 Answers0