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 Producer field defaults #139

Open
JacobHayes opened this issue Dec 7, 2021 · 0 comments
Open

Support Producer field defaults #139

JacobHayes opened this issue Dec 7, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@JacobHayes
Copy link
Member

We don't currently allow Producers to set default parameters (1, 2). This was originally to prevent a default value from "subverting" the compute_input_fingerprint calculation, but I think we may be able to relax the checks and still including during fingerprinting.

We should be able to set field defaults safely to Artifact instances, as these will be discoverable by the .inputs property (which is what feeds into dependency tracking), however build/map parameter defaults alone won't be visible so should still be blocked.

One caveat: the @producer setup generates the fields from the function signature - in this case, perhaps when adding fields to __annotations__, we can convert the default value (which would be a python value) to an Artifact instance (using Artifact.cast) and then clear the defaults (build.__defaults__ = None; build.__kwdefaults__ = None).

@JacobHayes JacobHayes added enhancement New feature or request good first issue Good for newcomers labels Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant