Skip to content

Conversation

pydanny
Copy link
Contributor

@pydanny pydanny commented Feb 17, 2025

Functions that have a lot of arguments can be hard to use. When using fastcore.script.delegates to composite several layers of functions into one, this scenario becomes more frequent and poignant.

This PR:

  • Adds a sort_args parameter to fastcore.meta.delegates that changes the function signature to list the arguments in alphabetical order
  • Documents the change
  • Includes a test
  • Does not modify call_parse to benefit from this change. call_parse's use of argparse makes this a significant task, involving modifying the argparse library to not sys.exit() during use of --help. We believe correcting this is out of scope for this change, as it appears to involve using the patch decorator on the ArgumentParser usage in call_parse, which might break things downstream.

@pydanny pydanny requested a review from jph00 February 17, 2025 20:48
@pydanny pydanny force-pushed the add-sort-args-to-delegates branch from 5256529 to 79780eb Compare February 17, 2025 21:00
@pydanny pydanny marked this pull request as draft February 17, 2025 21:01
@pydanny pydanny marked this pull request as ready for review February 19, 2025 11:03
@pydanny pydanny force-pushed the add-sort-args-to-delegates branch from 9838b7e to 765157b Compare February 19, 2025 11:04
Co-Authored-By: Audrey M. Roy Greenfeld <audrey@feldroy.com>
@pydanny pydanny force-pushed the add-sort-args-to-delegates branch from 765157b to 3b2af9c Compare February 19, 2025 15:23
@jph00 jph00 merged commit ed195ee into main Feb 19, 2025
14 checks passed
@jph00 jph00 added the enhancement New feature or request label May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants