0

I use the sphinx_autodoc_typehints extension for my python project.

In my project, I have a few dependencies to other packages like my_base_package.

[setup.py]

setup(
  install_requires=[
    "my_base_package @ git+ssh://xxxxxx"
  ]
)

Is it possible that sphinx can display / link to classes, interfaces and exceptions from "my_base_package" in the documentation of my project?

Perhaps an example illustrates my concerns a little better. For example in my "my_base_package" I added a module that can create a logger.

[my_base_package]
def create_logger() -> Logger

In my project which depends from "my_base_package", I want to create a logger. Therefore I use the module in my_base_package.

[my_project]
import my_base_package.logger    

def setup():
  logger = my_base_package.create_logger()

def log(logger: Logger) -> None
  """Log

  :param logger: logger to log
  """
  logger.log_something() 

Creating the documentation, sphinx shows the parameter type for logger, but it is not linked to the implementation in my_base_package. Is this possible?

My current setup for the documentation for this file is:

 .. automodule:: my_project.logger
   :members:
mzjn
  • 48,958
  • 13
  • 128
  • 248
user5580578
  • 1,134
  • 1
  • 12
  • 28
  • Do you have `.. automodule:: my_base_package` anywhere in your project? – mzjn May 11 '20 at 04:16
  • No I do not have any reference to my "my_base_package" in the documentation. Could you show me a small example? Do I have to reference the site-packages path to my_base_package? – user5580578 May 11 '20 at 15:29
  • If there is no documentation for `my_base_package`, then there is nothing to link to. – mzjn May 11 '20 at 15:33
  • It is not possible to add just the interfaces from my_base_package to the documentation of my parent_package? Its only possible when both packages have a sphinx documentation which is running on a server? And for that case I should use the extension "intersphinx"? – user5580578 May 11 '20 at 15:37
  • Yes, intersphinx could be a way to solve this. The other way I can think of is to include my_base_package in your project instead of having it as an external dependency. – mzjn May 11 '20 at 15:43
  • my_base_package is used in a few packages. Therefore including it in my package is not desireable. – user5580578 May 11 '20 at 17:54

0 Answers0