beetbox / beetbox/confuse

Question about views

Open
#62 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
424
Forks
57
PR merge metrics
No merged PRs in 30d

Description

I am not sure I fully understand the concept of views and combining them. Here is my use case:

I am creating a `config` using this code and yaml file:
````
config = LazyConfig('qti-scoring-engine', "app")
````
Here is an example of the config in the yaml:
```
uvicorn:
host: 127.0.0.1
port: 8080
workers: 1
```

Then augmenting it with the arguments:
```
config.set_args(args, dots=True)
```

the arguments I am passing are
```
parser.add_argument('--uvicorn.host', help='a host', required=False)
parser.add_argument('--uvicorn.port', help='a port', type=int, required=False)
```

When I then look up the configuration using the below line it returns only the entries from the second view created by the `config.set_args`:

```
config['uvicorn'].get()
```

How could I get all the values returned by merging both views?

When I examine the config in the debugger it has two views, and `config.flatten()` returns the properly merged configuration.

Any help is very much appreciated.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the LazyConfig, set_args, __getitem__, get, and flatten entry points mentioned in the issue, then trace how each view is resolved. Compare the lookup result with flatten() and identify the intended merged-view behavior; done means the documented lookup returns the expected combined values, with coverage for the uvicorn example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.