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

Allow wildcards to be used in TOXENV and with the -e option #318

Closed
pytoxbot opened this issue Sep 17, 2016 · 7 comments
Closed

Allow wildcards to be used in TOXENV and with the -e option #318

pytoxbot opened this issue Sep 17, 2016 · 7 comments
Labels
area:configuration needs:discussion It's not quite clear if and how this should be done
Milestone

Comments

@pytoxbot
Copy link

Currently it's not possible to use wildcards with TOXENV and/or the -e option.

For example, I'd like to be able to use:

export TOXENV=py27-*

... to just run the python 2.7 subset of the peep tox config:
https://github.com/erikrose/peep/blob/daa9e87014de1f907fac446f89b9d849665a649e/tox.ini#L8-L9

However since wildcards aren't supported, I've had to resort to a bit of a hack to generate the TOXENV in the Travis config:

export TOXENV=`tox --listenvs | grep "py${TRAVIS_PYTHON_VERSION/./}-" | tr '\n' ','`

See:
https://github.com/edmorley/peep/commit/bb77b96dfd548dd3ba9ac1c595c047dbd3e7f8a9

Many thanks :-)

@pytoxbot
Copy link
Author

Original comment by @eli-collins

If it helps, attached is the quick-n-dirty helper script that I've been using to solve a similar problem. Usage is toxmatch.py <FACTORS>

@pytoxbot
Copy link
Author

Original comment by @eli-collins

Instead of a -f FACTOR option, perhaps if it was implemented so that -f simply changed the behavior of -e and -l to do factor matching? That way it would be possible to use -fl FACTOR to see what environments would be run by -fe FACTOR.

If that were also combined with some flag to make -l output a single-line csv (e.g. "--list-csv"), It would also make Ed's environment string reduce to export TOXENV='tox --list-csv -fl py${TRAVIS_PYTHON_VERSION/./}'

@pytoxbot
Copy link
Author

Original comment by @edmorley

Sorry for the delay in replying. Agree that due to TOXENV wildcarding may be the better solution. I've not had a spare moment yet, but will try to double back to this at some point.

I've also spotted there's a dupe issue #22, albeit there's less discussion there, so might be worth forward-duping.

@pytoxbot
Copy link
Author

Original comment by @hpk42

As far as command line options go i'd rather like a -f FACTOR option to select all env names which have the factor. True enough, that wouldn't help with TOXENV so maybe wildcarding is the more general solution. Are you up for a PR with tests and docs that introduces wildcard-matching (fnmatch-style) for -e and TOXENV?

@eli-collins
Copy link

Since this issue got moved to git, I'm reuploading the script I've been using, if anyone finds it useful (as code source, or just as is):
toxmatch.py -- https://gist.github.com/eli-collins/ef91add2bc635ccaf61738cd805cb18b

@obestwalter obestwalter added area:configuration needs:discussion It's not quite clear if and how this should be done and removed enhancement labels Sep 4, 2017
@anentropic
Copy link

this would be great

@rpkilby
Copy link
Member

rpkilby commented Apr 4, 2019

I've created tox-factor, which allows for matching on specific factors. So, instead of

tox -e py37-*

you would run

tox -f py37

or

TOXFACTOR=py37 tox

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:configuration needs:discussion It's not quite clear if and how this should be done
Projects
None yet
Development

No branches or pull requests

6 participants