-
I am trying to define a tox.ini that defines platform-dependent config for a single CLI argument in a single command. My current solution uses an environment variable:
I would like to get rid of the environment variable and infer the correct setting based on platform. If on macOS,
I don't like this solution because:
Is there any solution that avoids both of the above? I'm hoping for something that basically works like this:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I like your second approach the most - this is the one I see quite often in a tox configuration. If you want to avoid the duplication, you can always create a bash or a Python script as a wrapper around your pylint command. |
Beta Was this translation helpful? Give feedback.
-
It is also possible to workaround this using from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from tox.plugin import impl
if TYPE_CHECKING:
from tox.config.sets import EnvConfigSet
from tox.session.state import State
@impl
def tox_add_env_config(env_conf: EnvConfigSet, state: State) -> None:
env_conf.add_constant(["sys_platform"], "string representing current OS", sys.platform)
print("tox_add_env_config", env_conf, state) And then could use |
Beta Was this translation helpful? Give feedback.
I like your second approach the most - this is the one I see quite often in a tox configuration.
If you want to avoid the duplication, you can always create a bash or a Python script as a wrapper around your pylint command.