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

Fix Absolute Paths (Windows/Unix) #95

Merged
merged 15 commits into from
Nov 22, 2022
Merged

Fix Absolute Paths (Windows/Unix) #95

merged 15 commits into from
Nov 22, 2022

Conversation

justindujardin
Copy link
Owner

@justindujardin justindujardin commented Nov 19, 2022

 - change the default of last_modified to None instead of -1. This is because last_modified is defined as an optional int, so None is the proper default.
 - windows doesn't implement owner() in pathlib, so catch the error and return None like other corner-cases
 - the unerlying abspath() call on windows resolves with \\ slashes, which we don't want when referring to bucket paths. BasePath (pathlib.Path) variants don't do this translation to preserve the os-specific slashes.
 - this addresses concerns around initializing Pathy paths with unix and windows absolute paths. The correct way to initialize these paths is to use Pathy.fluid.
 - raise an error if an absolute system path is given when initializing Pathy objects
 - fixes #87

BREAKING CHANGE: Previously Pathy would allow you to initialize Pathy instances with absolute system paths (unix and windows). Now Pathy raises a ValueError if given an absolute system path that suggest using Pathy.fluid instead.
 - verify some path shenanigans with Windows are working as expected
@codecov
Copy link

codecov bot commented Nov 19, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (674a109) compared to base (2791565).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #95   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines         1105      1125   +20     
=========================================
+ Hits          1105      1125   +20     
Impacted Files Coverage Δ
pathy/__init__.py 100.00% <100.00%> (ø)
pathy/about.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

 - the github runner doesn't like the rmdir arguments 🤷
@justindujardin justindujardin changed the title Fix/windows paths Fix Absolute Paths (Windows/Unix) Nov 19, 2022
 - on Windows Pathy normally only deals with bucket formats using / slashes, but when using the file:/// scheme you would have a Pathy object that contains \\ separators to represent a windows file path. In this case, convert the separator to \\ while formatting strings.
@justindujardin justindujardin merged commit ba5b5b3 into master Nov 22, 2022
@justindujardin justindujardin deleted the fix/windows-paths branch November 22, 2022 18:52
@github-actions
Copy link

🎉 This PR is included in version 0.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

How to use local Unix paths with Pathy Support forward slash separated paths on Windows
1 participant