You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@RJCD-Diamond what complexities have you encountered in from_config? That is meant to be the easy path because it's type hinted, so your IDE should tell you what config is needed, what the field names are, which ones are strings, ints, etc. You'd lose all of that if you pass in a dict.
Please advise if there is a more straightforward way of doing it from a config? But if not, would be good to have a oneliner BlueapiClient.from_yaml(PATHTOYAML) Yes somewhat related to #402
If you want to pull it from the same YAML file you use for the terminal then yes, I agree, we should have a from_yaml function or similar. The following is a slightly more flexible compromise too:
There is now a from_config_file(str|Path) method to create a client. With upcoming changes (#1395) may also soon be a for_url method that doesn't require config.
Activity
callumforrester commentedon May 29, 2025
@RJCD-Diamond what complexities have you encountered in
from_config? That is meant to be the easy path because it's type hinted, so your IDE should tell you what config is needed, what the field names are, which ones are strings, ints, etc. You'd lose all of that if you pass in a dict.Also possibly related to #402
RJCD-Diamond commentedon Jun 2, 2025
@callumforrester
The way I am using BlueapiClient.from_config() requires the following lines:
blueapi_config_path = Path(PATHTOCONFIGYAML)config_loader = ConfigLoader(ApplicationConfig)config_loader.use_values_from_yaml(blueapi_config_path)loaded_config = config_loader.load()client = BlueapiClient.from_config(loaded_config)Please advise if there is a more straightforward way of doing it from a config? But if not, would be good to have a oneliner BlueapiClient.from_yaml(PATHTOYAML) Yes somewhat related to #402
callumforrester commentedon Jun 4, 2025
@RJCD-Diamond Ah I see, you already have YAML config, I was imagining something like
If you want to pull it from the same YAML file you use for the terminal then yes, I agree, we should have a
from_yamlfunction or similar. The following is a slightly more flexible compromise too:tpoliaw commentedon Feb 23, 2026
There is now a
from_config_file(str|Path)method to create a client. With upcoming changes (#1395) may also soon be afor_urlmethod that doesn't require config.