Skip to content

Commit

Permalink
update pypi to 2.5.0 alpha version ~
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed May 13, 2024
1 parent d82a5ad commit cd1e415
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions pypi_pkg/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project description
#### easy_configer version : 2.4.0
#### easy_configer version : 2.5.0
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/HuangChiEn/easy_config/main.yaml?branch=master&event=push&style=for-the-badge&label=unittest&color=green)

![easy-configer logo](https://raw.githubusercontent.com/HuangChiEn/easy_config/master/assets/logo.png)
Expand Down Expand Up @@ -57,6 +57,8 @@ And, of course the following attribute will also be supported :

* support hierachical configurating system with dynamic override ~

* better support for argument intepolation (inline-intepolation is allowed now ~)

---

### Newly update features 🚀
Expand Down Expand Up @@ -138,7 +140,7 @@ For easy-config file, there're two type of argument : flatten argument, hierachi
# define 'hierachical' arguments :
# the 'section' is the key of accessing dict value and could be defined as follows :
[db_setup]
db_host = ${cfg.serv_host}
db_host = ${cfg.serv_host}:80@str
# first `export mongo_port=5566` in your bash, then support os.env interpolation!
db_port = ${env.mongo_port}
snap_shot = True
Expand Down Expand Up @@ -210,15 +212,15 @@ There have two kind of way to prepare the arguments in easy-config : we can eith

#### Let's give a deep-learning example ~
#### *hier_cfg.ini in work directory*

root_dir = '/workspace'
glb_seed = 42
exp_id = '0001'

# we call '...' in [...] as section name,
# i.e. we can assign dict dataset to subroutine by `build_dataset(**cfg.dataset)`, just such easy!!
[dataset]
service_port = 65536
path = '/data/kitti'
path = "${cfg.root_dir}/data/kitti"
# of course, nested dict is also supported! it just the native python dictionary in dictionary!
[dataset.loader]
batch_size = 32
Expand Down Expand Up @@ -264,7 +266,7 @@ There have two kind of way to prepare the arguments in easy-config : we can eith
However, the syntax of above config file could be improved, isn't it !? For example, the batch_size is defined twice under `dataset.loader` and `train_cfg`, so as layer seed. Moreover, path is defined as python string, it need to be further converted by Path object in python standard package. Could we regist our customized data type for easy-config ?
#### Glade to say : Yes! it's possible to elegantly deal with above mentioned issue. We can solve the first issue by using argument interpolation, and solve the second issue by using the customized register!!

#### Thanks to *python code interpreter via ${...}* and *customized register method `regist_cnvtor`*. **See below example**
#### Thanks to *python format-string via ${...}* and *customized register method `regist_cnvtor`*. **See below example**
> Currently we support interpolation mechnaism to interpolate *ANY* arguemnts belong the different level of nested dictionary by using **\${cfg}**. Moreover, we also support **\${env}** for accessing enviroment variables exported in bash!!
# For convience, we define string-config!
Expand All @@ -289,7 +291,7 @@ However, the syntax of above config file could be improved, isn't it !? For exam
[model.backbone.optimizer]
# aweason! but we can do more crazy stuff ~
lay_seed = ${cfg.glb_seed}
# 'cfg' is used to access the config, feel free to access any arguments
# 'cfg' is used to access the config, feel free to access any arguments defined previsouly!!
string_seed = "The secrete string in data loader is ${cfg.dataset.loader.secrete_seed}!!"
[train_cfg]
Expand Down
2 changes: 1 addition & 1 deletion pypi_pkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='easy_configer',
version='2.4.0',
version='2.5.0',
description='An easy way for configurating python program by the given config file or config str',
author='JosefHuang',
author_email='a3285556aa@gmail.com',
Expand Down

0 comments on commit cd1e415

Please sign in to comment.