Comments (3)
Hey Thomas,
Thanks for the idea, only issue is that I am having a hard time following what you really want. (My brain is scrambled between what you mean between attribute / value / configuration file.)
Could you provide a simplified code example of what you have to do now and how you would like it to behave?
Much appreciated!
from box.
Ok, I'll try to explain it a bit better. I hope that I can do that, I'm not English native. :)
First I try initialize a new Box instance by getting - lets say - default values from a configuration file:
>>> config = Box.from_yaml('/path/to/my/default/config.yml')
>>> print(config)
{'key1':'value1','key2':'value2', ...}
Then, further on, I'd like to load additional values from another configuration file, maybe for a plugin. Of course, I could to that by reading the additional values to its own Box instance and update the first one:
>>> config2 = Box.from_yaml('/path/to/my/plugin/config.yml')
>>> print(config2)
{'foo':'bar', 'baz':'gus', ...}
>>> config.update(config2)
>>> print(config)
{'key1': 'value1', 'key2': 'value2', 'foo': 'bar', 'baz': 'gus'}
The main idea behind my feature request now is to skip creating an additional instance and load the additional values directly to the first instance:
>>> config.additional_values_from_yaml('/path/to/my/plugin/config.yml') # name of function picked randomly :)
>>> print(config)
{'key1': 'value1', 'key2': 'value2', 'foo': 'bar', 'baz': 'gus'}
Configuration files are just an example, I deal a lot of it with them.
I hope it's now clear what I mean. :)
Regards, Thomas
from box.
please checkout dynaconf which uses this project for their configuration storage
from box.
Related Issues (20)
- Using help (`?`) with `default_box=True` unintentionally adds a key HOT 3
- Keys method with (dotted=True) gives multiplication of the same key HOT 1
- `__add__` and `__or__` operators for frozen boxes HOT 3
- Add Cython builds to MacOS using `universal2` HOT 4
- Switch to poetry-core HOT 2
- Missing python-box 7.0.0 arm64 wheels HOT 1
- BoxKeyError when constructing a Box with box_dots = True in v7.0.0 HOT 2
- Appending a list to a list causes recursion HOT 4
- IDE Auto Completion for keys
- merge_update() not merging nested dictionaries or lists HOT 1
- path as string HOT 2
- Two test failures due to arguments having incorrect types HOT 3
- Caching a box resuts in read error HOT 1
- __repr__ Does not honor subclasses
- Unexpected attributes "size" and "compute" HOT 2
- Feature request: extend `merge_update` into BoxLists HOT 1
- `box_from_file` returns `ruamel.yaml.scalarfloat.ScalarFloat` instead of `float` for floating-point values HOT 1
- Segfault (infinite recursion?) when loading YAML schema into Box with `box_dots=True` HOT 3
- type 'int' is not iterable
- Internal-only Variables?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from box.