Comments (6)
config.parse
has a parameter named default_config
. This allow you to apply your CLI arguments on a config file.
from chanfig import Config
from rich import print
if __name__ == '__main__':
config = config.parse(default_config="config")
print(config)
python xxx.py --config default.yaml
from chanfig.
Thank you. It fixed it.
from chanfig.
sorry for the late response, I have just tested the snippet, however, when run with --help
, it won't show keys in the configuration file, even run with --config
.
❯ python run.py --config configs/exps/test.yaml --help
usage: run.py [-h] [--config CONFIG]
options:
-h, --help show this help message and exit
--config CONFIG
from chanfig.
sorry for the late response, I have just tested the snippet, however, when run with
--help
, it won't show keys in the configuration file, even run with--config
.❯ python run.py --config configs/exps/test.yaml --help usage: run.py [-h] [--config CONFIG] options: -h, --help show this help message and exit --config CONFIG
Im not sure if it’s possible to achieve this.
Merging a config file happens after parsed the command line arguments.
--help
is handled by argparse when parsing the command line arguments.
from chanfig.
Yes, I know it is a little weird to load from config and then add to the argparse, but it could be better if we can support this. This may change a lot of logic when loading and parsing the config.
from chanfig.
Yes, I'll need some time for this, hopefully by the end of August.
from chanfig.
Related Issues (12)
- Repetitive setting for model, dataset,...etc HOT 3
- wrong output when use with rich.print HOT 9
- Feature Request: help message, type checker and input restrictions HOT 24
- `--help` only shows arguments defined by `add_argument`
- jsonc support
- Feature Request: variable interpolation in yaml file HOT 26
- Can a Config be wrapped with Variable? HOT 3
- error: argument --name: invalid NoneType value: 'value' HOT 1
- Support to read multiple config file and combine them HOT 3
- Strange error when dict key is a list HOT 1
- from_yamls() is broken with chanfig[include] HOT 1
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 chanfig.