Hello community,
here is the log from the commit of package python-python-dotenv for
openSUSE:Factory checked in at 2020-06-17 14:47:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-dotenv (Old)
and /work/SRC/openSUSE:Factory/.python-python-dotenv.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-dotenv"
Wed Jun 17 14:47:21 2020 rev:6 rq:807938 version:0.13.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-python-dotenv/python-python-dotenv.changes
2020-03-18 12:51:56.733194533 +0100
+++
/work/SRC/openSUSE:Factory/.python-python-dotenv.new.3606/python-python-dotenv.changes
2020-06-17 14:47:35.192418938 +0200
@@ -1,0 +2,8 @@
+Wed May 20 12:41:06 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- Update to 0.13.0
+ * Add support for a Bash-like default value in variable expansion
+ * Fix escaping of quoted values written by set_key
+ * Few more fixes
+
+-------------------------------------------------------------------
Old:
----
python-dotenv-0.12.0.tar.gz
New:
----
python-dotenv-0.13.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-python-dotenv.spec ++++++
--- /var/tmp/diff_new_pack.X6L23j/_old 2020-06-17 14:47:36.112422071 +0200
+++ /var/tmp/diff_new_pack.X6L23j/_new 2020-06-17 14:47:36.116422085 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-python-dotenv
-Version: 0.12.0
+Version: 0.13.0
Release: 0
Summary: Python library for .env support
License: BSD-3-Clause
++++++ python-dotenv-0.12.0.tar.gz -> python-dotenv-0.13.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/.travis.yml
new/python-dotenv-0.13.0/.travis.yml
--- old/python-dotenv-0.12.0/.travis.yml 2020-02-28 23:00:12.000000000
+0100
+++ new/python-dotenv-0.13.0/.travis.yml 2020-04-16 23:36:06.000000000
+0200
@@ -1,6 +1,7 @@
language: python
cache: pip
os: linux
+dist: xenial
jobs:
include:
@@ -30,7 +31,7 @@
- tox
before_install:
- - pip install python-coveralls
+ - pip install coveralls
after_success:
- tox -e coverage-report
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/CHANGELOG.md
new/python-dotenv-0.13.0/CHANGELOG.md
--- old/python-dotenv-0.12.0/CHANGELOG.md 2020-02-28 23:00:12.000000000
+0100
+++ new/python-dotenv-0.13.0/CHANGELOG.md 2020-04-16 23:36:06.000000000
+0200
@@ -9,6 +9,12 @@
*No unreleased change at this time.*
+## [0.13.0] - 2020-04-16
+
+### Added
+
+- Add support for a Bash-like default value in variable expansion (#248 by
[@bbc2]).
+
## [0.12.0] - 2020-02-28
### Changed
@@ -192,7 +198,8 @@
[@venthur]: https://github.com/venthur
[@yannham]: https://github.com/yannham
-[Unreleased]: https://github.com/theskumar/python-dotenv/compare/v0.12.0...HEAD
+[Unreleased]: https://github.com/theskumar/python-dotenv/compare/v0.13.0...HEAD
+[0.13.0]: https://github.com/theskumar/python-dotenv/compare/v0.12.0...v0.13.0
[0.12.0]: https://github.com/theskumar/python-dotenv/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/theskumar/python-dotenv/compare/v0.10.5...v0.11.0
[0.10.5]: https://github.com/theskumar/python-dotenv/compare/v0.10.4...v0.10.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/README.md
new/python-dotenv-0.13.0/README.md
--- old/python-dotenv-0.12.0/README.md 2020-02-28 23:00:12.000000000 +0100
+++ new/python-dotenv-0.13.0/README.md 2020-04-16 23:36:06.000000000 +0200
@@ -39,18 +39,23 @@
export SECRET_KEY=YOURSECRETKEYGOESHERE
```
-`.env` can interpolate variables using POSIX variable expansion,
-variables are replaced from the environment first or from other values
-in the `.env` file if the variable is not present in the environment.
+Python-dotenv can interpolate variables using POSIX variable expansion.
+
+The value of a variable is the first of the values defined in the following
list:
+
+- Value of that variable in the environment.
+- Value of that variable in the `.env` file.
+- Default value, if provided.
+- Empty string.
+
Ensure that variables are surrounded with `{}` like `${HOME}` as bare
variables such as `$HOME` are not expanded.
-(**Note**: Default Value Expansion is not supported as of yet, see
-[\#30](https://github.com/theskumar/python-dotenv/pull/30#issuecomment-244036604).)
```shell
CONFIG_PATH=${HOME}/.config/foo
DOMAIN=example.org
EMAIL=admin@${DOMAIN}
+DEBUG=${DEBUG:-false}
```
## Getting started
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/setup.cfg
new/python-dotenv-0.13.0/setup.cfg
--- old/python-dotenv-0.12.0/setup.cfg 2020-02-28 23:00:12.000000000 +0100
+++ new/python-dotenv-0.13.0/setup.cfg 2020-04-16 23:36:06.000000000 +0200
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 0.12.0
+current_version = 0.13.0
commit = True
tag = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/src/dotenv/main.py
new/python-dotenv-0.13.0/src/dotenv/main.py
--- old/python-dotenv-0.12.0/src/dotenv/main.py 2020-02-28 23:00:12.000000000
+0100
+++ new/python-dotenv-0.13.0/src/dotenv/main.py 2020-04-16 23:36:06.000000000
+0200
@@ -30,7 +30,17 @@
else:
_StringIO = StringIO[Text]
-__posix_variable = re.compile(r'\$\{[^\}]*\}') # type: Pattern[Text]
+__posix_variable = re.compile(
+ r"""
+ \$\{
+ (?P<name>[^\}:]*)
+ (?::-
+ (?P<default>[^\}]*)
+ )?
+ \}
+ """,
+ re.VERBOSE,
+) # type: Pattern[Text]
def with_warn_for_invalid_lines(mappings):
@@ -202,23 +212,25 @@
def resolve_nested_variables(values):
# type: (Dict[Text, Optional[Text]]) -> Dict[Text, Optional[Text]]
- def _replacement(name):
- # type: (Text) -> Text
+ def _replacement(name, default):
+ # type: (Text, Optional[Text]) -> Text
"""
get appropriate value for a variable name.
first search in environ, if not found,
then look into the dotenv variables
"""
- ret = os.getenv(name, new_values.get(name, ""))
+ default = default if default is not None else ""
+ ret = os.getenv(name, new_values.get(name, default))
return ret # type: ignore
- def _re_sub_callback(match_object):
+ def _re_sub_callback(match):
# type: (Match[Text]) -> Text
"""
From a match object gets the variable name and returns
the correct replacement
"""
- return _replacement(match_object.group()[2:-1])
+ matches = match.groupdict()
+ return _replacement(name=matches["name"], default=matches["default"])
# type: ignore
new_values = {}
@@ -275,6 +287,7 @@
current_file = __file__
while frame.f_code.co_filename == current_file:
+ assert frame.f_back is not None
frame = frame.f_back
frame_filename = frame.f_code.co_filename
path = os.path.dirname(os.path.abspath(frame_filename))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/src/dotenv/version.py
new/python-dotenv-0.13.0/src/dotenv/version.py
--- old/python-dotenv-0.12.0/src/dotenv/version.py 2020-02-28
23:00:12.000000000 +0100
+++ new/python-dotenv-0.13.0/src/dotenv/version.py 2020-04-16
23:36:06.000000000 +0200
@@ -1 +1 @@
-__version__ = "0.12.0"
+__version__ = "0.13.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/tests/test_cli.py
new/python-dotenv-0.13.0/tests/test_cli.py
--- old/python-dotenv-0.12.0/tests/test_cli.py 2020-02-28 23:00:12.000000000
+0100
+++ new/python-dotenv-0.13.0/tests/test_cli.py 2020-04-16 23:36:06.000000000
+0200
@@ -20,7 +20,7 @@
result = cli.invoke(dotenv_cli, ['--file', 'nx_file', 'list'])
assert result.exit_code == 2, result.output
- assert 'Invalid value for "-f"' in result.output
+ assert "Invalid value for '-f'" in result.output
def test_list_no_file(cli):
@@ -48,7 +48,7 @@
result = cli.invoke(dotenv_cli, ['--file', 'nx_file', 'get', 'a'])
assert result.exit_code == 2
- assert 'Invalid value for "-f"' in result.output
+ assert "Invalid value for '-f'" in result.output
def test_unset_existing_value(cli, dotenv_file):
@@ -97,7 +97,7 @@
result = cli.invoke(dotenv_cli, ["--file", "nx_file", "set"])
assert result.exit_code == 2
- assert 'Invalid value for "-f"' in result.output
+ assert "Invalid value for '-f'" in result.output
def test_get_default_path(tmp_path):
@@ -145,14 +145,14 @@
result = cli.invoke(dotenv_cli, ['run'])
assert result.exit_code == 2
- assert 'Invalid value for "-f"' in result.output
+ assert "Invalid value for '-f'" in result.output
def test_run_with_invalid_cmd(cli):
result = cli.invoke(dotenv_cli, ['run', 'i_do_not_exist'])
assert result.exit_code == 2
- assert 'Invalid value for "-f"' in result.output
+ assert "Invalid value for '-f'" in result.output
def test_run_with_version(cli):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/python-dotenv-0.12.0/tests/test_main.py
new/python-dotenv-0.13.0/tests/test_main.py
--- old/python-dotenv-0.12.0/tests/test_main.py 2020-02-28 23:00:12.000000000
+0100
+++ new/python-dotenv-0.13.0/tests/test_main.py 2020-04-16 23:36:06.000000000
+0200
@@ -304,20 +304,31 @@
({"b": "c"}, "a=$b", True, {"a": "$b"}),
({"b": "c"}, "a=${b}", False, {"a": "${b}"}),
({"b": "c"}, "a=${b}", True, {"a": "c"}),
+ ({"b": "c"}, "a=${b:-d}", False, {"a": "${b:-d}"}),
+ ({"b": "c"}, "a=${b:-d}", True, {"a": "c"}),
# Defined in file
({}, "b=c\na=${b}", True, {"a": "c", "b": "c"}),
# Undefined
({}, "a=${b}", True, {"a": ""}),
+ ({}, "a=${b:-d}", True, {"a": "d"}),
# With quotes
({"b": "c"}, 'a="${b}"', True, {"a": "c"}),
({"b": "c"}, "a='${b}'", True, {"a": "c"}),
+ # With surrounding text
+ ({"b": "c"}, "a=x${b}y", True, {"a": "xcy"}),
+
# Self-referential
({"a": "b"}, "a=${a}", True, {"a": "b"}),
({}, "a=${a}", True, {"a": ""}),
+ ({"a": "b"}, "a=${a:-c}", True, {"a": "b"}),
+ ({}, "a=${a:-c}", True, {"a": "c"}),
+
+ # Reused
+ ({"b": "c"}, "a=${b}${b}", True, {"a": "cc"}),
],
)
def test_dotenv_values_stream(env, string, interpolate, expected):