-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 support for Python 3.11 #6326
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
1 similar comment
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
48e6f96
to
0478ac1
Compare
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.
More tests passing locally. mypy
is unhappy with the hack I've taken here, where I "call" our Policy
objects as a way of initializing all their dataclass properties (now that they're default_factory
instead of default
). I'm sure there's a better way to do this!
Per failing unit tests, looks like this needs fixing for py311: dbt-core/tests/unit/test_version.py Lines 638 to 648 in b5d303f
|
Took a look into this - I believe the root cause here is that The change in |
@MichelleArk Given that this is just a method in our unit tests (quite old, probably warranting a rewrite), I don't hate the idea of a quick & expedient fix, whose fragility we can document for our future selves |
d347c37
to
6e28898
Compare
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.
Just one comment - otherwise LGTM! 🐍 🏃💨
d7cc333
to
763c05a
Compare
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 think I managed to fix the failure in test_logging.py
for py311.
Less sure why tests/adapter/grants
suddenly started failing, claiming that the env vars for test users weren't set:
Env var required but not provided: 'DBT_TEST_USER_X'
Update: This is due to a breaking change in tox==4.0.0
, see #6405
core/dbt/events/eventmgr.py
Outdated
@@ -128,7 +128,7 @@ def create_debug_line(self, e: BaseEvent) -> str: | |||
log_line = f"\n\n{separator} {datetime.utcnow()} | {self.event_manager.invocation_id} {separator}\n" | |||
ts: str = datetime.utcnow().strftime("%H:%M:%S.%f") | |||
scrubbed_msg: str = self.scrubber(e.message()) # type: ignore | |||
log_line += f"{self._get_color_tag()}{ts} [{e.log_level():<5}]{self._get_thread_name()} {scrubbed_msg}" | |||
log_line += f"{self._get_color_tag()}{ts} [{e.log_level().value:<5}]{self._get_thread_name()} {scrubbed_msg}" |
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.
@peterallenwebb This seems to have been an unintentional change in #6291, where the file text log looked like:
�[0m18:00:14.981418 [EventLevel.INFO] [MainThread]: Running with dbt=1.4.0-a1
�[0m18:00:14.982553 [EventLevel.DEBUG] [MainThread]: running dbt with arguments {'write_json': True, 'use_colors': True, 'printer_width': 80, 'version_check': True, 'partial_parse': True, 'static_parser': True, 'profiles_dir': '/Users/jerco/.dbt', 'send_anonymous_usage_stats': True, 'quiet': False, 'no_print': False, 'which': 'run', 'rpc_method': 'run', 'indirect_selection': 'eager'}
Instead of:
�[0m18:10:46.308814 [info ] [MainThread]: Running with dbt=1.4.0-a1
�[0m18:10:46.309953 [debug] [MainThread]: running dbt with arguments {'write_json': True, 'use_colors': True, 'printer_width': 80, 'version_check': True, 'partial_parse': True, 'static_parser': True, 'profiles_dir': '/Users/jerco/.dbt', 'send_anonymous_usage_stats': True, 'quiet': False, 'no_print': False, 'which': 'run', 'rpc_method': 'run', 'indirect_selection': 'eager'}
Caught because this logging test checks log lines for the presence of the string ["debug"]
exactly.
Update: It looks like this may have been a specific behavior change in Python 3.11, related to how enums are stringified / formatted (python/cpython#94763)
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.
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.
@peterallenwebb says this is fine for now, we'll open a tech debt issue for the str/enum inconsistency :)
c23ab02
to
ea383b9
Compare
resolves #6147
Description
Adds support for Python 3.11 :sonic:
Checklist
changie new
to create a changelog entry