Show More
@@ -60,6 +60,10 b" addflag('color-info', 'InteractiveShell.color_info'," | |||
|
60 | 60 | colours.""", |
|
61 | 61 | "Disable using colors for info related things." |
|
62 | 62 | ) |
|
63 | addflag('ignore-cwd', 'InteractiveShellApp.ignore_cwd', | |
|
64 | "Exclude the current working directory from sys.path", | |
|
65 | "Include the current working directory in sys.path", | |
|
66 | ) | |
|
63 | 67 | nosep_config = Config() |
|
64 | 68 | nosep_config.InteractiveShell.separate_in = '' |
|
65 | 69 | nosep_config.InteractiveShell.separate_out = '' |
@@ -168,6 +172,12 b' class InteractiveShellApp(Configurable):' | |||
|
168 | 172 | When False, pylab mode should not import any names into the user namespace. |
|
169 | 173 | """ |
|
170 | 174 | ).tag(config=True) |
|
175 | ignore_cwd = Bool( | |
|
176 | False, | |
|
177 | help="""If True, IPython will not add the current working directory to sys.path. | |
|
178 | When False, the current working directory is added to sys.path, allowing imports | |
|
179 | of modules defined in the current directory.""" | |
|
180 | ).tag(config=True) | |
|
171 | 181 | shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', |
|
172 | 182 | allow_none=True) |
|
173 | 183 | # whether interact-loop should start |
@@ -189,8 +199,10 b' class InteractiveShellApp(Configurable):' | |||
|
189 | 199 | |
|
190 | 200 | .. versionchanged:: 7.2 |
|
191 | 201 | Try to insert after the standard library, instead of first. |
|
202 | .. versionchanged:: 8.0 | |
|
203 | Allow optionally not including the current directory in sys.path | |
|
192 | 204 | """ |
|
193 | if '' in sys.path: | |
|
205 | if '' in sys.path or self.ignore_cwd: | |
|
194 | 206 | return |
|
195 | 207 | for idx, path in enumerate(sys.path): |
|
196 | 208 | parent, last_part = os.path.split(path) |
General Comments 0
You need to be logged in to leave comments.
Login now