tox-dev / tox-uv

Use https://github.com/astral-sh/uv with tox
MIT License
66 stars 14 forks source link

uv pip freeze creates color in output #38

Closed Stealthii closed 6 months ago

Stealthii commented 6 months ago

Issue

When tox calls the freeze routine, uv is placing color escape sequences in the output, resulting in the dependency list containing color escape sequences and breaking the constraints text file used in subsequent steps.

Environment

Minimal example

py38-mindeps: freeze> /Users/dporter/.pyenv/versions/3.11.8/bin/uv pip freeze
py38-mindeps: install_package_deps> /Users/dporter/.pyenv/versions/3.11.8/bin/uv pip install 'asyncssh<3,>=2.13.1' -c${project}/.tox/py38-mindeps/constraints.txt
error: Unexpected 'xpected '-c', '-e', '-r' or the start of a requirement at ${project}/.tox/py38-mindeps/constraints.txt:1:1

$ file .tox/py38-mindeps/constraints.txt
.tox/py38-mindeps/constraints.txt: ASCII text, with escape sequences
gaborbernat commented 6 months ago

This doesn't make sense. This freeze is not used for install. Is only for user consumption.

Stealthii commented 6 months ago

This doesn't make sense. This freeze is not used for install. Is only for user consumption.

The freeze command is called when use_frozen_constraints is passed, such as the following config:

 [testenv:py38-mindeps]
deps =
    anyio==4
    asyncer==0.0.4
    asyncssh==2.13.1
constrain_package_deps = true
use_frozen_constraints = true

When that option is passed, a freeze is ran against the existing packages in the environment, which are then appended to the constraints file.

bluss commented 6 months ago

This sounds like an uv bug similar to astral-sh/uv/issues/2017