Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Confusing virtualenv interpolation tox 3.24 #2330

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

Closed
SteveHespelt opened this issue Jan 23, 2022 · 1 comment
Closed

Confusing virtualenv interpolation tox 3.24 #2330

SteveHespelt opened this issue Jan 23, 2022 · 1 comment
Labels
bug:normal affects many people or has quite an impact

Comments

@SteveHespelt
Copy link

tox 3.24.1
When using {envpython} in a command (invoking a python script that updates an ipython kernelspec file - so I need the absolute path as the CWD is changing prior to nbconvert.ExecutePreprocessor() usage ), I see that the interpolated value is relative ( issue 1339 indicates tox 4 reverts back to absolute paths) to {toxinidir} location.

My question is: why, if I use {toxinidir}{/}{envpython} to convey the absolute path of the virtualenv python interpreter used, does the resulting path become the toxinidir path followed by the now-absolute path for {envpython}? Is it a design feature that whenever the interpolation has non-whitespace before the reference, it's converted to an absolute path? And as you can see from the tox -v -v feedback below, if {envpython} is argv[0] for the command, its full path is used.

{envpython} => .tox/py37-mylinux-rdf4j/bin/python
but {toxinidir}{/}{envpython} => /home/steve/Documents/ART-002/GitRepos/proj1//home/steve/Documents/ART-002/GitRepos/proj1/.tox/py37-mylinux-rdf4j/bin/python

And, as pointed out by @tucked, the tox -v -v output is somewhat misleading, if just {envpython} is used, the relative path is conveyed. But mixed feedback from tox [ fyi: {envtmpdir}{/}kernels is the tox.ini argument for the below --dir option, I used --tmp mytemp:{envtmpdir} to see what happens for that variable if non-whitespace before the reference - same misleading feedback]

commands in commands_pre= section:

bash -c -- 'mkdir -p {envtmpdir}{/}kernels'
{envpython} {toxinidir}{/}test{/}update_kernel.py --dir {envtmpdir}{/}kernels --python {envpython}  --tmp mytemp:{envtmpdir}

py37-mylinux-rdf4j run-test-pre: commands[5] | /home/steve/Documents/ART-002/GitRepos/proj1/.tox/py37-mylinux-rdf4j/bin/python /home/steve/Documents/ART-002/GitRepos/proj1/test/update_kernel.py --dir /home/steve/Documents/ART-002/GitRepos/proj1/.tox/py37-mylinux-rdf4j/tmp/kernels --python /home/steve/Documents/ART-002/GitRepos/proj1/.tox/py37-mylinux-rdf4j/bin/python --tmp mytemp:/home/steve/Documents/ART-002/GitRepos/proj1/.tox/py37-mylinux-rdf4j/tmp
BUT
[32432] /home/steve/Documents/ART-002/GitRepos/proj1$ /home/steve/Documents/ART-002/GitRepos/proj1/.tox/py37-mylinux-rdf4j/bin/python test/update_kernel.py --dir .tox/py37-mylinux-rdf4j/tmp/kernels --python .tox/py37-mylinux-rdf4j/bin/python --tmp mytemp:/home/steve/Documents/ART-002/GitRepos/proj1/.tox/py37-mylinux-rdf4j/tmp
Why show the prefix path if it's not actually conveyed? I ask because I don't presume that there is no good reason. I just don't know it...

MTIA for any insights, feedback. And yes, I'm hoping to update to tox 4 'soon' :-). Tox is quite powerful, useful. Much appreciated.

@SteveHespelt SteveHespelt added the bug:normal affects many people or has quite an impact label Jan 23, 2022
@gaborbernat
Copy link
Member

gaborbernat commented Jan 24, 2022

I don't think your use case was designed per se. The way it works is mostly because happens to work like that 🤔 Furthermore, there's not much we can do here, tox 3 is mostly frozen at this point feature wise.

@tox-dev tox-dev locked and limited conversation to collaborators Jan 24, 2022
@gaborbernat gaborbernat converted this issue into discussion #2331 Jan 24, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug:normal affects many people or has quite an impact
Projects
None yet
Development

No branches or pull requests

2 participants