Skip to content

Conversation

aritra24
Copy link
Collaborator

@aritra24 aritra24 commented May 3, 2025

before and after
Screenshot 2025-05-03 at 10 40 33 AM
Screenshot 2025-05-03 at 10 40 24 AM

Not sure if there is a case where stripping the whitespace in the front changes the expected experience.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
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.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label May 3, 2025
@tirkarthi
Copy link
Contributor

I would prefer the backend to trim/dedent on docstring during dag parsing than frontend. There could be code blocks with indent in docstring and trimming leading space might cause issues.

@aritra24
Copy link
Collaborator Author

aritra24 commented May 3, 2025

Yeah, I agree. I wasn't sure what would be the smartest way of trimming. I can move it to the backend and perhaps do a strip min(whitespace at the front of lines)? What do you think @tirkarthi

@eladkal eladkal added this to the Airflow 3.0.1 milestone May 5, 2025
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label May 5, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break code block indendation.
Screenshot 2025-05-05 at 14 56 16

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think doc_md attribute manually shouldn't contain any leading space (that's how the doc and internet resource specify that) for instance:
https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html#dag-task-documentation.

But this is not possible when de doc is coming from the docstring. I think we should remove leading spaces there when parsing the docstring. (this way what's stored in the db is correct and the API and UI will work without further modification )

@aritra24
Copy link
Collaborator Author

aritra24 commented May 5, 2025

@pierrejeambrun, moved it to the server side. Let me know what you think now?

@kaxil
Copy link
Member

kaxil commented May 6, 2025

Changing the milestone to 3.0.2 -- about to cut 3.0.1

@kaxil kaxil modified the milestones: Airflow 3.0.1, Airflow 3.0.2 May 6, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks.

@pierrejeambrun pierrejeambrun added the backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch label May 6, 2025
@bbovenzi bbovenzi merged commit d1ef9b9 into apache:main May 6, 2025
96 checks passed
github-actions bot pushed a commit that referenced this pull request May 6, 2025
(cherry picked from commit d1ef9b9)

Co-authored-by: Aritra Basu <[email protected]>
Copy link

github-actions bot commented May 6, 2025

Backport successfully created: v3-0-test

Status Branch Result
v3-0-test PR Link

github-actions bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request May 6, 2025
(cherry picked from commit d1ef9b9)

Co-authored-by: Aritra Basu <[email protected]>
github-actions bot pushed a commit to guan404ming/airflow that referenced this pull request May 6, 2025
(cherry picked from commit d1ef9b9)

Co-authored-by: Aritra Basu <[email protected]>
@kaxil kaxil modified the milestones: Airflow 3.0.2, Airflow 3.0.1 May 6, 2025
kaxil pushed a commit that referenced this pull request May 6, 2025
(cherry picked from commit d1ef9b9)

Co-authored-by: Aritra Basu <[email protected]>
@@ -164,6 +165,14 @@ def get_timezone(cls, tz: Timezone | FixedTimezone) -> str | None:
return None
return str(tz)

@field_validator("doc_md", mode="before")
@classmethod
def get_doc_md(cls, doc_md: str | None) -> str | None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, coming "late" to the party.... and just one tought... would it not be better to "clean" the dedent at time of DAG parsing, not at point of retrieval? That would prevent potential problems of the docs are consumed in other scenarios as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not opposed to that, it reduces the number of calls to dedent as well. I think the reason behind this was to not effect the serialized db entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants