You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amoghrajesh (via GitHub)" <gi...@apache.org> on 2025/10/27 09:05:39 UTC
[PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
amoghrajesh opened a new pull request, #57335:
URL: https://github.com/apache/airflow/pull/57335
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
Structlog released 25.5.0 version where `structlog.dev.Styles` was renamed as `structlog.dev.ColumnStyles` along with some refactoring. This breaks our CI like this:
```python
Stderr: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/runner/work/airflow/airflow/airflow-core/src/airflow/__init__.py", line 81, in <module>
settings.initialize()
File "/home/runner/work/airflow/airflow/airflow-core/src/airflow/settings.py", line 698, in initialize
LOGGING_CLASS_PATH = configure_logging()
File "/home/runner/work/airflow/airflow/airflow-core/src/airflow/logging_config.py", line 88, in configure_logging
from airflow._shared.logging import configure_logging, init_log_folder, translate_config_values
File "/home/runner/work/airflow/airflow/airflow-core/src/airflow/_shared/logging/__init__.py", line 27, in <module>
from .structlog import configure_logging, init_log_file, init_log_folder
File "/home/runner/work/airflow/airflow/airflow-core/src/airflow/_shared/logging/structlog.py", line 38, in <module>
from .percent_formatter import PercentFormatRender
File "/home/runner/work/airflow/airflow/airflow-core/src/airflow/_shared/logging/percent_formatter.py", line 29, in <module>
from structlog.dev import ConsoleRenderer, Styles
ImportError: cannot import name 'Styles' from 'structlog.dev' (/home/runner/work/airflow/airflow/.venv/lib/python3.10/site-packages/structlog/dev.py)
```
Bumping the min version to 25.5.0 from 25.4.0 and fixing the imports accordingly.
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Move structlog imports into a TYPE_CHECKING block to untie version bumps [airflow]
Posted by "hynek (via GitHub)" <gi...@apache.org>.
hynek commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3459528860
Wow so sorry for that! To add some context from the structlog side: Styles wasn't really a thing – it was a hack to make the old-style class-variables-as-storage work as a type hint (I mean, what does `Union[_Styles, Type[_Styles]]` even mean). And since it was never documented, I kinda treated it like an internal thing.
Since you've already fixed it, I don't think it makes any sense to do any emergency releases form my side. Again, I'm sorry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #57335:
URL: https://github.com/apache/airflow/pull/57335#discussion_r2465080345
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
Review Comment:
Yep. Let's see.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Move structlog imports into a TYPE_CHECKING block to untie version bumps [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3451860581
Yup, this will be part of 3.1.2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #57335:
URL: https://github.com/apache/airflow/pull/57335#discussion_r2465001597
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
Review Comment:
I think only ColunmStyles can be moved (but It's strange ruff does not tell us that).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3450526437
Fair point, pushing a fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #57335:
URL: https://github.com/apache/airflow/pull/57335#discussion_r2464999157
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
Review Comment:
I don't think we can. Usually ruff will tell us when we can do it and ask us to do this - but we are using those classes for "real" - not only in type-hinting (for example we derive PercentRenderer from ConsoleRenderer).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #57335:
URL: https://github.com/apache/airflow/pull/57335#discussion_r2465053198
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
Review Comment:
Ruff prefers to merge imports, and since ConsoleRenderer is used at runtime, it prefers putting Style/ColumnStyles in the same line, even though that name is not used at runtime. But you still can move it into a type-checking-only block instead as a separate import, and Ruff will allow it since it assumes you have good reasons (as we do here).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Move structlog imports into a TYPE_CHECKING block to untie version bumps [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh merged PR #57335:
URL: https://github.com/apache/airflow/pull/57335
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Move structlog imports into a TYPE_CHECKING block to untie version bumps [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3460176737
All good, @hynek!
I do not think any other project would've suffered it but we certainly did because `Styles` was exposed in the public interface, and we used it. IAC, we moved it rightly to a type checking block and I think we are good now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3450519154
We should remove the version bumps too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3450442146
Just tried it https://github.com/apache/airflow/pull/57335/commits/14be76e08c9b4da0683c5b9b245aebfdeb289f72
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #57335:
URL: https://github.com/apache/airflow/pull/57335#discussion_r2464984314
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
Review Comment:
Let’s move type-hint-only imports into TYPE_CHECKING so future changes broke less things
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Move structlog imports into a TYPE_CHECKING block to untie version bumps [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3450756502
Failing test is unrelated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Move structlog imports into a TYPE_CHECKING block to untie version bumps [airflow]
Posted by "pankajkoti (via GitHub)" <gi...@apache.org>.
pankajkoti commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3451546007
Thanks for the fix @amoghrajesh.
@kaxil wish to check if this would be included in 3.1.2 (not sure if we're still planning to cut one before you go on leave :))? Today, I observed with my local development efforts that upon installing Cosmos on 3.1.1 as base image, somehow `structlog` version gets updated (maybe via some cosmos dependency), and I observe this failure. I verified that Airflow 3.1.1 installs structlog 25.4.0, so I believe it's safe by itself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #57335:
URL: https://github.com/apache/airflow/pull/57335#discussion_r2465063909
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
from structlog.processors import CallsiteParameter
if TYPE_CHECKING:
Review Comment:
```suggestion
if TYPE_CHECKING:
from structlog.dev import ColumnStyles
```
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
Review Comment:
```suggestion
from structlog.dev import ConsoleRenderer
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Bump structlog to 25.5.0 and handle updates to code [airflow]
Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #57335:
URL: https://github.com/apache/airflow/pull/57335#discussion_r2464984314
##########
shared/logging/src/airflow_shared/logging/percent_formatter.py:
##########
@@ -26,7 +26,7 @@
from typing import TYPE_CHECKING, ClassVar
import structlog.dev
-from structlog.dev import ConsoleRenderer, Styles
+from structlog.dev import ColumnStyles, ConsoleRenderer
Review Comment:
Let’s move type-hint-only imports into TYPE_CHECKING so future changes break less things. We won’t need to bump structlog version either if we do this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Move structlog imports into a TYPE_CHECKING block to untie version bumps [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #57335:
URL: https://github.com/apache/airflow/pull/57335#issuecomment-3450756043
That worked, thanks @uranusjr
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org