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

Allow setting default args for commands / callbacks #157

Merged
merged 4 commits into from
Apr 30, 2024

Conversation

stefanv
Copy link
Member

@stefanv stefanv commented Jan 25, 2024

I will still document this and add tests, but it allows you to override the default keyword arguments passed to commands. E.g., consider:

@click.command()
@click.option("-f", "--flag")
@click.option("-t", "--test", default="not set")
def example(flag, test, default_kwd=None):
[tool.spin.kwargs]
".spin/cmds.py:example" = {"test" = "default override", "default_kwd" = 3}

This will override the --test flag's default value to default override.
It will also override the default_kwd keyword, which is not associated with a flag.

@ngoldbaum @rgommers I expect that this may solve the request around build clean. We can add a clean_rm keyword argument to the build command, which can then be set in the config on a per-project basis.

@stefanv stefanv added the type: Enhancement New feature or request label Jan 25, 2024
@stefanv stefanv marked this pull request as ready for review March 23, 2024 00:35
@stefanv stefanv merged commit 49ccdd0 into scientific-python:main Apr 30, 2024
17 checks passed
@jarrodmillman jarrodmillman added this to the 0.9 milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants