Accepted
In the long term we envision the clan application will consist of the following user facing tools in the long term.
CLITUIDesktop ApplicationREST-APIMobile ApplicationWe might not be sure whether all of those will exist but the architecture should be generic such that those are possible without major changes of the underlying system.
This leads to the conclusion that we should do library centric development.
With the current clan python code being a library that can be imported to create various tools ontop of it.
All CLI or UI related parts should be moved out of the main library.
Imagine roughly the following architecture:
With this very simple design it is ensured that all the basic features remain stable across all frontends. In the end it is straight forward to create python library function calls in a testing framework to ensure that kind of stability.
Integration tests and smaller unit-tests should both be utilized to ensure the stability of the library.
Note: Library function don't have to be json-serializable in general.
Persistence includes but is not limited to: creating git commits, writing to inventory.json, reading and writing vars, and interacting with persisted data in general.
Not all required details that need to change over time are possible to be pointed out ahead of time. The goal of this document is to create a common understanding for how we like our project to be structured. Any future commits should contribute to this goal.
Some ideas what might be needed to change:
clan_cli package to clan and move the cli frontend into a subfolder or a separate package.clan python library.__init__.py should be very minimal. Only init the business logic models and resources. Note that all __init__.py files all the way up in the module tree are always executed as part of the python module import logic and thus should be as small as possible.
i.e. from clan_cli.vars.generators import ... executes both clan_cli/__init__.py and clan_cli/vars/__init__.py if any of those exist.api folder doesn't make sense since the python library clan is the api.json-adapter folder or package.service or to update/read/delete some information from it.