-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use httpx for server connection, some restructuring and cleanup #30
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #30 +/- ##
==========================================
+ Coverage 99.02% 99.08% +0.05%
==========================================
Files 2 2
Lines 205 218 +13
==========================================
+ Hits 203 216 +13
Misses 2 2
☔ View full report in Codecov by Sentry. |
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.
While these changes themselves are fine, we should first determine what path we want to take with skycalc_ipy
. The change of ETC server bit us unexpectedly, and it was entirely our own fault. The changes in this PR can make it both easier and harder to prevent similar problems in the future, depending on our plan.
We based skycalc_ipy
on skycalc-cli
1.1. Then ESO changed the server, and the units, in 1.2 year ago. skycalc-cli
is at 1.4 now, without us even checking what changed, let alone incorporating those changes in skycalc_ipy
.
I see three ways of keeping skycalc_ipy
in sync with skycalc-cli
:
- Keep our codebase entirely separate and manually make sure it is in sync with ESO's code. Merging this PR would make comparing against ESO's code harder because the code bases will have diverged.
- Use
skycalc-cli
as a dependency ofskycalc_ipy
, but only for things like using the correct URL. This PR would makes sense, because the codebases would be decoupled. - Use
skycalc-cli
as a dependency and makeskycalc_ipy
a very thin wrapper around existing functionality in ESO's code. Then this PR would probably not be necessary as most of the code in this project would hopefully be unnecessary.
My personal preference is the last option: making skycalc_ipy
a thin wrapper around skycalc-cli
; however, I'm not sure whether that is feasible. If not, then I'd prefer the middle option to at least have the URL correct, and we should merge this. The first option is what we do now, and if that is indeed our plan, then we might be better of not merging this.
So for me it would only be possible to advice on whether to merge this if we know what our long term plan is.
The parameters were cached because without them it is impossible to tell which FITS files are which. Say you have cached too many requests and want to prune the ones you don't care about anymore, then you could use the cached json files to determine which queries you are no longer interested in anymore. On the one hand I'd prefer it if the JSON files are kept in the cache. On the other hand, I have not ever performed such pruning as described above, so maybe it doesn't really matter. Maybe the parameters are also included in the FITS files somehow though, then it would be better to just use those. |
Is |
The source package can be downloaded from PyPI: https://pypi.org/project/skycalc-cli/ , it seems to be MIT licensed. I haven't looked closely at the source, only to verify the new URL. So I don't know how close it is to our source code, or how extendable it is, or anything really. |
Just checked, they are, under |
I had a quick look at the source code of That whole Extracting the server URL from Another motivation for these changes was the way I don't have a perfect answer to this whole situation either. Let's keep this PR on hold for the moment, it's not really hindering anything else, nor are we likely to make any changes elsewhere that would conflict with this, so there's no hurry. |
Thanks for checking the skycalc-cli code. I'm now in favor of merging this and breaking away from skycalc-cli, because
So we will just have to live with it that we might need to update it occasionally. Luckily we have nightly tests to catch problems. We don't have to merge it now, but on the other hand, I'm not sure what we would be waiting for. |
Migrate the whole package from
requests
tohttpx
, which nicely fits the kind of web requests we're doing here and is easily expandable, should we ever need more advanced functionality.Additionally, the location of the cached files is changed to something more reasonable than inside the package directory (still supports scopesim_data and an environ variable). Dropped caching of parameter JSON file, I don't think this was used anywhere at all. General working principle of the cache (hash of input parameter combination) is unchanged.
In the course of that, I also changed some other things:
pathlib.Path
instead ofos.path
, also in the testscore
to inherit from, related to common request operations.call()
method before...Several aspects of this still need some attention, but it's a big step forward. I also bumped the development version number in the pyproject.toml file, because the structure changed significantly enough that this should be a minor version increase once we release it...