-
Notifications
You must be signed in to change notification settings - Fork 123
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
Bring code coverage back up to 93-94% #331
Comments
We should also update the coverage badge link the main readme to point to the |
We would definitely appreciate the help on this! One thing we may want to consider is whether we want to include testing of methods like |
I feel a bit like something's wrong if none of the tests end up exercising these - usually that means they aren't needed and should be removed. But you can make a call on that once we get closer to 100%. In a separate project we've ended up with the following excludes:
|
That's a good point. If they're important enough to add we should probably test them 😄 . We can see how it shakes out as we get closer. |
@l0b0 If you're okay with it, I'll assign this issue to you. |
I've got started on this work, and as usual when doing something like this, questions about the rationale behind any unusual code comes up. I noticed a bunch of the classes have custom def __repr__(self) -> str:
return "<ItemSarExtension Item id={}>".format(self.item.id) Based on the implementation above, In addition, I could only find a single place where I'll just skip adding coverage for |
Another question: Why is the orjson package optional? Presumably anyone using pystac will have to install some packages which are required, so why not make orjson mandatory and simplify the implementation, or revert to using the core json module? Ping @duckontheweb? |
However, when no wheel is available (e.g. for |
Re: whether we should remove custom @lossyrob and others who have been involved in the project for longer may be able to provide more context on this, but I think the intention was to provide simple representation of STAC objects that could be used to eyeball the items returned by something like If we do want to take one of the 2 approaches detailed in the original issue, I would lean towards making it unique based on the STAC object properties. Providing enough information to completely reconstruct the object might be overwhelming given how complex STAC objects can be. We may also want to align our definition of "uniqueness" here with the outcome of the discussion in #380 on defining equality of STAC objects. |
I wouldn't want to introduce Rust nightly into the pipeline, but Python 3.10 is not stable yet though. Isn't it reasonable to expect orjson to be available for 3.10 shortly after that? That is, could we make orjson required and not test on 3.10 until it's available there? |
I thought that might be the case, but I don't know how useful that is in practice. I've not worked on any other projects where overriding
Agreed. |
Yeah, I agree that support for Python 3.10 should be experimental until that version has stabilized. I was mostly using that as a concrete example, but there might be other cases in which a wheel is either not available or not appropriate. I have had experiences working with I think we should open a separate issue for this to give it some more targeted attention and allow other users/contributors to weigh in on whether they have examples of needing to build from a source distribution. If not, I would be fine with making it a regular dependency. |
What if someone doesn't want orjson, and instead uses ujson? PySTAC has explicitly tried to keep any non-essential dependencies out of the library. The ones that have snuck through are That said, taking advantage of libraries that are there for things like performance speedups is also beneficial, and I don't think costs us much complexity. JSON reading is so core to PySTAC that I don't imaging there would be many things like this. But reverting to just using stdlib json in systems that are using orjson would slow things down considerably, and the speedup is worth the complexity of the conditional. One might ask, why not implement a ujson code path as well then? I think if someone had that specific use case and made a PR to add similar functionality with ujson, I'd likely be in favor. Perhaps we'd want to consider refactoring a bit to make things cleaner with two implementations, but if it doesn't add an explicit dependency, doesn't add too much complexity, and is valuable to our userbase, that would be a good change. |
The availability issue at least should already be solved by the pipelines running on all supported platforms and Python versions. But as you both point out it might not be appropriate to require a less widely available and more complex library. We should probably make sure the pipeline runs all tests both with and without orjson though (maybe install requirements-test.txt except orjson first, then install the whole dependency list?). #475 |
@l0b0 Whenever you feel like the test coverage has stabilized in the 93-94% range we can close this and open more specific issues to address other gaps in coverage. Thanks so much for your work on this! It can be really thankless behind-the-scenes work to focus on test coverage and typing issues, but it's really important in creating a stable reliable code base. We really appreciate it! |
Thank you as well! The constructive feedback has been great, especially the way you've all let me know gently when I've misunderstood some intent. Sounds good to me, by the way. I'm happy to jump to a different issue to bring coverage up to 100%. I already filed a few issues discovered so far, and there's probably going to be some more interesting discussions before we get there. By the way, Toitū Te Whenua LINZ is really keen to simplify metadata handling by moving to STAC, and pystac is probably going to be instrumental for that work. Disclaimer: All that jazz about not representing my employer, etc :) Have a good weekend! |
Awesome! I'll close this out, thanks again! |
The changes in #309 will cause the code coverage to dip to 88-89%. This issue is to ensure we bring back coverage to the 93-94% range for the PySTAC 1.0 release.
The text was updated successfully, but these errors were encountered: