-
Notifications
You must be signed in to change notification settings - Fork 905
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
Add official support for Python 3.12 #3587
Conversation
Tests failing on 3.11 instead 🤔
rings a bell but I don't have time to look at this right now, will do so later. |
This is the flaky test that occasionally fails. I think @lrcouto was seeing this as well on her PR for adding the |
This comment was marked as outdated.
This comment was marked as outdated.
79e190c
to
3d804c9
Compare
@@ -437,7 +438,8 @@ def test_overlapping_patterns(self, tmp_path, mocker): | |||
|
|||
mocked_load = mocker.patch("omegaconf.OmegaConf.load") | |||
expected_path = (tmp_path / "dev" / "user1" / "catalog2.yml").resolve() | |||
assert mocked_load.called_once_with(expected_path) | |||
|
|||
mocked_load.assert_called_once_with(expected_path) |
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.
This assert was trivially passing, the test was not doing anything (and it's broken at least in 3.11 and 3.12)
One test failure left, only happening on Python 3.12:
|
This test is different than the one I've seen. There was one that was caused by a requirement version, which Nok fixed, and another that happened in the tests for the starters. This one is new to me. |
Did a little digging - python/cpython#105524 |
Close #3287. Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
3d804c9
to
74705b8
Compare
Looks like this will require a bit of work. I'm not pursuing this PR for the time being. |
@astrojuanlu Maybe you can add some context on the challenges you're seeing in #3287 and then we can properly plan it for a sprint? |
Good point, done #3287 (comment) |
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <90615669+AhdraMeraliQB@users.noreply.github.com>
@@ -401,6 +401,7 @@ def test_empty_catalog_file(self, tmp_path): | |||
)["catalog"] | |||
assert catalog == {} | |||
|
|||
@pytest.mark.xfail(reason="Logic failing") |
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.
Fixed the test to check for the intended behaviour. However, it fails, and manual testing shows that this is due to the implementation of the OmegaConfigLoader. I would suggest correcting this should be split out into a separate issue to be addressed.
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 don't agree with this being addressed in a separate issue, adding the 3.12
support is what's making this fail and thus it should be fixed in this PR.
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.
It's not the move to include 3.12 that's causing this test to fail, but rather it was never truly passing, the previous method call used for the assert was mistyped, leading to a trivial pass. To resolve this requires digging further into the implementation of the OmegaConfigLoader, as it is not behaving as expected, and perhaps never was. See xref.
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
kedro/config/abstract_config.py
Outdated
# From Python 3.12 __getitem__ isn't called in UserDict.get() | ||
# Use the version from 3.11 and prior | ||
def get(self, key: str, default: Any = None) -> Any: | ||
"D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None." | ||
try: | ||
return self[key] | ||
except KeyError: | ||
return default | ||
|
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.
Why is this needed?
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.
See this issue, the UserDict's get implementation in 3.12 doesn't work for the config loader anymore, so the method is overwritten to use the get function from the previous python versions
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 will make the comment in the file more clear Done!
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.
Should this be on OmegaConfigLoader or the abstract method? I am slightly confused why get
method is needed for OmegaConf.
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.
Should this be on OmegaConfigLoader or the abstract method?
I went for the AbstractConfigLoader to catch any cases where users have defined their own Config Loaders (for whatever reason) that inherit from the AbstractConfigLoader.
I am slightly confused why get method is needed for OmegaConf.
Whilst we don't promote using get over the dict syntax, we have made it available - and it features in our API docs - allowing users to do something like:
conf_loader = OmegaConfigLoader(<...>)
if not conf_loader.get("parameters"):
parameters = MY_LOCAL_PARAMS
Ultimately, removing get() is a breaking change, which would block adding 3.12 support until the next major release.
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
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 @astrojuanlu and @AhdraMeraliQB for making this work 👍
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 @astrojuanlu & @AhdraMeraliQB :D
Close #3287.
Description
Development notes
First attempt, I haven't ran the test suite locally yet. But
pip install -e .[test]
worked first time on Apple Silicon.Developer Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file