python-simpleconf 0.9.4__py3-none-any.whl → 0.9.5__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-simpleconf
3
- Version: 0.9.4
3
+ Version: 0.9.5
4
4
  Summary: Simple configuration management with python.
5
5
  Project-URL: Homepage, https://github.com/pwwang/simpleconf
6
6
  Project-URL: Repository, https://github.com/pwwang/simpleconf
@@ -404,6 +404,18 @@ conf = Config.load('config.yaml')
404
404
 
405
405
  #### Loadenv directive
406
406
 
407
+ You will need `python-dotenv` installed to use the `loadenv` directive. You can install it with:
408
+
409
+ ```shell
410
+ pip install python-simpleconf[toml,env]
411
+ ```
412
+ if you only need TOML and dotenv support, or
413
+
414
+ ```shell
415
+ pip install python-simpleconf[all]
416
+ ```
417
+ if you want all supported formats.
418
+
407
419
  You can also embed a `# simpleconf-loadenv` directive in the first few lines of a configuration file to load environment variables from a `.env` file. This allows you to reference environment variables directly in your config values using `$env:VAR` syntax, and makes them available as `env` in Jinja2/Liquid templates via `{{ env.VAR }}` or `{{ env["VAR"] }}`.
408
420
 
409
421
  The directive format is:
@@ -1,9 +1,9 @@
1
- simpleconf/__init__.py,sha256=VOsGsKvRKKpZnFcYYRKxs40KZjm4AfIRgwtOYP5Uk1Y,104
1
+ simpleconf/__init__.py,sha256=wrkpYialYF4KkMHvjDPalFW7VZOusyaCU7iGDEa6Gc8,104
2
2
  simpleconf/caster.py,sha256=qHnegp1FZzbUWm-UbCaGjQKN6d9rN1v_0Wa4I_CMEi4,2379
3
3
  simpleconf/config.py,sha256=Wf6zCoUs3QGHVFdYTFldcIVk6vmmqnf9bth4Wz0F2Lw,18677
4
4
  simpleconf/exceptions.py,sha256=Tb7w9gMO2XU4mE-Rc2HAnuHWDUpMzdl39oGVjeAv254,171
5
5
  simpleconf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- simpleconf/utils.py,sha256=Oyuthm2RdK2mhhjwDU28LAvDwEh2abRXVGZ4_fx8ecE,8737
6
+ simpleconf/utils.py,sha256=JXnmdGd3JE6QDPvL9QSQi_lC07vQLDuIbof6b4idEIA,8856
7
7
  simpleconf/loaders/__init__.py,sha256=ZuWgb_D8UUwniWKltg7jtjAhEUm0J6sCZrFkXVSSweM,8491
8
8
  simpleconf/loaders/dict.py,sha256=8Az511i9OLLXosSBMMXiEfiQVScQ5SIqsF6EHlAkKdM,801
9
9
  simpleconf/loaders/env.py,sha256=cOYZbHk08MrBjxtNfV8Cv5LHrZg_flzap1lOM3GVdRk,3729
@@ -12,7 +12,7 @@ simpleconf/loaders/json.py,sha256=0NTKB9JidB8vbeODxNYAY8fJP6__znetuIUAClFeNIo,19
12
12
  simpleconf/loaders/osenv.py,sha256=K829KFiHLl3pS8HSCep8JoPVG_d7VRxPAb7SPYFRypg,1779
13
13
  simpleconf/loaders/toml.py,sha256=OJCukg_R3zlmas_q_CrdeKUsw8Wj5LoSnkNJ7Flt86w,2525
14
14
  simpleconf/loaders/yaml.py,sha256=IoKMaQF5y5HWEjQsnUwL2UvABVj9A-0AmBhn8s7lE54,2146
15
- python_simpleconf-0.9.4.dist-info/METADATA,sha256=kPT35p8JYK_3W0hEwmiwhh8Bj1OJQDRKNxqhHeAULeA,11595
16
- python_simpleconf-0.9.4.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
17
- python_simpleconf-0.9.4.dist-info/licenses/LICENSE,sha256=2j7OLS2vXIEshgbSkiCU9RgYJY1M4OBBtO6ECbo7OB8,1056
18
- python_simpleconf-0.9.4.dist-info/RECORD,,
15
+ python_simpleconf-0.9.5.dist-info/METADATA,sha256=7Nj2Ku_RsdJGLpeReGByUurGdh9-dp6eF_yVDQfaBOo,11876
16
+ python_simpleconf-0.9.5.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
17
+ python_simpleconf-0.9.5.dist-info/licenses/LICENSE,sha256=2j7OLS2vXIEshgbSkiCU9RgYJY1M4OBBtO6ECbo7OB8,1056
18
+ python_simpleconf-0.9.5.dist-info/RECORD,,
simpleconf/__init__.py CHANGED
@@ -2,4 +2,4 @@ from .config import Config, ProfileConfig
2
2
 
3
3
  __all__ = ["Config", "ProfileConfig"]
4
4
 
5
- __version__ = "0.9.4"
5
+ __version__ = "0.9.5"
simpleconf/utils.py CHANGED
@@ -38,7 +38,11 @@ def _read_first_lines(conf: Any) -> List[str]:
38
38
  return []
39
39
 
40
40
  path = Path(conf)
41
- if not path.exists():
41
+ try:
42
+ if not path.exists():
43
+ return []
44
+ except Exception: # pragma: no cover
45
+ # e.g. OSError: Filename too long
42
46
  return []
43
47
 
44
48
  try: