GithubHelp home page GithubHelp logo

Comments (3)

cdgriffith avatar cdgriffith commented on June 6, 2024

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.

thmsklngr avatar thmsklngr commented on June 6, 2024

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.

justquick avatar justquick commented on June 6, 2024

please checkout dynaconf which uses this project for their configuration storage

https://www.dynaconf.com/

from box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.