-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
openlineage: add ClassVar to Airflow facets. #36084
Conversation
I'm not sure why mypy fails now - it looks the opposite to what happens in main. I ran |
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.
You can't / shouldn't change parent class variable type: https://docs.python.org/3/library/typing.html#typing.ClassVar
That is the reason why mypy
unhappy
@@ -28,7 +30,7 @@ class AirflowMappedTaskRunFacet(BaseFacet): | |||
mapIndex: int | |||
operatorClass: str | |||
|
|||
_additional_skip_redact: list[str] = ["operatorClass"] | |||
_additional_skip_redact: ClassVar[list[str]] = ["operatorClass"] |
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.
_additional_skip_redact: ClassVar[list[str]] = ["operatorClass"] | |
_additional_skip_redact = ["operatorClass"] |
@@ -63,7 +65,7 @@ class UnknownOperatorInstance(RedactMixin): | |||
properties: dict[str, object] | |||
type: str = "operator" | |||
|
|||
_skip_redact: list[str] = ["name", "type"] | |||
_skip_redact: ClassVar[list[str]] = ["name", "type"] |
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.
_skip_redact: ClassVar[list[str]] = ["name", "type"] | |
_skip_redact = ["name", "type"] |
If PR does not change dependencies (setup.py/generated dependencies.json) then dependencies are taken from. Main constraints file. Those are the very same dependencies you have when you just build the image without --upgrade-to-newer-dependencies |
Okay, how about we remove annotations in provider now as suggested by @Taragolis? |
Longer explanation:
Yes. This is entirely expected that your PR will have 'regular' constraints. Only the For 'regular` PRs the PR are using 'frozen' constraints which are automatically updated by the latest main build that passed all tests. This way when there is a change in released packages) - such as this one - all the regular PRs that do not touch dependencies will run using 'good' versions of packages. This is all as designed as expected - this way change like this only fails canary build and a handful of PRs that change dependencies, but all 'standard' PRs are unaffected. So yes - your PR uses the 'previous' version of openlineage libs - so you have to make your fix in the way that it is backwards compatible - and works for both - whAt was before the change and after. This is precisely what our users will have - some of them will use previous version of open lineage and some use the new version. If you want to make a change that only works for newer version (which I think is not the case here) then you also have to update requirements for open lineage provider (and add >= x.y.z for example). This way your PR will be 'changing' dependencies which means that it will automatically use 'upgrade to newer' This is all precisely as designed and expected :) |
@potiuk thanks for your thorough explanation. After discussion in Slack I decided to add |
_additional_skip_redact: list[str] = ["operatorClass"] | ||
# openlineage-python<=1.5.0 does not annotate this as ClassVar | ||
# mypy may complain about overriding instance variable with class variable | ||
_additional_skip_redact: ClassVar[list[str]] = ["operatorClass"] # type: ignore |
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.
_additional_skip_redact: ClassVar[list[str]] = ["operatorClass"] # type: ignore | |
_additional_skip_redact: ClassVar[list[str]] = ["operatorClass"] # type: ignore[misc] |
_skip_redact: list[str] = ["name", "type"] | ||
# openlineage-python<=1.5.0 does not annotate this as ClassVar | ||
# mypy may complain about overriding instance variable with class variable | ||
_skip_redact: ClassVar[list[str]] = ["name", "type"] # type: ignore |
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.
_skip_redact: ClassVar[list[str]] = ["name", "type"] # type: ignore | |
_skip_redact: ClassVar[list[str]] = ["name", "type"] # type: ignore[misc] |
BTw. @Taragolis in slack mentioned that just removing the annotation might work ... so maybe ? |
Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>
1ce6231
to
f28ffc2
Compare
@potiuk @Taragolis yeah, in the end we all agreed on removing the annotation. Went for it |
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.
:D
Recent OpenLineage release introduced a change that breaks mypy in main. This PR fixes it.