-
-
Notifications
You must be signed in to change notification settings - Fork 533
Need option for not skipping missing interpreters #631
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
Comments
Hi @wsanchez, you could make the value dependent on an env var and get what you want this way.
On your devbox have the env var permanently set by adding it to the initialization of the shell or directly on the command line:
CI can then be blissfully unaware of that configuration option and developers can adjust it to their needs. |
I for one think this is a good idea, patch incoming :) |
I am -1 on this. Feels like command line argument inflation for something that is easily solvable with what we have. |
I would rather introduce accepting an argument for |
Devils advocate: why even have the command line argument if you could do it with environment variables 😆 |
more seriously: I think we could change import argparse
import distutils.util
no_arg = object()
parser = argparse.ArgumentParser()
parser.add_argument(
'--foo', default=no_arg, nargs='?', type=distutils.util.strtobool,
)
args = parser.parse_args()
if args.foo is no_arg:
print('not present: false')
elif args.foo is None:
print('old behaviour: true')
else:
print(f'new behaviour {args.foo}') $ python3.6 test.py
not present: false
$ python3.6 test.py --foo
old behaviour: true
$ python3.6 test.py --foo=True
new behaviour 1
$ python3.6 test.py --foo=False
new behaviour 0
$ python3.6 test.py --foo=garbage
usage: test.py [-h] [--foo [FOO]]
test.py: error: argument --foo: invalid strtobool value: 'garbage' |
Now we're getting somewhere :) |
That will break when there are arguments following:
|
TBH my feeling is anyway to try to simplify tox configuration instead of piling the features on, so I will stay with my -1 on this. |
Maybe tox should just have an |
That sounds like a great direction to me. |
Ooh that sounds like the best option. If we wanted to make it generic perhaps something like this?
Or with brackets?
EDIT: that argparse snippet above only fails on positional arguments afterwards -- it still does the right thing on options:
|
I'd say we have good look at how pytest does this and ideally implement the exact same behaviour. I'm off to bed for now though. Wrestling with that horrible release workflow I concocted left me utterly drained. |
@asottile The syntax with brackets I proposed was inspired by the interpolation syntax in tox.ini where you'd use
Right. It still means invocations which worked before will give a confusing error afterwards.
Note that pytest doesn't have to handle different config sections, it only has |
closing in favour of #634 (and because it is possible without this option already as dexcribed in #631 (comment)). |
I really like to have
skip_missing_interpreters = True
in mytox.ini
, because I'm often working on machines that don't have every Python interpreter installed.But it's a really bad idea in a CI scenario, because environments just pass without doing anything.
I'd love to see an option to set that value back to
False
, but there's only a CLI option for setting it toTrue
… every flag really should have an opposite.The text was updated successfully, but these errors were encountered: