-
Notifications
You must be signed in to change notification settings - Fork 121
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
Accept path-like HREF arguments in I/O methods #728
Accept path-like HREF arguments in I/O methods #728
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues from me.
Only minor comment is that Union[str, "os.PathLike[AnyStr]"]
ends up everywhere and is a lot to parse for a casual reader, is it worth type aliasing that to Href
or something?
Yeah, I agree that's pretty hard to interpret. Maybe we should have a |
Looks good to me to. I vaguely recall a discussion around whether |
b510828
to
cb60f2e
Compare
I created a @l0b0 Do you have any thoughts on the approach of storing type aliases in a single module? |
400d1c6
to
b3ac17d
Compare
b3ac17d
to
39e5802
Compare
I'd treat that the same as utility functions, and refer to my answer to Is putting general-use functions in a "helpers" file an anti-pattern or code smell? 😁 |
Thanks. It does feel like overkill to create a separate |
39e5802
to
dcdadbc
Compare
Codecov Report
@@ Coverage Diff @@
## main #728 /- ##
==========================================
Coverage 94.33% 94.39% 0.05%
==========================================
Files 77 77
Lines 11285 11292 7
Branches 1347 1343 -4
==========================================
Hits 10646 10659 13
Misses 459 455 -4
Partials 180 178 -2
Continue to review full report at Codecov.
|
3e9da85
to
48f77ba
Compare
Related Issue(s):
Description:
Implements the
os.PathLike
interface forpystac.Link
objects. This implementation always returns astr
representation (neverbytes
). See PEP 519 for details on the file system path protocol.Updates the package-level
pystac.read_file
&pystac.write_file
methods to acceptos.PathLike
objects for their HREF arguments in addition to strings.Updates the
StacIO
I/O methods to acceptos.PathLike
objects for their HREF arguments.This represents a breaking change in terms of typing since users who are creating custom
StacIO
classes will need to update the type hints in these methods as well. However, this is not a breaking change in terms of runtime behavior, so I am inclined to include it in a minor version release.@TomAugspurger I'd like to get your feedback on the overall approach, the idea of implementing
os.PathLike
for Links, and whether we should go farther and acceptos.PathLike
objects in more methods that work with HREFs (e.g.Catalog.save
, etc.).PR Checklist:
pre-commit run --all-files
)scripts/test
)