-
-
Notifications
You must be signed in to change notification settings - Fork 533
Replacer: Allow LocalPath to pass through #1713
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
Conversation
97a6520
to
ff8f606
Compare
Paths were already stored inside SectionReader._subs as path objects, however they are turned into strings when they go through Replacer, and various transforms occur on these paths, for example breaking paths containing '#' and ' '. This change defaults to path objects being retained through the Replacer, and path segments being joined together using path object joining semantics. This mode can be disabled for settings of type `path` by wrapping the value in quotes, and disabled for other values by disabling new global setting literal_paths. Fixes tox-dev#763 and tox-dev#924
ff8f606
to
03f4911
Compare
There are still more tests to write, to verify that path objects pass through each arg type sanely. The most obvious way to reduce the surface area of the possible breakage is to not use literal path mode if the input value contains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we really need to handle this use case given no one complained about this yet. Makes the code much more complicated, and paths having #
feels more an academic exercise than something likely to come up. Also now introduces a new flag, which I'm not that keen on migrating to version 4. tox already has too many options 🤔
Just using this approach for type The Another approach to allow to bypass the shlex'ing of paths for other types of values is to do allow something like |
If this literal_paths flag is merged, I would expect that v4 does not have this flag, and only uses this new literal path mode. There is nothing in the prior syntax which can not be achieved more cleanly with the new mode. To convert old mode to new mode, those problematic value would need to be split into two keys, with one being a path only (and be literal, no shlex/CommandLine), and the other joining the first key and the other strings (and uses shlex and CommandLine as before). The ability to disabling it in v3 would only be so that people dont need to re-write their ini, if they have complex syntax and it behaves slightly differently, and they dont want to learn the changes. |
tox 4 aims (as much as possible) to be configuration file compatible, so any flag we introduce today will likely be grandfathered into tox 4... otherwise, people would have to rewrite their tox.ini just to start using tox 4, which IMHO is a too big ask. |
As you can see from this PR, the new mode passes all existing tests, and new tests. It is compatible with an extremely high percentage of existing tox.ini uses. I am being overly cautious and explaining that there are small breakages, so as to not mislead code reviewers. The next step is to isolate them. Also as above I have outlined quite a few ways to eliminate even the small breakages, and I am going to explore that also. Also it would be nice if I could get your feedback on the proposal above at #1713 (comment) to split off the |
Can you detail on these a bit? |
@jayvdb this is merge conflicting. |
I'll close this for now until you can attend to the PR again. Once you've done we can reopen. |
Paths were already stored inside SectionReader._subs as
path objects, however they are turned into strings when they
go through Replacer, and various transforms occur on these
paths, for example breaking paths containing '#' and ' '.
This change defaults to path objects being retained through the
Replacer, and path segments being joined together using path object
joining semantics.
This mode can be disabled for settings of type
path
by wrappingthe value in quotes, and disabled for other values by disabling
new global setting literal_paths.
Fixes #763 and #924
Contribution checklist:
(also see CONTRIBUTING.rst for details)
in message body
<issue number>.<type>.rst
for example (588.bugfix.rst)<type>
is must be one ofbugfix
,feature
,deprecation
,breaking
,doc
,misc
<your username>
"superuser
."CONTRIBUTORS
(preserving alphabetical order)