Pants will load a [REPL](🔗) with all of your specified source code and any of its third-party dependencies, which allows you to import those values.
## IPython
In addition to the default Python shell, Pants supports the improved [IPython shell](🔗).
To use IPython, run `./pants repl --shell=ipython
`. To permanently use IPython, add this to your `pants.toml
`:
You can change IPython's version with `[ipython].version
`. If you change it, Pants's default lockfile for IPython will not work. Either set the `lockfile
` option to a custom path or `"<none>"
` to opt-out. See [Third-party dependencies](🔗).
If you set the `version
` lower than IPython 7, then you must set `[ipython].ignore_cwd = false
` to avoid Pants setting an option that did not exist in earlier IPython releases.
IPython does not yet work with Pantsd
When using IPython, use the option `
--no-pantsd
` to turn off the Pants daemon, e.g. `./pants --no-pantsd repl --shell=ipython
`. We are working to [fix this](🔗).
Python 2 support
Pants uses IPython 7 by default, which does not work with Python 2. You can override `
version
` to use IPython 5. As mentioned above, you must set `ignore_cwd = false
`.You can even use IPython 7 for Python 3 code, and IPython 5 for Python 2 code:
## Examples
This will not load any of your code:
`./pants repl ::
` will load all your code.
Tip: how to exit the REPL
Either type `
exit()
` and hit enter, or press `ctrl+d
`.