Skip to content

ProxyUPath._copy_from function signature incorrect #546

@jpweytjens

Description

@jpweytjens

Description

ProxyUPath._copy_from() has a fixed signature that only accepts follow_symlinks, but newer versions of fsspec pass additional keyword arguments like preserve_metadata. This causes a TypeError when using move() or copy() with a ProxyUPath subclass as the destination.

MWE

from upath import UPath
from upath.extensions import ProxyUPath

class MyProxyPath(ProxyUPath):
    def __init__(self, path):
        self._lazy = UPath(path)

    @property
    def __wrapped__(self):
        return self._lazy

    @classmethod
    def _from_upath(cls, upath, /):
        obj = object.__new__(cls)
        obj._lazy = upath
        return obj

# Local file to S3 (or any cross-filesystem move)
source = UPath("/tmp/test.txt")
source.write_text("hello")

destination = MyProxyPath("s3://my-bucket/test.txt")
source.move(destination)  # TypeError: ProxyUPath._copy_from() got an unexpected keyword argument 'preserve_metadata'

Expected Behavior

_copy_from() should forward all kwargs to the wrapped UPath:

def _copy_from(
    self, source: ReadablePath | Self, follow_symlinks: bool = True, **kwargs
) -> None:
    self.__wrapped__._copy_from(source, follow_symlinks=follow_symlinks, **kwargs)

Environment

Python: 3.14
universal-pathlib: 0.3.9
fsspec: 2026.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions