Closed justindujardin closed 10 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
90eb026
) 99.91% compared to head (fc85a5c
) 99.91%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:tada: This PR is included in version 0.11.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
The circle of life is beautiful. Python 3.7 has reached its end, and Python 3.12 rises to carry on its name.
Motivation Pathy has relied on the internals of pathlib.Path to support complex things like glob matching and the differences between Windows and Posix paths. Because of this when the python developers rightly refactor their internals, Pathy breaks. π
We need to stop depending on the internals of pathlib to avoid the yearly "new version of python breakage". It was on my list to inline the parts of pathlib needed and call it good, but then the absolute legend @barneygale published a pypi package pathlib_abc that's synced from CPython and implements the logic we depended on inside of pathlib.
Now, we can have a proper public API to work from and not lose sleep every time a new version of Python is released. π
This PR updates Pathy to use pathlib_abc and supports Python 3.12 while deprecating Python 3.7, which reached end-of-life in the middle of last year.
Changes
pathlib.Path
withpathlib_abc.BasePath
Breaking Changes
Pathy
no longer inherits frompathlib.Path
changing type checks looking at a Pathy comparing it for pathlib.Path. This is better overall but could break user code in rare cases.Pathy
no longer raises a ValueError when given an invalid bucket path. It's unclear how to cleanly differentiate file system paths from chunks of paths used for constructing bucket paths, except in the absolute path case.Pathy
no longer automatically collapses relative paths. BeforePathy('gs://bucket/foo/../bar')
would automatically becomePathy('gs://bucket/bar')
. Now you have to useresolve()
to get the same outputPathy('gs://bucket/foo/../bar').resolve()