I am trying to do python documentation generation with Sphinx. The problem is that sphinx-build ends up executing the module/evaluating anything in global scope. Is there a reason it does this? And does anyone know of a flag that can be set to disable this?
It seems like Sphinx is trying to do code-coverage or something equivalent, which is definitely not what I want it doing. Normally this wouldn't be an issue, but a particular set of modules are very specific to an environment.
Sphinx evaluates everything in the global scope because the autodoc plugin imports modules, and importing a module evaluates everything in the global scope.
To stop this, either:

Disable the autodoc plugin (search for autodoc in the sphinx config file), or
Guard the code you don't want executed with something like if __name__ == "__main__": do_stuff()
Prevent Sphinx from executing the module