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
Remind users they should be setting a Python min version. #12287
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Changelog[uncommitted] (2023-03-30)Features
|
This commit introduces a log line to remind users they should be setting the Python minimum version in their schema. This refactor makes accessing the min version a checked error, increasing safety.
657d217
to
53d647c
Compare
Prefer a top-level function over a method for minPythonVersion, because minPythonVersion is a validation step, and thus should be colocated with validation code. It's not a concern of the PackageInfo.
@@ -2210,6 +2222,21 @@ func genPackageMetadata( | |||
return w.String(), nil | |||
} | |||
|
|||
// errNoMinimumPythonVersion is a non-fatal error indicating that the schema |
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.
Probably overkill for a != ""
check.
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.
Is this blocking feedback? I want a checked error because
- we've already missed checking this field once
- we're about to check it in a second place, with the advent of the
pyproject.toml
file.
That's kind of the whole point of this PR, really.
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.
Fair enough, it doesn't feel very "Go-ish" but then Go is horrible so I won't block approval on this
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.
Thanks! I had a similar discussion with @abhinav around the API limitations which (in my eyes) necessitate adding this fn on a public field.
12287: Remind users they should be setting a Python min version. r=RobbieMcKinstry a=RobbieMcKinstry <!--- Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation. --> # Description This PR adds a log line during SDKGen if the user does not include a minimum Python version. IMO, we should expect all Python packages to list a minimum Python version to provide greater clarity to our users. In the current version of this PR, this warning is printing during module generating; we might prefer to ensure its only printed once per package instead of once per module. Additionally, this turns accessing the minimum Python version into a checked error from an unchecked error, increasing safety. <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> Fixes: #12286 ## Checklist <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Service, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. --> Co-authored-by: Robbie McKinstry <robbie@pulumi.com>
bors r+ |
Already running a review |
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 very much like that we now fill in a sensible default for setup.py files, good change.
I'm less sure about needing to tell everyone that they ought to set this version in their schemas. I'd consider setting this field to be a edge use case where users know better than our sdk generation because they're doing something custom.
I've said it elsewhere but to repeat it here, I think a good schema design would result in not having to set any language specific settings (we don't have that today, but we should be moving towards that, not away).
Are you concerned about the log level? Suppose it was DEBUG instead of WARN. I think if we're changing the value that users provide, we should emit a log somewhere telling them we're overriding their value. |
I agree with that statement. But in this case we're not changing the value that users provide. Either they give us a min version and we stick that in setup.py, or they don't and we put in a sensible default. I don't think we need to log for every default, but if you think we should (and like I can see arguments for that) then that's fine but then we should be consistent and be logging for lots of other defaults we set as well not just this. |
That makes sense to me. My life is still made easier by this PR as long as we keep the checked error. I'm refactoring now. |
Canceled. |
bors r+ |
Build succeeded: |
Description
This PR adds a log line during SDKGen if the user does not include a minimum
Python version. IMO, we should expect all Python packages to list a minimum
Python version to provide greater clarity to our users.
In the current version of this PR, this warning is printing during module
generating; we might prefer to ensure its only printed once per package instead
of once per module.
Additionally, this turns accessing the minimum Python version into a checked error from an unchecked error, increasing safety.
Fixes: #12286
Checklist
make changelog
and committed thechangelog/pending/<file>
documenting my change