-
Notifications
You must be signed in to change notification settings - Fork 15
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
Flat and understandable API design #1846
Comments
Copying some thoughts from the discussion on #1840. I think we have two sort-of APIs.
NB. The importance of (2) is to break unnecessary connections between modules that should be encapsulated, which reduces the chance of circular dependencies. |
I think I broadly agree and I'm coming around to the benefits of following this fairly strictly. The CLI structure can (and should, because it that's how Typer works) reflect the For no. 2 I think there may be a point where it makes sense to collect things based on a higher level structure. Just want to be careful we don't take it to a nonsensical extreme (all classes are instances of |
In the case of
then
which creates the circular dependency. The solution there might be that the abstract classes really belong in a different module/package to the concrete classes. |
Perhaps like
|
It's worse than that: The inheritance structure is:
but we can't currently separate out I think I can make this work with all of the above in a The easiest way around this is to keep all the classes listed above in one module |
Except from or including |
Closed by #1848 |
Is this actually completed @JimMadge ? |
I think enough for now. Command line notwithstanding, but there is another issue for that. |
From discussion #1840 (comment)
Blog post with some good, clear rules.
We should aim for a structure which is flat, and "readable".
For example, the
utility
package currently exposes a mix of objects of different kinds and purposes. It isn't necessarily clear what you are importing,from data_safe_haven.utility import Guid
vsfrom data_safe_haven.annotated_types import Guid
.This isn't as important for us as it would be for a library. However, getting this right should mean we break the API less often which is good for developers.
The text was updated successfully, but these errors were encountered: