Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tox breaks ipython input/output when #2999

Open
albertodonato opened this issue May 1, 2023 · 1 comment
Open

tox breaks ipython input/output when #2999

albertodonato opened this issue May 1, 2023 · 1 comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@albertodonato
Copy link
Contributor

Issue

When running ipython as a command in a tox env, the input and output are messed up. Terminal gets reset at every enter from the ipython shell. This seems to be due some conflict interacting with the console
A workaround is to pass --simple-prompt to ipython, but this means ipython doesn't provide things like autocompletion.

Tested with tox 4.5.1 and ipython 8.13.1.

Environment

Provide at least:

  • OS: Ubuntu 23.04 amd64
  • pip list of the host Python where tox is installed:
$ pip list
Package       Version
------------- -------
cachetools    5.3.0
chardet       5.1.0
colorama      0.4.6
distlib       0.3.6
filelock      3.12.0
packaging     23.1
pip           23.1.2
platformdirs  3.5.0
pluggy        1.0.0
pyproject_api 1.5.1
setuptools    66.1.1
tox           4.5.1
virtualenv    20.23.0

Output of running tox

Provide the output of tox -rvv:

hpy: 70 W remove tox env folder /home/ack/Desktop/.tox/py [tox/tox_env/api.py:322]
py: 131 I find interpreter for spec PythonSpec(path=/home/ack/Desktop/test/bin/python3) [virtualenv/discovery/builtin.py:58]
py: 132 D got python info of /usr/bin/python3.11 from /home/ack/.local/share/virtualenv/py_info/1/ca3ed784184f1b3bb7c3539bfb45e71710cd27667424f92c2d5bb4df9c107c23.json [virtualenv/app_data/via_disk_folder.py:131]
py: 132 I proposed PythonInfo(spec=CPython3.11.2.final.0-64, system=/usr/bin/python3.11, exe=/home/ack/Desktop/test/bin/python3, platform=linux, version='3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
py: 132 D accepted PythonInfo(spec=CPython3.11.2.final.0-64, system=/usr/bin/python3.11, exe=/home/ack/Desktop/test/bin/python3, platform=linux, version='3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
py: 133 D filesystem is case-sensitive [virtualenv/info.py:26]
py: 144 I create virtual environment via CPython3Posix(dest=/home/ack/Desktop/.tox/py, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:50]
py: 144 D create folder /home/ack/Desktop/.tox/py/bin [virtualenv/util/path/_sync.py:12]
py: 144 D create folder /home/ack/Desktop/.tox/py/lib/python3.11/site-packages [virtualenv/util/path/_sync.py:12]
py: 145 D write /home/ack/Desktop/.tox/py/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:32]
py: 145 D 	home = /usr/bin [virtualenv/create/pyenv_cfg.py:36]
py: 145 D 	implementation = CPython [virtualenv/create/pyenv_cfg.py:36]
py: 145 D 	version_info = 3.11.2.final.0 [virtualenv/create/pyenv_cfg.py:36]
py: 145 D 	virtualenv = 20.23.0 [virtualenv/create/pyenv_cfg.py:36]
py: 145 D 	include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:36]
py: 145 D 	base-prefix = /usr [virtualenv/create/pyenv_cfg.py:36]
py: 145 D 	base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:36]
py: 145 D 	base-executable = /usr/bin/python3.11 [virtualenv/create/pyenv_cfg.py:36]
py: 145 D symlink /usr/bin/python3.11 to /home/ack/Desktop/.tox/py/bin/python [virtualenv/util/path/_sync.py:31]
py: 145 D create virtualenv import hook file /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:91]
py: 145 D create /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:94]
py: 145 D ============================== target debug ============================== [virtualenv/run/session.py:52]
py: 145 D debug via /home/ack/Desktop/.tox/py/bin/python /home/ack/Desktop/test/lib/python3.11/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:195]
py: 145 D {
  "sys": {
    "executable": "/home/ack/Desktop/.tox/py/bin/python",
    "_base_executable": "/usr/bin/python3.11",
    "prefix": "/home/ack/Desktop/.tox/py",
    "base_prefix": "/usr",
    "real_prefix": null,
    "exec_prefix": "/home/ack/Desktop/.tox/py",
    "base_exec_prefix": "/usr",
    "path": [
      "/usr/lib/python311.zip",
      "/usr/lib/python3.11",
      "/usr/lib/python3.11/lib-dynload",
      "/home/ack/Desktop/.tox/py/lib/python3.11/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "utf-8"
  },
  "version": "3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]",
  "makefile_filename": "/usr/lib/python3.11/config-3.11-x86_64-linux-gnu/Makefile",
  "os": "<module 'os' (frozen)>",
  "site": "<module 'site' (frozen)>",
  "datetime": "<module 'datetime' from '/usr/lib/python3.11/datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from '/usr/lib/python3.11/json/__init__.py'>"
} [virtualenv/run/session.py:53]
py: 159 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/ack/.local/share/virtualenv) [virtualenv/run/session.py:57]
py: 161 D got embed update of distribution pip from /home/ack/.local/share/virtualenv/wheel/3.11/embed/3/pip.json [virtualenv/app_data/via_disk_folder.py:131]
py: 162 D using periodically updated wheel /home/ack/.local/share/virtualenv/wheel/house/pip-23.0.1-py3-none-any.whl [virtualenv/seed/wheels/periodic_update.py:43]
py: 163 D install setuptools from wheel /home/ack/Desktop/test/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/setuptools-67.7.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py: 163 D install wheel from wheel /home/ack/Desktop/test/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/wheel-0.40.0-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py: 163 D install pip from wheel /home/ack/.local/share/virtualenv/wheel/house/pip-23.0.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py: 164 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.40.0-py3-none-any/wheel to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/wheel [virtualenv/util/path/_sync.py:39]
py: 164 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/pip [virtualenv/util/path/_sync.py:39]
py: 164 D copy /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.7.2-py3-none-any/distutils-precedence.pth to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:39]
py: 165 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.7.2-py3-none-any/_distutils_hack to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:39]
py: 166 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.7.2-py3-none-any/pkg_resources to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/pkg_resources [virtualenv/util/path/_sync.py:39]
py: 169 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.40.0-py3-none-any/wheel-0.40.0.dist-info to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/wheel-0.40.0.dist-info [virtualenv/util/path/_sync.py:39]
py: 170 D copy /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.40.0-py3-none-any/wheel-0.40.0.virtualenv to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/wheel-0.40.0.virtualenv [virtualenv/util/path/_sync.py:39]
py: 171 D generated console scripts wheel3.11 wheel wheel-3.11 wheel3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:43]
py: 175 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.7.2-py3-none-any/setuptools to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/setuptools [virtualenv/util/path/_sync.py:39]
py: 188 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.7.2-py3-none-any/setuptools-67.7.2.dist-info to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/setuptools-67.7.2.dist-info [virtualenv/util/path/_sync.py:39]
py: 189 D copy /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-67.7.2-py3-none-any/setuptools-67.7.2.virtualenv to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/setuptools-67.7.2.virtualenv [virtualenv/util/path/_sync.py:39]
py: 189 D generated console scripts  [virtualenv/seed/embed/via_app_data/pip_install/base.py:43]
py: 197 D copy directory /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip-23.0.1.dist-info to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/pip-23.0.1.dist-info [virtualenv/util/path/_sync.py:39]
py: 198 D copy /home/ack/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-23.0.1-py3-none-any/pip-23.0.1.virtualenv to /home/ack/Desktop/.tox/py/lib/python3.11/site-packages/pip-23.0.1.virtualenv [virtualenv/util/path/_sync.py:39]
py: 198 D generated console scripts pip pip3.11 pip-3.11 pip3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:43]
py: 198 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:63]
py: 199 D write /home/ack/Desktop/.tox/py/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:32]
py: 199 D 	home = /usr/bin [virtualenv/create/pyenv_cfg.py:36]
py: 199 D 	implementation = CPython [virtualenv/create/pyenv_cfg.py:36]
py: 199 D 	version_info = 3.11.2.final.0 [virtualenv/create/pyenv_cfg.py:36]
py: 199 D 	virtualenv = 20.23.0 [virtualenv/create/pyenv_cfg.py:36]
py: 199 D 	include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:36]
py: 199 D 	base-prefix = /usr [virtualenv/create/pyenv_cfg.py:36]
py: 199 D 	base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:36]
py: 199 D 	base-executable = /usr/bin/python3.11 [virtualenv/create/pyenv_cfg.py:36]
py: 200 W install_deps> python -I -m pip install ipython [tox/tox_env/api.py:428]
Collecting ipython
  Using cached ipython-8.13.1-py3-none-any.whl (797 kB)
Collecting backcall
  Using cached backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting decorator
  Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting jedi>=0.16
  Using cached jedi-0.18.2-py2.py3-none-any.whl (1.6 MB)
Collecting matplotlib-inline
  Using cached matplotlib_inline-0.1.6-py3-none-any.whl (9.4 kB)
Collecting pickleshare
  Using cached pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30
  Using cached prompt_toolkit-3.0.38-py3-none-any.whl (385 kB)
Collecting pygments>=2.4.0
  Using cached Pygments-2.15.1-py3-none-any.whl (1.1 MB)
Collecting stack-data
  Using cached stack_data-0.6.2-py3-none-any.whl (24 kB)
Collecting traitlets>=5
  Using cached traitlets-5.9.0-py3-none-any.whl (117 kB)
Collecting pexpect>4.3
  Using cached pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
Collecting parso<0.9.0,>=0.8.0
  Using cached parso-0.8.3-py2.py3-none-any.whl (100 kB)
Collecting ptyprocess>=0.5
  Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Collecting wcwidth
  Using cached wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)
Collecting executing>=1.2.0
  Using cached executing-1.2.0-py2.py3-none-any.whl (24 kB)
Collecting asttokens>=2.1.0
  Using cached asttokens-2.2.1-py2.py3-none-any.whl (26 kB)
Collecting pure-eval
  Using cached pure_eval-0.2.2-py3-none-any.whl (11 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: wcwidth, pure-eval, ptyprocess, pickleshare, executing, backcall, traitlets, six, pygments, prompt-toolkit, pexpect, parso, decorator, matplotlib-inline, jedi, asttokens, stack-data, ipython
Successfully installed asttokens-2.2.1 backcall-0.2.0 decorator-5.1.1 executing-1.2.0 ipython-8.13.1 jedi-0.18.2 matplotlib-inline-0.1.6 parso-0.8.3 pexpect-4.8.0 pickleshare-0.7.5 prompt-toolkit-3.0.38 ptyprocess-0.7.0 pure-eval-0.2.2 pygments-2.15.1 six-1.16.0 stack-data-0.6.2 traitlets-5.9.0 wcwidth-0.2.6
py: 2782 I exit 0 (2.58 seconds) /home/ack/Desktop> python -I -m pip install ipython pid=1421955 [tox/execute/api.py:275]
py: 2782 W commands[0]> ipython [tox/tox_env/api.py:428]
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.13.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: py: 8344 I exit 0 (5.56 seconds) /home/ack/Desktop> ipython pid=1422041 [tox/execute/api.py:275]
  py: OK (8.27=setup[2.71]+cmd[5.56] seconds)
  congratulations :) (8.30 seconds)

Minimal example

If possible, provide a minimal reproducer for the issue:

tox.ini config

[testenv]
deps =
    ipython
commands =
    ipython {posargs}
@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Jun 16, 2023
@gaborbernat
Copy link
Member

PR welcome.

ziima added a commit to ziima/tox that referenced this issue Oct 13, 2023
ziima added a commit to ziima/tox that referenced this issue Oct 17, 2023
ziima added a commit to ziima/tox that referenced this issue Oct 17, 2023
ziima added a commit to ziima/tox that referenced this issue Oct 17, 2023
ziima added a commit to ziima/tox that referenced this issue Oct 17, 2023
ziima added a commit to ziima/tox that referenced this issue Oct 17, 2023
ziima added a commit to ziima/tox that referenced this issue Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

2 participants