You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any chance to have a place to specify pyhon.exe locations?
The problem is that not everyone can/will use the r"c:\python\d.\d\python.exe" location.
E.g. on winbot.zope.org I need 32 and 64 bit pythons beside each other.
I'd vote for a global tox.ini where one could define something.
Based on the conversation, am I correct in saying that the scope of this issue has grown to cover a means of specifying the interpreter path on all platforms, not just win32? If so, could someone update the title and description to reflect that? (Note that it seems Bb's issues do not preserve history of the description, so take care.)
Issue #217 is a duplicate, but from a Unixish perspective.
Wouldn't #154 ("Allow user configuration outside of tox.ini") take care of this, in that an individual user would be able to manually override interpreter paths per-user/host? (#154 describes a superset of what's been discussed here, so it's not a duplicate.)
Just to revive this issue: Maybe it would already be of good help to extend the current automatic interpreter detection on windows to match the formula used by the web CI service appveyor. This seems like a default interpreter setup which might be acceptable for many teams.
Current behaviour:
Testenv name: pyXY
Interpreter Resolution (Windows): C:\Python27\python.exe | (not C:\Python2.7\python.exe as the docs say)
I have found a strange case which seems to absolutely require the option to specify Python locations. I log into a server with an admin user X, but for running services I have to use another admin user Y that does not have log on rights. tox works fine for X, but for Y, it fails to find Python for reasons I cannot fathom, giving: ERROR: InterpreterNotFound: python3.4. If I could specify the path to Python, that would be a solution to this problem.
Also, i would expect tox to find all python interpreters automatically that are reachable through $PATH (and ideally the windows registry). We might also need to cache version info if it turns out calling all of the interpreters at tox startup takes too long.
@anthon_van_der_neut thanks for your efforts. I'd appreciate if you bring the PR back into shape. One issue we need to solve on top is how to specify interpreter versions from the environments, for example basepython = python==2.7.6, basepython = pypy>=2.3.0,<2.4, reusing setuptools/pip requirements syntax.
Holger, I can get it back into mergable shape once more if you want, it would be nice if it then gets merged as I already did that once. I have used my fork for myself for the longest time but then wanted to use some new tox feature a month some three months ago, and now use an alias for tox (that gets the right micro version where I have multiple major.minor versions installed), on Linux, where this is easy. On windows it is a pain, via the registry only one micro (the last one installed) can be found. I really need to be able to test 2.7.3, 2.7.6 and 2.7.9 as I the older two micro versions are installed at some customers and I am not in the position to upgrade. I have given some thought about a wrapper for tox that handles this as I currently have multiple (memory gobbling) windows VMs, but I much rather spent the time whipping this PR in shape.
AFAICS all you need is the ability to use two config files instead of one:
one system-specific, to specify the basepython setting for all the [testenv:pyXY] sections, and
one project-specific to specify the dependencies and commands
I was going to say that ConfigParser supports multiple config files seamlessly, but then did a quick grep and I see tox uses py.iniconfig instead, about which I know nothing.
@tiran: Reading the registry is an interesting additional possibility, but those entries are not necessary to run Python. And they don't need to be there (they are in fact not always there, as I can see on one of my windows installations). Relying on them is IMHO in the same league as relying on python being in C:\pythonX.Y : useful for most cases but not for all.
I have some code that uses the Windows registry to detect installations of Windows. The Python extension installers are using a similar approach. I'm going to donate the code and implement a PR for the feature soonish.
I tested this on my Virtual Machine based Windows where Python 2.7 is installed under C:\Program Files\Python27\ (so spaces work) if your 32 and 64 bit versions have some regularity in the naming then the globbing should be able to find you all the 64bit or all the 32bits at a time.
Some salt for your tests. Please be prepared on windows for such locations:
c:\python2.7
c:\python27_32
c:\python2.7_32
c:\python2.7.3_32
c:\a dir with spaces\python2.7
and such variatons.
The problem is that you can install python.exe practically anywhere. Where linux has a well established standard of python\d.\d, the same is a pain on windows.
@agroszer : Below is what @hpk42 wrote this morning. I will probably be able to implement this based on his wishes, both commandline and environment var. Most time consuming will be writing the tests, although I am getting better at that...
I will let you know when I have something that is testable.
Original message:
I don't want to get into the business of putting things in $HOME with tox right now. In fact, tox-1.6 now sets a pseudo-HOME during installing dependencies. In the long run, i'd like to move tox.ini to support specifying python versions instead of doing things based on names and "basepython" settings. I.e. set a python_version = >2.5,<2.6, and then tox will find a good match based on looking at all available interpreters. note that tox-1.6 already has new code in tox/interpreters.py which queries all specified python versions at configuration time. Creating a map from version->executable should be straight forward. What remains is the question of how to discover interpreters. I think we could - in conjunction with the above idea - start with an option "--interpreter-globs" which which is a shlex.split()-able list of globs-patterns so in your case "/opt/python/*/bin/python?.?" to discover all pythons. We can also have a TOX_INTERPRETER_GLOBS env var which is read in as well, and can be set from $HOME/.bashrc.
I just wrote a lengthy suggestion on this in a declined PR, trying to tackle this issue. I now found out i can't easily access my message from that decline request (DOH). Maybe @anthon_van_der_neut can post it here?
Hi, can specifying python.exe locations be done in tox 2.9.1?
I would assume any solution for this would be cross platform. Because, for example, on macOS it's possible to have a python.org installed python3.6 alongside a homebrew installed python3.6 and I would want to test my Python native extensions against both runtimes, just to be sure.
Please use Python Launcher's method (using registry) as a default search for python locations. Optionally we can just run py -X.Y as a default for pyXY under windows (if launcher installed).
What about ability to run py -X.Y-32 under 64bit windows?
I don't think Python Launcher would help with this:
"I have found a strange case which seems to absolutely require the option to specify Python locations. I log into a server with an admin user X, but for running services I have to use another admin user Y that does not have log on rights. tox works fine for X, but for Y, it fails to find Python for reasons I cannot fathom, giving: ERROR: InterpreterNotFound: python3.4. If I could specify the path to Python, that would be a solution to this problem."
Activity
pytoxbot commentedon Sep 17, 2016
Original comment by wcooley
Based on the conversation, am I correct in saying that the scope of this issue has grown to cover a means of specifying the interpreter path on all platforms, not just win32? If so, could someone update the title and description to reflect that? (Note that it seems Bb's issues do not preserve history of the description, so take care.)
Issue #217 is a duplicate, but from a Unixish perspective.
Wouldn't #154 ("Allow user configuration outside of tox.ini") take care of this, in that an individual user would be able to manually override interpreter paths per-user/host? (#154 describes a superset of what's been discussed here, so it's not a duplicate.)
pytoxbot commentedon Sep 17, 2016
Original comment by timmwagener
Just to revive this issue: Maybe it would already be of good help to extend the current automatic interpreter detection on windows to match the formula used by the web CI service appveyor. This seems like a default interpreter setup which might be acceptable for many teams.
Current behaviour:
Proposed behaviour:
pytoxbot commentedon Sep 17, 2016
Original comment by @mcarans
I have found a strange case which seems to absolutely require the option to specify Python locations. I log into a server with an admin user X, but for running services I have to use another admin user Y that does not have log on rights. tox works fine for X, but for Y, it fails to find Python for reasons I cannot fathom, giving: ERROR: InterpreterNotFound: python3.4. If I could specify the path to Python, that would be a solution to this problem.
pytoxbot commentedon Sep 17, 2016
Original comment by @hpk42
Also, i would expect tox to find all python interpreters automatically that are reachable through
$PATH(and ideally the windows registry). We might also need to cache version info if it turns out calling all of the interpreters at tox startup takes too long.pytoxbot commentedon Sep 17, 2016
Original comment by @hpk42
@anthon_van_der_neut thanks for your efforts. I'd appreciate if you bring the PR back into shape. One issue we need to solve on top is how to specify interpreter versions from the environments, for example
basepython = python==2.7.6,basepython = pypy>=2.3.0,<2.4, reusing setuptools/pip requirements syntax.pytoxbot commentedon Sep 17, 2016
Original comment by ruamel
Holger, I can get it back into mergable shape once more if you want, it would be nice if it then gets merged as I already did that once. I have used my fork for myself for the longest time but then wanted to use some new tox feature a month some three months ago, and now use an alias for tox (that gets the right micro version where I have multiple major.minor versions installed), on Linux, where this is easy. On windows it is a pain, via the registry only one micro (the last one installed) can be found. I really need to be able to test 2.7.3, 2.7.6 and 2.7.9 as I the older two micro versions are installed at some customers and I am not in the position to upgrade. I have given some thought about a wrapper for tox that handles this as I currently have multiple (memory gobbling) windows VMs, but I much rather spent the time whipping this PR in shape.
pytoxbot commentedon Sep 17, 2016
Original comment by @hpk42
nope, the PR is not conflict free and i need to find 1-2 consecutive days (at least) to properly work on this i thin.
pytoxbot commentedon Sep 17, 2016
Original comment by @agroszer
any news on this? @hpk42 ?
pytoxbot commentedon Sep 17, 2016
Original comment by @agroszer
bump
pytoxbot commentedon Sep 17, 2016
Original comment by @mgedmin
AFAICS all you need is the ability to use two config files instead of one:
basepythonsetting for all the [testenv:pyXY] sections, andI was going to say that ConfigParser supports multiple config files seamlessly, but then did a quick grep and I see tox uses py.iniconfig instead, about which I know nothing.
pytoxbot commentedon Sep 17, 2016
Original comment by @agroszer
Yup, definitely the manually specified locations need to have the highest priority.
I will just know better what I want.
pytoxbot commentedon Sep 17, 2016
Original comment by @AvdN
@tiran: Reading the registry is an interesting additional possibility, but those entries are not necessary to run Python. And they don't need to be there (they are in fact not always there, as I can see on one of my windows installations). Relying on them is IMHO in the same league as relying on python being in C:\pythonX.Y : useful for most cases but not for all.
pytoxbot commentedon Sep 17, 2016
Original comment by tiran
I have some code that uses the Windows registry to detect installations of Windows. The Python extension installers are using a similar approach. I'm going to donate the code and implement a PR for the feature soonish.
https://bitbucket.org/tiran/multisetup/src/26c05ed906ba655b0a959e4436b17b21f4916b08/multisetup.py?at=default#cl-107
pytoxbot commentedon Sep 17, 2016
Original comment by @AvdN
PR #69 should solve this
pytoxbot commentedon Sep 17, 2016
Original comment by @AvdN
@agroszer I just uploaded a PR for the changes to allow --interpreter-globs and/or TOX_INTERPRETER_GLOBS. https://bitbucket.org/hpk42/tox/pull-request/69/interpreter-globs-extensions-for-option/diff. I am not sure if you are willing to try this out before @hpk42 integrates this in release, but if you do, you can find the source here: https://bitbucket.org/anthon_van_der_neut/tox_interpreter-globs and of course I can help assist if there are any problems.
I tested this on my Virtual Machine based Windows where Python 2.7 is installed under C:\Program Files\Python27\ (so spaces work) if your 32 and 64 bit versions have some regularity in the naming then the globbing should be able to find you all the 64bit or all the 32bits at a time.
pytoxbot commentedon Sep 17, 2016
Original comment by @agroszer
Some salt for your tests. Please be prepared on windows for such locations:
and such variatons.
The problem is that you can install python.exe practically anywhere. Where linux has a well established standard of python\d.\d, the same is a pain on windows.
pytoxbot commentedon Sep 17, 2016
Original comment by @AvdN
@agroszer : Below is what @hpk42 wrote this morning. I will probably be able to implement this based on his wishes, both commandline and environment var. Most time consuming will be writing the tests, although I am getting better at that...
I will let you know when I have something that is testable.
Original message:
I don't want to get into the business of putting things in $HOME with tox right now. In fact, tox-1.6 now sets a pseudo-HOME during installing dependencies. In the long run, i'd like to move tox.ini to support specifying python versions instead of doing things based on names and "basepython" settings. I.e. set a python_version = >2.5,<2.6, and then tox will find a good match based on looking at all available interpreters. note that tox-1.6 already has new code in tox/interpreters.py which queries all specified python versions at configuration time. Creating a map from version->executable should be straight forward. What remains is the question of how to discover interpreters. I think we could - in conjunction with the above idea - start with an option "--interpreter-globs" which which is a shlex.split()-able list of globs-patterns so in your case "/opt/python/*/bin/python?.?" to discover all pythons. We can also have a TOX_INTERPRETER_GLOBS env var which is read in as well, and can be set from $HOME/.bashrc.
pytoxbot commentedon Sep 17, 2016
Original comment by @agroszer
Found the PR. I'm OK with an ENV variable too. Whatever makes it work.
Guessing just won't work for everyone.
re globs: be prepared for exotic locations ;-)
pytoxbot commentedon Sep 17, 2016
Original comment by @hpk42
I just wrote a lengthy suggestion on this in a declined PR, trying to tackle this issue. I now found out i can't easily access my message from that decline request (DOH). Maybe @anthon_van_der_neut can post it here?
WayneKeenan commentedon Nov 20, 2017
Hi, can specifying python.exe locations be done in tox 2.9.1?
I would assume any solution for this would be cross platform. Because, for example, on macOS it's possible to have a python.org installed python3.6 alongside a homebrew installed python3.6 and I would want to test my Python native extensions against both runtimes, just to be sure.
pyhedgehog commentedon Dec 6, 2017
py -X.Yas a default for pyXY under windows (if launcher installed).py -X.Y-32under 64bit windows?WayneKeenan commentedon Dec 6, 2017
so is the answer, no?
mcarans commentedon Dec 6, 2017
I don't think Python Launcher would help with this:
"I have found a strange case which seems to absolutely require the option to specify Python locations. I log into a server with an admin user X, but for running services I have to use another admin user Y that does not have log on rights. tox works fine for X, but for Y, it fails to find Python for reasons I cannot fathom, giving: ERROR: InterpreterNotFound: python3.4. If I could specify the path to Python, that would be a solution to this problem."
gaborbernat commentedon Dec 6, 2017
We recommend creating pythonx.y type BAT-s and add it to the PATH the location to these. This will work with any 2.0+ tox. See https://tox.readthedocs.io/en/latest/developers.html#id1
On Linux/Mac OS just symlink your executable into somewhere of your PATH.