paramflow 0.2.5__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {paramflow-0.2.5/paramflow.egg-info → paramflow-0.2.7}/PKG-INFO +6 -7
- {paramflow-0.2.5 → paramflow-0.2.7}/README.md +5 -6
- paramflow-0.2.7/paramflow/__pycache__/params.cpython-312.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/params.py +11 -11
- {paramflow-0.2.5 → paramflow-0.2.7/paramflow.egg-info}/PKG-INFO +6 -7
- {paramflow-0.2.5 → paramflow-0.2.7}/setup.py +1 -1
- paramflow-0.2.5/paramflow/__pycache__/params.cpython-312.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/LICENSE +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/MANIFEST.in +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__init__.py +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/__init__.cpython-312.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/convert.cpython-312.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/frozen.cpython-312.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/frozen_test.cpython-312-pytest-8.3.4.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/params_test.cpython-312-pytest-8.3.4.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/parser.cpython-312.pyc +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/convert.py +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/frozen.py +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow/parser.py +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow.egg-info/SOURCES.txt +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow.egg-info/dependency_links.txt +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow.egg-info/requires.txt +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/paramflow.egg-info/top_level.txt +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/pyproject.toml +0 -0
- {paramflow-0.2.5 → paramflow-0.2.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: paramflow
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Flexible and user-friendly parameter and configuration management library.
|
|
5
5
|
Home-page: https://github.com/mduszyk/paramflow
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -82,19 +82,18 @@ P_PROFILE=dqn-adam python print_params.py
|
|
|
82
82
|
|
|
83
83
|
## Parameter Layering
|
|
84
84
|
Parameters are merged from multiple sources in the following order:
|
|
85
|
-
1. Configuration files (`.toml`, `.yaml`, `.ini`, `.json`)
|
|
86
|
-
2.
|
|
87
|
-
3.
|
|
88
|
-
4. Command-line arguments (`argparse`)
|
|
85
|
+
1. Configuration files (`.toml`, `.yaml`, `.ini`, `.json`, `.env`)
|
|
86
|
+
2. Environment variables (default prefix: `P_`)
|
|
87
|
+
3. Command-line arguments (`argparse`)
|
|
89
88
|
|
|
90
89
|
### Customizing Layering Order
|
|
91
|
-
You can specify the order explicitly:
|
|
90
|
+
You can specify the order explicitly (`env` and `args` are reserved names):
|
|
92
91
|
```python
|
|
93
92
|
params = pf.load('params.toml', 'env', '.env', 'args')
|
|
94
93
|
```
|
|
95
94
|
|
|
96
95
|
### Overriding Parameters
|
|
97
|
-
|
|
96
|
+
Override parameters via command-line arguments:
|
|
98
97
|
```sh
|
|
99
98
|
python print_params.py --profile dqn-adam --learning_rate 0.0002
|
|
100
99
|
```
|
|
@@ -62,19 +62,18 @@ P_PROFILE=dqn-adam python print_params.py
|
|
|
62
62
|
|
|
63
63
|
## Parameter Layering
|
|
64
64
|
Parameters are merged from multiple sources in the following order:
|
|
65
|
-
1. Configuration files (`.toml`, `.yaml`, `.ini`, `.json`)
|
|
66
|
-
2.
|
|
67
|
-
3.
|
|
68
|
-
4. Command-line arguments (`argparse`)
|
|
65
|
+
1. Configuration files (`.toml`, `.yaml`, `.ini`, `.json`, `.env`)
|
|
66
|
+
2. Environment variables (default prefix: `P_`)
|
|
67
|
+
3. Command-line arguments (`argparse`)
|
|
69
68
|
|
|
70
69
|
### Customizing Layering Order
|
|
71
|
-
You can specify the order explicitly:
|
|
70
|
+
You can specify the order explicitly (`env` and `args` are reserved names):
|
|
72
71
|
```python
|
|
73
72
|
params = pf.load('params.toml', 'env', '.env', 'args')
|
|
74
73
|
```
|
|
75
74
|
|
|
76
75
|
### Overriding Parameters
|
|
77
|
-
|
|
76
|
+
Override parameters via command-line arguments:
|
|
78
77
|
```sh
|
|
79
78
|
python print_params.py --profile dqn-adam --learning_rate 0.0002
|
|
80
79
|
```
|
|
Binary file
|
|
@@ -8,25 +8,25 @@ from paramflow.convert import convert_type
|
|
|
8
8
|
from paramflow.frozen import freeze, FrozenAttrDict
|
|
9
9
|
from paramflow.parser import PARSER_MAP, EnvParser, ArgsParser, DotEnvParser, Parser
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
ENV_PREFIX: Final[str] = 'P_'
|
|
13
|
-
ARGS_PREFIX: Final[str] = ''
|
|
14
|
-
DEFAULT_PROFILE: Final[str] = 'default'
|
|
15
|
-
PROFILE_KEY: Final[str] = 'profile'
|
|
11
|
+
|
|
16
12
|
ENV_SOURCE: Final[str] = 'env'
|
|
17
13
|
ARGS_SOURCE: Final[str] = 'args'
|
|
18
14
|
|
|
19
15
|
|
|
20
16
|
def load(*sources: Tuple[str, ...],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
meta_env_prefix: str = 'P_',
|
|
18
|
+
meta_args_prefix: str = '',
|
|
19
|
+
env_prefix: str = 'P_',
|
|
20
|
+
args_prefix: str = '',
|
|
21
|
+
profile_key: str = 'profile',
|
|
22
|
+
default_profile: str = 'default',
|
|
25
23
|
profile: Optional[str] = None) -> FrozenAttrDict[str, any]:
|
|
26
24
|
"""
|
|
27
25
|
Load parameters form multiple sources, layer them on top of each other and activate profile.
|
|
28
26
|
Activation of profile means learying it on top of the default profile.
|
|
29
27
|
:param source: file or multiple files to load parameters from
|
|
28
|
+
:param meta_env_prefix: prefix for env vars that are used to overwrite meta params
|
|
29
|
+
:param meta_args_prefix: prefix for command-line arguments to overwrite meta params
|
|
30
30
|
:param env_prefix: prefix for env vars that are used to overwrite params, if None disable auto adding env source
|
|
31
31
|
:param args_prefix: prefix for command-line arguments, if None disable auto adding args source
|
|
32
32
|
:param profile_key: parameter name for the profile
|
|
@@ -44,8 +44,8 @@ def load(*sources: Tuple[str, ...],
|
|
|
44
44
|
profile_key: profile,
|
|
45
45
|
'__source__': ['pf.load'],
|
|
46
46
|
}
|
|
47
|
-
meta_env_parser = EnvParser(
|
|
48
|
-
meta_args_parser = ArgsParser(
|
|
47
|
+
meta_env_parser = EnvParser(meta_env_prefix, 'default')
|
|
48
|
+
meta_args_parser = ArgsParser(meta_args_prefix, 'default', no_exit=True, descr='Meta-parameters')
|
|
49
49
|
meta = deep_merge(meta, meta_env_parser(meta))
|
|
50
50
|
meta = deep_merge(meta, meta_args_parser(meta))
|
|
51
51
|
meta = freeze(meta)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: paramflow
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Flexible and user-friendly parameter and configuration management library.
|
|
5
5
|
Home-page: https://github.com/mduszyk/paramflow
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -82,19 +82,18 @@ P_PROFILE=dqn-adam python print_params.py
|
|
|
82
82
|
|
|
83
83
|
## Parameter Layering
|
|
84
84
|
Parameters are merged from multiple sources in the following order:
|
|
85
|
-
1. Configuration files (`.toml`, `.yaml`, `.ini`, `.json`)
|
|
86
|
-
2.
|
|
87
|
-
3.
|
|
88
|
-
4. Command-line arguments (`argparse`)
|
|
85
|
+
1. Configuration files (`.toml`, `.yaml`, `.ini`, `.json`, `.env`)
|
|
86
|
+
2. Environment variables (default prefix: `P_`)
|
|
87
|
+
3. Command-line arguments (`argparse`)
|
|
89
88
|
|
|
90
89
|
### Customizing Layering Order
|
|
91
|
-
You can specify the order explicitly:
|
|
90
|
+
You can specify the order explicitly (`env` and `args` are reserved names):
|
|
92
91
|
```python
|
|
93
92
|
params = pf.load('params.toml', 'env', '.env', 'args')
|
|
94
93
|
```
|
|
95
94
|
|
|
96
95
|
### Overriding Parameters
|
|
97
|
-
|
|
96
|
+
Override parameters via command-line arguments:
|
|
98
97
|
```sh
|
|
99
98
|
python print_params.py --profile dqn-adam --learning_rate 0.0002
|
|
100
99
|
```
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/frozen_test.cpython-312-pytest-8.3.4.pyc
RENAMED
|
File without changes
|
{paramflow-0.2.5 → paramflow-0.2.7}/paramflow/__pycache__/params_test.cpython-312-pytest-8.3.4.pyc
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|