Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support joining in CloudPath construction #103

Open
jayqi opened this issue Nov 7, 2020 · 3 comments
Open

Support joining in CloudPath construction #103

jayqi opened this issue Nov 7, 2020 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jayqi
Copy link
Member

jayqi commented Nov 7, 2020

The constructor signature of pathlib's path classes is actually:

class pathlib.PurePath(*pathsegments)

with behavior that follows os.path.join's behavior.

https://docs.python.org/3/library/pathlib.html#pathlib.PurePath

Is this something we should support? It adds some complexity, because we'd have to decide what to do or how to error with multiple URI schemes or if people use a root slash. (Some of the behavior from pathlib/os.path.join is kind of confusing.)

It would also make an AnyPath (#77) more faithful when dispatching to pathlib.

@jayqi jayqi added the enhancement New feature or request label Mar 8, 2021
@pjbull pjbull added the good first issue Good for newcomers label Mar 2, 2022
@rmharrison
Copy link

Reproducible example...

# cloudpathlib[gs]==0.16.0
>>> from cloudpathlib import AnyPath
>>> AnyPath('gs://my-bucket', 'my-filename.txt')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ppa-rmh358/.local/lib/python3.10/site-packages/cloudpathlib/anypath.py", line 22, in __new__
    return CloudPath(*args, **kwargs)  # type: ignore
  File "/home/ppa-rmh358/.local/lib/python3.10/site-packages/cloudpathlib/cloudpath.py", line 159, in __call__
    path_class.__init__(new_obj, cloud_path, *args, **kwargs)  # type: ignore[type-var]
  File "/home/ppa-rmh358/.local/lib/python3.10/site-packages/cloudpathlib/cloudpath.py", line 232, in __init__
    raise ClientMismatchError(
cloudpathlib.exceptions.ClientMismatchError: Client of type [<class 'str'>] is not valid for cloud path of type [<class 'cloudpathlib.gs.gspath.GSPath'>]; must be instance of [<class 'cloudpathlib.gs.gsclient.GSClient'>], or None to use default client for this cloud path class.

@pjbull
Copy link
Member

pjbull commented Dec 10, 2023

This is implemented for CloudPath as part of #322

This should go in when that PR does.

@noamgot
Copy link

noamgot commented Jun 19, 2024

@pjbull any progress with this one? Would love to use it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants