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

Support for parameter expansion in --override #3171

Open
jschwartzentruber opened this issue Dec 12, 2023 · 3 comments
Open

Support for parameter expansion in --override #3171

jschwartzentruber opened this issue Dec 12, 2023 · 3 comments
Labels
enhancement help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@jschwartzentruber
Copy link

jschwartzentruber commented Dec 12, 2023

What's the problem this feature will solve?

Configuration values cannot be overridden (via -x/--override or TOX_OVERRIDE) without losing the ability to use positional arguments in the value.

For example: tox -x "testenv.commands=poetry run pylint {posargs}" --

Describe the solution you'd like

Value substitution should be performed after overrides have been applied to the configuration.

Alternative Solutions

Positional arguments can be put into the override value directly, but only if they are known in advance. An example of a tool that cannot interpolate arguments into the override value is pre-commit.

Bash could also be used to create the override value, but this requires more setup for Windows development.

@gaborbernat
Copy link
Member

I do not follow from your examples and description what you're trying to achieve and what's the problem. Please refresh the description with clearer explanation.

@jschwartzentruber
Copy link
Author

I do not follow from your examples and description what you're trying to achieve and what's the problem. Please refresh the description with clearer explanation.

Sorry, my example was too convoluted. The motivation is wanting to reuse a testenv by overriding commands so a single testenv can be used for multiple linters. There are other solutions, but I was surprised that {posargs} isn't expanded in -x, so I thought I'd open a request.

@gaborbernat
Copy link
Member

The motivation is wanting to reuse a testenv by overriding commands so a single testenv can be used for multiple linters.

That's not supported on purpose. You could create a plugin for adding that support but we don't do that in core.

@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

2 participants