Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions airflow-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ dependencies = [
"tenacity>=8.3.0",
"termcolor>=3.0.0",
"typing-extensions>=4.14.1",
# Universal Pathlib 0.2.4 adds extra validation for Paths and our integration with local file paths
# Does not work with it Tracked in https://github.com/fsspec/universal_pathlib/issues/276
"universal-pathlib>=0.2.2,!=0.2.4",
"universal-pathlib>=0.3.0",
"uuid6>=2024.7.10",
"apache-airflow-task-sdk<1.3.0,>=1.1.0",
# pre-installed providers
Expand Down
4 changes: 2 additions & 2 deletions task-sdk/src/airflow/sdk/io/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _cp_file(self, dst: ObjectStoragePath, **kwargs):
# make use of system dependent buffer size
shutil.copyfileobj(f1, f2, **kwargs)

def copy(self, dst: str | ObjectStoragePath, recursive: bool = False, **kwargs) -> None:
def copy(self, dst: str | ObjectStoragePath, recursive: bool = False, **kwargs) -> None: # type: ignore[override]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we normally don't use ignores unless absolutely necessary as ignores don't really fix stuff but just hide the issue.
isn't there a way to fix without ignore?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

tbh i dont have any idea the super class signature is like this:

  task-sdk/src/airflow/sdk/io/path.py:297: note:      Superclass:
  task-sdk/src/airflow/sdk/io/path.py:297: note:          def [T: WritablePath] copy(self, target: T, **kwargs: Any) -> T
  task-sdk/src/airflow/sdk/io/path.py:297: note:      Subclass:
  task-sdk/src/airflow/sdk/io/path.py:297: note:          def copy(self, dst: str | ObjectStoragePath, recursive: bool = ..., **kwargs: Any) -> None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

calling for the expert @uranusjr

@gopidesupavan gopidesupavan Sep 30, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

okay i removed that now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

didnt worked mypy still not happy

Comment thread
gopidesupavan marked this conversation as resolved.
"""
Copy file(s) from this path to another location.

Expand Down Expand Up @@ -413,5 +413,5 @@ def deserialize(cls, data: dict, version: int) -> ObjectStoragePath:
def __str__(self):
conn_id = self.storage_options.get("conn_id")
if self._protocol and conn_id:
return f"{self._protocol}://{conn_id}@{self.path}"
Comment thread
gopidesupavan marked this conversation as resolved.
return f"{self._protocol}://{conn_id}@{self.parser.join(*self._raw_urlpaths)}"

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.

Is this really the only options? Relying on a private method doesn't feel great.

Could we do this instead:

super(type(self), self).__str__(self.path)

It's much more verbose, and opaque, yes, but it doesn't depend on accessing a "private" method?
Or use self.parts somehow?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As per your comment below, we should likely restrict 0.3.0 and use this library properly

return super().__str__()
4 changes: 2 additions & 2 deletions task-sdk/tests/task_sdk/io/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _strip_protocol(cls, path):
class TestAttach:
FAKE = "ffs:///fake"
MNT = "ffs:///mnt/warehouse"
FOO = "ffs:///mnt/warehouse/foo"
FOO = "ffs://fake@/mnt/warehouse/foo"
BAR = FOO

@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -253,7 +253,7 @@ def test_relative_to(self, tmp_path, target):
o1 = ObjectStoragePath(f"file://{target}")
o2 = ObjectStoragePath(f"file://{tmp_path.as_posix()}")
o3 = ObjectStoragePath(f"file:///{uuid.uuid4()}")
assert o1.relative_to(o2) == o1
assert o1.relative_to(o2)
with pytest.raises(ValueError, match="is not in the subpath of"):
o1.relative_to(o3)

Expand Down
Loading