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

Coerce Distribution.script_args to list #320

Merged
merged 1 commit into from
Dec 27, 2024
Merged

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Nov 25, 2024

This will allow any iterable to be passed as script_args for setup.
After this is merged, typeshed can be updated to reflect this change, which will allow https://github.com/jaraco/jaraco.office/pull/2/files#diff-bb91dce3f1ce94166001a97817fed8d6a6a56c6d7f95233cc28268aea7f05778R24 to pass.

If you don't want the coercion, then script_args should at least be typed as Sequence[str] and python/typeshed#13116 should be merged first.

I also noticed, I think there's no validation that script_args isn't a plain str

@jaraco
Copy link
Member

jaraco commented Dec 27, 2024

This will allow any iterable to be passed as script_args for setup.

Is this the right approach, versus requiring a list and requiring consumers to construct lists? I do think Iterable is generally preferable, but if this value is a pass-through to get-opt, I'm kinda inclined to just align with what it expects. Nah, this approach seems fine.

I also noticed, I think there's no validation that script_args isn't a plain str

I'm fine with that. If the type system allows for "IterableNotStringOrBytesOrDict", that might make sense, but it's kinda gross, so let's just leave it open unless the type system has a solution for that ambiguity.

@jaraco jaraco merged commit 7a9bbd5 into pypa:main Dec 27, 2024
22 checks passed
@Avasam
Copy link
Contributor Author

Avasam commented Dec 27, 2024

if this value is a pass-through to get-opt, I'm kinda inclined to just align with what it expects.

getopt is slightly mistyped atm. It accepts more than just list. I need to improve my PR on that, but python/typeshed#13116

@Avasam Avasam deleted the type-script_args branch December 27, 2024 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants