WIP: Move astropy.samp to PyVO#239
Conversation
[PATCH] use f-strings Co-authored-by: ikkamens <ikkamens@amazon.com>
[PATCH] BUG: Fix missing server_close method on SAMPHubProxy It's possible this bug has existed for a long time and was just hidden. Another possibility is it appeared at some point during refactoring, but as far as I can tell it's been around a long time. The attribute is still just a ; it does not make sense for it to have a method because it does not itself run or wrap a server. It does however manage a pool of XML-RPC client connections which is deleted when calling . To be on the safe side I added a method to the proxy pool class which closes the client connections. This is called when shutting down the server loop. Unlike the normal class, the used only in tests never runs a TCP server of its own, so calling anywhere in here does not make sense. Co-authored-by: E. Madison Bray <erik.bray@lri.fr>
[PATCH] typo in docstring Co-authored-by: E. Madison Bray <erik.bray@lri.fr>
Codecov Report
@@ Coverage Diff @@
## master #239 +/- ##
==========================================
+ Coverage 74.83% 75.39% +0.56%
==========================================
Files 43 55 +12
Lines 5035 6678 +1643
==========================================
+ Hits 3768 5035 +1267
- Misses 1267 1643 +376
Continue to review full report at Codecov.
|
pllim
left a comment
There was a problem hiding this comment.
I never used SAMP before, so you should really test this branch out during review.
Can probably ignore the coverage complains. Adding new tests is out of scope of this PR.
Would be nice if we can get this in and if you plan on a release before astropy 4.3, so we can go ahead and deprecate astropy.samp for 4.3 (feature freeze on 2021-04-23).
| SAFE_MTYPES = ["samp.app.*", "samp.msg.progress", "table.*", "image.*", | ||
| "coord.*", "spectrum.*", "bibcode.*", "voresource.*"] | ||
|
|
||
| with open(get_pkg_data_filename('data/astropy_icon.png'), 'rb') as f: |
There was a problem hiding this comment.
If there is some pyvo icon you want to replace this with, let me know.
| import sys | ||
| import argparse | ||
|
|
||
| from astropy import log |
There was a problem hiding this comment.
If you want to replace this with your own logger, please give some advice on how to do it properly.
| # TODO: Currently defines astropy version from which this is copied over. | ||
| # PyVO should define a new versioning scheme for this module. | ||
| parser = argparse.ArgumentParser(prog="samp_hub 4.2") |
There was a problem hiding this comment.
Also let me know how you want to track its version. It was using astropy.__version__ but I changed it to 4.2. If I use pyvo.__version__, it will be too confusing because pyvo still at 1.x.
| from urllib.parse import urlparse | ||
| import xmlrpc.client as xmlrpc | ||
|
|
||
| from astropy.config.paths import _find_home |
There was a problem hiding this comment.
This uses a "hidden" function in astropy. Please let me know if you have a better alternative.
| def _ipython_key_completions_ | ||
|
|
||
| [entry_points] | ||
| samp_hub = pyvo.astropy_samp.hub_script:hub_script |
There was a problem hiding this comment.
I am not sure how confusing this CLI will get since astropy and pyvo will have this same command until we manage to remove the code from astropy in a future release (it needs a deprecation period over there).
|
Note to self:
|
[PATCH] Fixes #11407: Makes two additional fixes to the test SAMPWebClient: * Its server loop (for accepting calls from the Hub) should block until the client has actually registered with the hub (rather than busy waiting) * More importantly, there needs to be a lock associated with whether or not the client is registered. The lock does not need to be held by SAMPWebClient.register because the _server_thread blocks until the _registered_event is set. However, SAMPWebClient.unregister does need to hold the lock to ensure it does not unregister the client when it is about to perform a pullCallbacks request to the hub. Co-authored-by: E. Madison Bray <erik.bray@lri.fr>
|
Closing this to get a fresh start with many thanks to @pllim for this work and the notes it generated. |
|
Thanks for taking this over! |
Fix #155 .
This is the first step towards astropy/astropy#9763 . cc @astrofrog
TODO
Need to wait for PyVO to drop Python 3.5 first.MNT: Bump Python minversion #255setup_package.py.Notes
pyvo.sampbecause you already havesamp.py. I don't know how it overlaps withastropy.samp.astropy.sampusedastropy.__version__, this needs to change now. Needs discussion.astropy.configsystem. I don't think we can change it for the sake of backward compatibility.astropy.logfor logging. If PyVO has its own logging, it can be replaced.astropy.config.path._find_home. If you have a better replacement, please let me know.astropymoved away from a lot of theastropy_helperssetup stuff. I tried to move them back here (e.g.,setup_package.py) since you have not implemented APE 17 yet. Need extra pairs of eyes to make sure I didn't mess things up.astropy.sampwith new import.Disclaimer: I don't maintain
astropy.samp, Tom Robitaille does.