Conversation
Introduces MPCClient class with methods for all 10 MPC public APIs: identify, get_orbit, get_observations, get_observatory, get_mpecs, check_near_duplicates, get_submission_status, submit_xml/psv, request_action_code, and get_neocp_observations. Includes optional pandas DataFrame output, custom exception hierarchy, and 60 mocked tests. Updates all tutorial notebooks with mpc_api usage examples and adds a Getting Started notebook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each notebook opening markdown cell now mentions the mpc_api package as an alternative, with a link to the detailed examples lower in the same notebook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@federicaspoto : I've asked @fiftymillionfeltcapfanscantbewrong to review this PR, but I'm just flagging you on it so that you are aware of it (e.g. for newsletter/similar). |
mpc_api/tests/test_neocp.py
Outdated
| def test_get_neocp_observations_df(client): | ||
| responses.get( | ||
| NEOCP_URL, | ||
| json=[{ | ||
| "ADES_DF": [ | ||
| {"trksub": "P21Eetc", "obstime": "2025-02-10", "ra": 10.0, "dec": 20.0, "stn": "F51"}, | ||
| {"trksub": "P21Eetc", "obstime": "2025-02-11", "ra": 11.0, "dec": 21.0, "stn": "G96"}, | ||
| ] | ||
| }], | ||
| ) | ||
|
|
||
| df = client.get_neocp_observations_df("P21Eetc") | ||
| assert isinstance(df, pd.DataFrame) | ||
| assert len(df) == 2 |
There was a problem hiding this comment.
I haven't tested this, but in principle this should not work unless the tracklet is currently on the NEOCP. This doesn't seem to be the expected behavior though.
There was a problem hiding this comment.
I'm not quite sure what you mean here, but I suspect it is lack of clarify in the tests regarding what @responses.activate does (it mocks API responses).
As such, I have added more tests, and then split the tests into 3 main sections:
- tests that actually, for real, call the API (but are allowed to fail/skip if the API is unavailable)
- N.B. I'm allowing these to pass if the API is unavailable because it is not strictly the job of
mpc_apito be the api, and also, I don't want the CI to get screwed-up due to (e.g.) downtime inmpcweb6
- tests that mock the API response, so that we are purely testing this
mpc_api.MPCClient - tests that are independent of the API (such as error handling within
mpc_api)
I note that I have done the same for all of the various test files in tests/test_*.py, and added a bunch of comments to make clear what is going on.
…d tutorial notebook - Rename mpc_api/ to mpc-api/ and move source to src/ layout for packaging - Update pyproject.toml hatch build targets, add lxml to test deps - Update GitHub Actions workflows for new paths - Add real API tests to all test files with per-endpoint skip logic - Add shared check_api fixture in conftest.py for graceful API-unavailable skipping - Add updated mpc_tutorial_mpcapi.ipynb notebook with install cell and all API demos Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Publishes to TestPyPI on every PR that touches mpc-api/, with a unique .devN version suffix per run. Also supports manual dispatch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update release workflow to trigger on push to main (in addition to manual releases). Checks PyPI for the current version and skips publish if it already exists, so only version bumps cause a release. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
OK, @federicaspoto , @fiftymillionfeltcapfanscantbewrong , I have addressed the previous comments regarding I have also verified that the version currently released to I have clarified the README I have also added various
|
…rapped & added to mpc-api
…output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduces an mpc_api package that is intended to be a pip-installable package on PyPi.
mpc_apiprovides a singleMPCClientclass with methods for all 10 MPC public APIs:Includes optional pandas DataFrame output, custom exception hierarchy, and 60 mocked tests.
This PR also
I have verified that the code works and that the main demo notebook,
mpc_tutorial_mpcapi.ipynb, also works and provides simple-but-cogent explanations of the individual apis, as well as linking out to the tutorials & documentation for the APIs.NB: