-
Notifications
You must be signed in to change notification settings - Fork 2
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
Global and User config, CLI config #72
Conversation
Pull Request Test Coverage Report for Build 12246079711Details
💛 - Coveralls |
d7f6b4c
to
c007722
Compare
thoughts on this? i am finding myself wanting to use some of these fixtures in #76 |
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.
Looks very helpful! I was always confused around this.
* in the arguments passed to the class constructor (not user configurable) | ||
* in environment variables like `export MINISCOPE_IO_LOG_DIR=~/` | ||
* in a `.env` file in the working directory | ||
* in a `mio_config.yaml` file in the working directory | ||
* in the `tool.miniscope_io.config` table in a `pyproject.toml` file in the working directory | ||
* in a user `mio_config.yaml` file in the user directory (see [below](user-directory)) | ||
* in the global `mio_config.yaml` file in the platform-specific data directory | ||
(use `mio config global path` to find its location) | ||
* the default values in the {class}`~miniscope_io.models.config.Config` model |
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.
Yes, making this explicit helps a lot.
Implement setting values from CLI. | ||
|
||
For now, please edit the configuration files directly. |
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.
It is also related to my comments in #76, but I'm not sure which is easier between these two (though it wouldn't hurt to have these two work nicely). I feel that using text editors could be easier than using CLI for our target users (~undefined), but I am unsure.
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.
totally ya. after seeing you working with the cli setting config values i think that would be really nice to have, and that should also edit the relevant files, so they should be made to be equivalent imo if we do set config values from the cli - i.e. editing from cli should change the value in the config files as if one were to edit it with a text editor
""" | ||
CLI commands for configuration | ||
""" |
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.
This looks very helpful.
well i sorta merged these backwards and made this much harder for myself.... my bad |
I think that having a separate |
b05fb6f
to
59030f7
Compare
…el, since that means that when merging configs from multiple sources we end up taking default values from higher priority sources when unset
Had to change some minor behavior here - now we no longer explicitly propagate log levels down from the base also updated the test for setting log levels from being just via |
added some tests and we should be good to go |
This PR ports some stuff i have worked on in linkml over to miniscope-io.
Specifically we
user_dir
source of config - currently there is a place to setbase_dir
but no way to get config from that directory, but now one can define global config there too..env
file, but this adds the ability to use (in order of priority, high to low)...mio_config.yaml
in current directorypyproject.toml
- the[tool.miniscope_io.config]
tablemio_config.yaml
in a custom user directorymio_config.yaml
in a fixed global directoryThis also improves testing for configs, making fixtures to set each of the types of settings sources.
I know i have been like maniacal about config on this project, but i swear it's not just a pointless yak shave: as i said before, configuration is going to be the main point of interaction that people have with
miniscope-io
since it's an SDK not a full-blown GUI app, it might get bundled in with other programs, and it's the way that we're exposing as how to control the operation of the program (somewhat tautologically...). So it needs to be tight and evolvable.This sets us up to make the configuration of devices more straightforward, where we might have something like
mio device {device_type} create
to create a default configuration for that device into{user_dir}/devices
so that they can then customize it. being able to have flexible configuration from the system level down to individual projects (i.e. global config vs. the directory-specific configs) then we make it possible to bundle device configs along with experimental data, so one could just cd to a different directory and automatically use the configs for the project in that directory.📚 Documentation preview 📚: https://miniscope-io--72.org.readthedocs.build/en/72/