Skip to content

Migrate os.path to pathlib.Path in file_processor_handler.py#68758

Open
Dotify71 wants to merge 1 commit into
apache:mainfrom
Dotify71:fix/68757-pathlib-migration
Open

Migrate os.path to pathlib.Path in file_processor_handler.py#68758
Dotify71 wants to merge 1 commit into
apache:mainfrom
Dotify71:fix/68757-pathlib-migration

Conversation

@Dotify71

Copy link
Copy Markdown
Contributor

Description

Fixes #68757

The airflow.utils.log.file_processor_handler module currently relies heavily on the os.path library for filesystem path manipulations. To modernize the codebase, improve cross-platform readability, and align with modern Python standards, this PR migrates os.path calls (e.g., os.path.join, os.path.abspath, os.path.isdir) to their pathlib.Path equivalents where possible.

Testing

  • Existing Airflow unit tests will cover these pathways as this handler is central to DAG parsing logging.

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM overall, just one comment though

Comment thread airflow-core/src/airflow/utils/log/file_processor_handler.py Outdated
@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch 5 times, most recently from fedc00f to f642c56 Compare June 27, 2026 17:15
Comment thread scripts/in_container/run_migration_reference.py Outdated

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mixed unrelated changes.

@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch from a40c67b to 764e55b Compare June 29, 2026 16:23
@Dotify71

Copy link
Copy Markdown
Contributor Author

Thanks @potiuk for the review!

I have:

  1. Dropped the unrelated Alembic patch commit.
  2. Fixed the failing static checks (removed the unused import os in file_processor_handler.py and changed .resolve() to .absolute() to match the original os.path.abspath behavior, which doesn't resolve symlinks and was breaking tests).

This is now a clean 1-commit PR. Let me know if anything else is needed!

@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch from 764e55b to a1f40cc Compare June 29, 2026 16:24
@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch 2 times, most recently from 4da0cc6 to 9b0939f Compare June 30, 2026 16:39
@Dotify71 Dotify71 force-pushed the fix/68757-pathlib-migration branch from 9b0939f to 932e8f7 Compare June 30, 2026 17:41
@Dotify71 Dotify71 changed the title Refactor: Migrate os.path to pathlib.Path in file_processor_handler.py Migrate os.path to pathlib.Path in file_processor_handler.py Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:logging area:task-sdk ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Migrate os.path to pathlib.Path in file_processor_handler.py

3 participants