Browse Source

python: don't leak local __init__.py variables to python introspection.

Causes pybind11-stubgen (and probably other tools as well) to include
`i` in the output, which feels dirty.
next
Vladimír Vondruš 2 years ago
parent
commit
7e9acb06f2
  1. 4
      src/python/corrade/__init__.py.in
  2. 4
      src/python/magnum/__init__.py

4
src/python/corrade/__init__.py.in

@ -60,6 +60,10 @@ import sys
for i in ['containers', 'pluginmanager', 'utility']:
if i in globals(): sys.modules['corrade.' + i] = globals()[i]
# Just to not have the variable leak into stubs generated by pybind11-stubgen
# TODO any way to exclude it?
del i
# Prevent all submodules being pulled in when saying `from corrade import *` --
# this is consistent with behavior in magnum
__all__ = [

4
src/python/magnum/__init__.py

@ -52,6 +52,10 @@ if 'scenegraph' in globals():
for i in ['matrix', 'trs']:
sys.modules['magnum.scenegraph.' + i] = getattr(scenegraph, i)
# Just to not have the variable leak into stubs generated by pybind11-stubgen
# TODO any way to exclude it?
del i
__all__ = [
'Deg', 'Rad',

Loading…
Cancel
Save