Open MicaelJarniac opened 1 year ago
I ran into a situation where I could use @MicaelJarniac 's suggestion. So, if anyone is interested in building this, there would be at least two users :)
As of now, I am using this:
if session._runner.reuse_existing_venv():
...
How would this feature be useful?
Sometimes, it might be useful to know the state of
reuse-existing-virtualenvs
andno-install
, for example, to skip somerun
actions.In my case, I want to run
mypy --non-interactive --install-types
when it's creating new virtualenvs and installing dependencies, but I want to run justmypy
when it's reusing virtualenvs and not installing dependencies.I can use
run_always
to havemypy --non-interactive --install-types
run only when it's installing dependencies, but I couldn't find a way to then havemypy
not run (other than running with--install-only
), so if it's also installing dependencies, it'll end up running Mypy twice.Describe the solution you'd like
I'd like there to be
session.reuse_existing_virtualenvs
,session.no_install
andsession.install_only
attributes that would represent the state of the--reuse-existing-virtualenvs
,--no-install
, and--install-only
flags, respectively.In my case, this would allow me to do the following:
Describe alternatives you've considered
No response
Anything else?
It might be useful to also have other flags represented by attributes. They could also be inside a
session.flags
object, likesession.flags.no_install
, to keep them more organized.