Skip to content

Separate server endpoints into different routers #595

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

Open
wants to merge 70 commits into
base: main
Choose a base branch
from

Conversation

d-j-hatton
Copy link
Contributor

@d-j-hatton d-j-hatton commented May 21, 2025

This should allow a split between routers that the instrument server needs to access and those that the front end needs, allowing auth to be handled differently in the two cases.

Switched to using url_path_for method of the fastapi.APIRouter to construct the URLs from function names to allow easier renaming of URLs and prefixes.

UPDATE 2025/05/28:
It is not possible to use the url_path_for method for communication between the client and the backend, as that would require importing the instantiated APIRouter objects, leading to unnecessary dependency chains on the client side. Instead, a utility function was created to mimic the behaviour of url_path_for. This is facilitated by a route_manifest.yaml file that contains a dictionary of all currently defined endpoint functions, their corresponding URL paths, and the path parameters they expect.

A CLI has also been added to generate up-to-date route manifests for use. Future work will involve including the route manifest generation as part of the pre-commit hooks, and to push the up-to-date manifest to murfey-frontend.

The murfey.server.__init__ module has also been refactored to further minimise import chains. The server startup components are now in murfey.server.run, and the feedback callback and listening functions are now in murfey.server.feedback. murfey.server._transport_object has to be called directly for use in murfey.server.feedback so that the _transport_object used in the feedback callback mechanisms is correctly initialised as server startup progresses.

d-j-hatton added 26 commits May 9, 2025 13:29
Calls to all these endpoints still need to be addressed
Getting close to narrowing down to just the endpoints that require access from both the instrument server and frontend
…d between the instrument server and frontend
@d-j-hatton d-j-hatton requested a review from tieneupin May 21, 2025 10:19
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 41.86194% with 918 lines in your changes missing coverage. Please review.

Project coverage is 31.77%. Comparing base (f0ff051) to head (ba85127).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #595      +/-   ##
==========================================
+ Coverage   30.18%   31.77%   +1.59%     
==========================================
  Files          80       90      +10     
  Lines       10576    10700     +124     
  Branches     1409     1422      +13     
==========================================
+ Hits         3192     3400     +208     
+ Misses       7278     7187      -91     
- Partials      106      113       +7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tieneupin added 29 commits May 23, 2025 08:51
…'url_path_for()' function instead; this will keep server and client-side dependencies separate
…eedback' so that changes made to 'murfey.server._transport_object' upon startup carry over to the feedback functions, which are also imported and loaded upon startup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants