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 file: ? #401

Closed
pprados opened this issue Feb 13, 2024 · 3 comments · Fixed by #404
Closed

Support file: ? #401

pprados opened this issue Feb 13, 2024 · 3 comments · Fixed by #404

Comments

@pprados
Copy link

pprados commented Feb 13, 2024

It's sympathic to use cloudpathlib with url file:.

@pjbull
Copy link
Member

pjbull commented Feb 14, 2024

I'd be open to at least a simple shortcut implementation that assumes anything after file:// you can hand off to pathlib.

One question is: if you start with a file URI, do you want a file URI back from all of the methods or is a Path object enough (and consumers can call the Path.as_uri() method if they need to)?

Here's a way to go to a Path from a file that is reported as generally working.
python/cpython#91504 (comment)

That said, to my eye there do seem to be some idiosyncrasies about the specification for file URIs that may break. See: https://en.wikipedia.org/wiki/File_URI_scheme

Resources:

@pprados
Copy link
Author

pprados commented Feb 16, 2024

The idea is, with an environment variable only, I can choose the URL.
file: for test, s3: or other for real files. So, the entire API of cloudpathlib must be implemented, with .read_text() etc.
The same code must be run.

@pjbull
Copy link
Member

pjbull commented Feb 26, 2024

@pprados, you can now use file: with AnyPath in the latest version of cloudpathlib on PyPI (0.18.0). See the docs here:
https://cloudpathlib.drivendata.org/stable/anypath-polymorphism/#file-uri-scheme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants