-
Notifications
You must be signed in to change notification settings - Fork 9
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
David/use dependency injection #168
David/use dependency injection #168
Conversation
Specify namespace to avoid race condition Add print to identify why GH action failing but local passing Add further ref data (SKOS + SDO HTTPS version) update GH actions; add init.py for tests add oxrdflib depedency QuerySender -> Repo Use Fastapi's dependency injection to allow switchable backends Add caching specifically to link generation
@edmondchuc I've changed the target |
Perfect thanks, I'll take a look at it now! |
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.
I think the PR is fine for now as it addresses the immediate issues with the way we run tests. Nice work! 🎉 I can see that the tests run around 4 times faster, which is a nice bonus.
A follow-up to improve the structure of the codebase for long-term maintenance can look something like this:
/
├── repositories/
│ ├── __init__.py
│ ├── remote_sparql.py
│ ├── pyoxigraph.py
│ └── oxrdflib.py
├── services/
│ ├── __init__.py
│ ├── object.py
│ ├── listing.py
│ └── etc...
└── routers/
├── __init__.py
├── object.py
├── listing.py
├── sparql.py
├── vocprez.py
├── catprez.py
└── spaceprez.py
- Repositories are the interfaces to the data store.
- Services are the business logic for each of facets of functionality within Prez. They only contain business logic and interact with the data store through a repository object.
- Routers are the API endpoints of Prez. They are the entrypoints to each facet of business logic of Prez and only deal with the HTTP layer. The service and repo objects are injected via FastAPI's DI.
I think by having these three layers at a minimum will allow us all to conceptually understand Prez and its implementation details a bit clearer.
Anyway, I think this can probably be followed up in a separate PR as it's more maintenance-related. If you agree with the above's proposed structure, I can create an issue and reference this PR's comment.
@edmondchuc Thanks for the layout feedback - I've known it needs a refactor for some time but haven't looked at any reference implementations so that will be helpful, would be good to add to the wiki/documentation if it's online now |
reformat with black
@recalcitrantsupplant - great! Good idea with adding the design patterns into the wiki. |
bde711b
into
david/annotations-endpoint-catprez-endpoints
See last commit only, others are from other open PR.