-
Notifications
You must be signed in to change notification settings - Fork 49
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
Drop in config #379
Drop in config #379
Conversation
@Conan-Kudo PTAL , haven't tested or anything yet |
469086b
to
adc34b2
Compare
Tests to fix |
ramalama/cli.py
Outdated
@@ -52,8 +52,63 @@ def add_argument(self, *args, help=None, default=None, **kwargs): | |||
super().add_argument(*args, **kwargs) | |||
|
|||
|
|||
def parse_config_file(file_path, config): |
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.
Lets move the config parsing to a separate file config.py?
Isn't there a standard toml parser written in Python that we can use?
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.
import tomllib
with open("/usr/share/containers/containers.conf", "rb") as f:
data = tomllib.load(f)
print(data)
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.
tomllib is available since 3.11, not available on all platforms (some go back as far as 3.9).
I'd recommend using |
The thing is, if we write a simple toml parser like below, which is easy to maintain. We don't necessarily have to worry about whether somebody has that python library available on platform X:
|
tomlkit is only in EPEL which isn't ideal. toml and tomli is in AppStream. But thinking outside of RHEL/Fedora I'd rather just write a small toml parser to cover macOS and other random Linux distros. |
f914dd5
to
1be6232
Compare
README.md
Outdated
@@ -15,7 +15,7 @@ Running in containers eliminates the need for users to configure the host system | |||
|
|||
RamaLama then pulls AI Models from model registries. Starting a chatbot or a rest API service from a simple single command. Models are treated similarly to how Podman and Docker treat container images. | |||
|
|||
When both Podman and Docker are installed, RamaLama defaults to Podman, The `RAMALAMA_CONTAINER_ENGINE=docker` environment variable can override this behavior. When neather are installed RamaLama will attempt to run the model with software on the local system. | |||
When both Podman and Docker are installed, RamaLama defaults to Podman, The `RAMALAMA_CONTAINER_ENGINE=docker` environment variable can override this behaviour. When neather are installed RamaLama will attempt to run the model with software on the local system. |
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.
Today I learned behavior vs behaviour is an US English vs UK English thing. The UK version for whatever reason is more prominent for this word in RamaLama. Can default to US English though if needs be.
3a24ae9
to
f044858
Compare
Will your patches work on Windows? We need to have multi-levels of defaults.
|
This will work using WSL2. There's a lot of things in RamaLama that won't work on Windows natively. For one, we use symlinks, which there isn't an exact equivalent for in Windows, although there are similar things.
SGTM |
Although. This seems funny to me:
I would expect this (/usr -> /etc -> $HOME):
|
We can leave out .d directories for now, probably overkill for a simple tool. |
f044858
to
c81dcab
Compare
For setting configs in a config file Signed-off-by: Eric Curtin <[email protected]>
c81dcab
to
0e6db50
Compare
I can delete... But it's already implemented, it's just 3 lines of code in the current implementation... Easy to remove though, just delete three lines:
|
We can merge and continue to iterate. I would want a ramalama.conf file shipped in /usr/share/ramalama/ramalama.conf with all options commented out and explained. Also needs ramalaman.5.md man page explaining how the configuration files work. Finally we need tests to make sure things like Should have a RAMALAMA_CONFIG environment variable that forces the tooling to only read one config file for testing purposes. |
For setting configs in a config file