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

bug(python): fix path handling in windows #724

Merged
merged 8 commits into from
Dec 20, 2023

Conversation

changhiskhan
Copy link
Contributor

Use pathlib for local paths so that pathlib
can handle the correct separator on windows.

Closes #703

@sergiocorreia
Copy link

sergiocorreia commented Dec 20, 2023

I also found this related bug: #673 (comment) might be worth it to deal with both in the same PR

@@ -84,6 +85,18 @@ def fs_from_uri(uri: str) -> Tuple[pa_fs.FileSystem, str]:
return pa_fs.FileSystem.from_uri(uri)


def join_uri(base: Union[str, pathlib.Path], *parts: str) -> str:
"""
Join a URI with multiple parts, handling extra environment variables.
Copy link
Contributor

Choose a reason for hiding this comment

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

"extra environment variables"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops that was generated by copilot and I forgot to change it >_<

Copy link
Contributor

@wjones127 wjones127 left a comment

Choose a reason for hiding this comment

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

Is there a test we can write for windows to validate this?

@wjones127
Copy link
Contributor

Oh we don't even have a Windows CI job...

"""
Join a URI with multiple parts, handling extra environment variables.
"""
if isinstance(base, pathlib.Path):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add tests?

@wjones127
Copy link
Contributor

There seems to already be a test that fails on Windows due to path handling: https://github.com/lancedb/lancedb/actions/runs/7280056572/job/19837672999?pr=729

I have rebased your PR on my PR to add a Windows CI job.

wjones127 and others added 2 commits December 20, 2023 12:42
Use pathlib for local paths so that pathlib
can handle the correct separator on windows.

Closes #703
@changhiskhan changhiskhan force-pushed the changhiskhan/windows-path branch 2 times, most recently from a463488 to 86e2fab Compare December 20, 2023 23:09
@changhiskhan
Copy link
Contributor Author

I also found this related bug: #673 (comment) might be worth it to deal with both in the same PR

good catch. I added a condition so that if the uri scheme is one letter then just return the uri instead of the netloc + path or path. Lmk if this addresses the cases you've encountered on windows.

@changhiskhan changhiskhan merged commit 7bbb287 into main Dec 20, 2023
11 checks passed
@changhiskhan changhiskhan deleted the changhiskhan/windows-path branch December 20, 2023 23:41
raghavdixit99 pushed a commit to raghavdixit99/lancedb that referenced this pull request Apr 5, 2024
Use pathlib for local paths so that pathlib
can handle the correct separator on windows.

Closes lancedb#703

---------

Co-authored-by: Will Jones <willjones127@gmail.com>
westonpace pushed a commit that referenced this pull request Apr 5, 2024
Use pathlib for local paths so that pathlib
can handle the correct separator on windows.

Closes #703

---------

Co-authored-by: Will Jones <willjones127@gmail.com>
alexkohler pushed a commit to alexkohler/lancedb that referenced this pull request Apr 20, 2024
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 this pull request may close these issues.

Changes to dataset URI creation for LanceTable
4 participants