sferriol-python 0.4.1__tar.gz → 0.5.0__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.
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/PKG-INFO +4 -1
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/setup.cfg +5 -0
- sferriol_python-0.5.0/sferriol/python/env.py +28 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol_python.egg-info/PKG-INFO +4 -1
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol_python.egg-info/SOURCES.txt +2 -0
- sferriol_python-0.5.0/sferriol_python.egg-info/requires.txt +4 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/LICENSE +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/README.md +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/pyproject.toml +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/setup.py +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol/python/__init__.py +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol/python/dictionary/__init__.py +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol/python/json.py +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol/python/net.py +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol/python/object.py +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol/python/os.py +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol_python.egg-info/dependency_links.txt +0 -0
- {sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol_python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sferriol-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: python utilities
|
|
5
5
|
Home-page: https://gitlab.in2p3.fr/sferriol-ip2i/sferriol-python
|
|
6
6
|
Author: Sylvain Ferriol
|
|
@@ -10,6 +10,9 @@ Classifier: Operating System :: OS Independent
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: click; extra == "dev"
|
|
15
|
+
Requires-Dist: yapf; extra == "dev"
|
|
13
16
|
|
|
14
17
|
# sferriol-python
|
|
15
18
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import tomllib
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def load(default=None, os_env_prefix=None):
|
|
6
|
+
"""
|
|
7
|
+
Return env dictionary loaded from, in order:
|
|
8
|
+
1. a default dictionary
|
|
9
|
+
2. a toml file where path is, in order, in default['env_file'] or in OS_ENV_PREFIX__ENV_FILE os env. variable
|
|
10
|
+
3. os env. variables OS_ENV_PREFIX__K where K is each key in previous dictionary in uppercase
|
|
11
|
+
"""
|
|
12
|
+
di = default.copy() if default else dict()
|
|
13
|
+
os_env_prefix = os_env_prefix.upper() + '__' if os_env_prefix else None
|
|
14
|
+
|
|
15
|
+
# from the env file
|
|
16
|
+
env_file = di.get('env_file', None)
|
|
17
|
+
if os_env_prefix:
|
|
18
|
+
env_file = os.getenv(os_env_prefix + 'ENV_FILE', env_file)
|
|
19
|
+
if env_file is not None:
|
|
20
|
+
with open(env_file, "rb") as f:
|
|
21
|
+
di.update(tomllib.load(f))
|
|
22
|
+
|
|
23
|
+
# from os env variables
|
|
24
|
+
if os_env_prefix:
|
|
25
|
+
for k in di.keys():
|
|
26
|
+
di[k] = os.getenv(os_env_prefix + str(k).upper(), di[k])
|
|
27
|
+
|
|
28
|
+
return di
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sferriol-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: python utilities
|
|
5
5
|
Home-page: https://gitlab.in2p3.fr/sferriol-ip2i/sferriol-python
|
|
6
6
|
Author: Sylvain Ferriol
|
|
@@ -10,6 +10,9 @@ Classifier: Operating System :: OS Independent
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: click; extra == "dev"
|
|
15
|
+
Requires-Dist: yapf; extra == "dev"
|
|
13
16
|
|
|
14
17
|
# sferriol-python
|
|
15
18
|
|
|
@@ -4,6 +4,7 @@ pyproject.toml
|
|
|
4
4
|
setup.cfg
|
|
5
5
|
setup.py
|
|
6
6
|
sferriol/python/__init__.py
|
|
7
|
+
sferriol/python/env.py
|
|
7
8
|
sferriol/python/json.py
|
|
8
9
|
sferriol/python/net.py
|
|
9
10
|
sferriol/python/object.py
|
|
@@ -12,4 +13,5 @@ sferriol/python/dictionary/__init__.py
|
|
|
12
13
|
sferriol_python.egg-info/PKG-INFO
|
|
13
14
|
sferriol_python.egg-info/SOURCES.txt
|
|
14
15
|
sferriol_python.egg-info/dependency_links.txt
|
|
16
|
+
sferriol_python.egg-info/requires.txt
|
|
15
17
|
sferriol_python.egg-info/top_level.txt
|
|
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
|
{sferriol-python-0.4.1 → sferriol_python-0.5.0}/sferriol_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|