##// END OF EJS Templates
Merge pull request #648 from takluyver/usermod...
Merge pull request #648 from takluyver/usermod Clean up handling of global namespaces with the proper semantics. A global namespace should always be tied to a module: pickle accesses classes via the module in which they're defined. So I've changed the arguments for instantiating an InteractiveShell to include `user_module` in place of `user_global_ns`. The global namespace simply becomes a reference to `user_module.__dict__`. For instantiating InteractiveShell, there are four possibilities: * Neither `user_ns` nor `user_module` is given. A new (real) module is created named `__main__`, and its `__dict__` becomes the global and local namespace. This is what happens when starting IPython normally. * Only `user_module` is given. Its `__dict__` becomes the global and local namespace. * Both `user_ns` and `user_module` are given. `user_module.__dict__` is the global namespace, and `user_ns` is the local namespace. Note that we can't interactively define closures over variables in the local namespace (this seems to be a limitation of Python). * Only `user_ns` is given. It is treated as the global and local namespace, and a `DummyMod` object is created to refer to it. This is intended as a convenience, especially for the test suite. The recommended way to pass in a single global namespace is as a reference to the module. `embed()` digs out the locals and the module from the frame in which it's called. Closes gh-29, closes gh-693.

File last commit:

r4900:30b93ed6
r5467:a1e4911b merge
Show More
setup3.py
21 lines | 655 B | text/x-python | PythonLexer
import os.path
from setuptools import setup
from setuptools.command.build_py import build_py
from setupbase import (setup_args,
find_scripts,
find_packages,
find_package_data,
record_commit_info,
)
setup_args['entry_points'] = find_scripts(True, suffix='3')
setup_args['packages'] = find_packages()
setup_args['package_data'] = find_package_data()
setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
def main():
setup(use_2to3 = True, **setup_args)
if __name__ == "__main__":
main()