Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: theskumar/python-dotenv
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.13.0
Choose a base ref
...
head repository: theskumar/python-dotenv
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.14.0
Choose a head ref
  • 5 commits
  • 7 files changed
  • 4 contributors

Commits on Apr 29, 2020

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    universalmind303 Cory Grinstead
    Copy the full SHA
    335dedc View commit details
  2. Fix file not found message to have some context (#245)

    'File doesn't exist' doesn't really tell the user much, let's add some context.
    snobu authored Apr 29, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e92ab1f View commit details

Commits on May 12, 2020

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    universalmind303 Cory Grinstead
    Copy the full SHA
    d83c1b6 View commit details

Commits on Jul 3, 2020

  1. fix interpolation order

    add interpolation order test
    elbehery95 authored and bbc2 committed Jul 3, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    universalmind303 Cory Grinstead
    Copy the full SHA
    6712bc8 View commit details
  2. Release v0.14.0

    bbc2 committed Jul 3, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    universalmind303 Cory Grinstead
    Copy the full SHA
    e4bbb8a View commit details
Showing with 36 additions and 17 deletions.
  1. +17 −1 CHANGELOG.md
  2. +1 −1 README.md
  3. +1 −1 setup.cfg
  4. +1 −1 setup.py
  5. +2 −7 src/dotenv/main.py
  6. +1 −1 src/dotenv/version.py
  7. +13 −5 tests/test_main.py
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -9,6 +9,18 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

*No unreleased change at this time.*

## [0.14.0] - 2020-07-03

### Changed

- Privilege definition in file over the environment in variable expansion (#256 by
[@elbehery95]).

### Fixed

- Improve error message for when file isn't found (#245 by [@snobu]).
- Use HTTPS URL in package meta data (#251 by [@ekohl]).

## [0.13.0] - 2020-04-16

### Added
@@ -189,16 +201,20 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
[@bbc2]: https://github.com/bbc2
[@cjauvin]: https://github.com/cjauvin
[@earlbread]: https://github.com/earlbread
[@ekohl]: https://github.com/ekohl
[@elbehery95]: https://github.com/elbehery95
[@gergelyk]: https://github.com/gergelyk
[@greyli]: https://github.com/greyli
[@qnighy]: https://github.com/qnighy
[@snobu]: https://github.com/snobu
[@techalchemy]: https://github.com/techalchemy
[@theskumar]: https://github.com/theskumar
[@ulyssessouza]: https://github.com/ulyssessouza
[@venthur]: https://github.com/venthur
[@yannham]: https://github.com/yannham

[Unreleased]: https://github.com/theskumar/python-dotenv/compare/v0.13.0...HEAD
[Unreleased]: https://github.com/theskumar/python-dotenv/compare/v0.14.0...HEAD
[0.14.0]: https://github.com/theskumar/python-dotenv/compare/v0.13.0...v0.14.0
[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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ load_dotenv()
load_dotenv(verbose=True)

# OR, explicitly providing path to '.env'
from pathlib import Path # python3 only
from pathlib import Path # Python 3.6+ only
env_path = Path('.') / '.env'
load_dotenv(dotenv_path=env_path)
```
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.13.0
current_version = 0.14.0
commit = True
tag = True

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ def read_files(files):
version=meta['__version__'],
author="Saurabh Kumar",
author_email="me+github@saurabh-kumar.com",
url="http://github.com/theskumar/python-dotenv",
url="https://github.com/theskumar/python-dotenv",
keywords=['environment variables', 'deployments', 'settings', 'env', 'dotenv',
'configurations', 'python'],
packages=['dotenv'],
9 changes: 2 additions & 7 deletions src/dotenv/main.py
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ def _get_stream(self):
yield stream
else:
if self.verbose:
logger.warning("File doesn't exist %s", self.dotenv_path)
logger.info("Python-dotenv could not find configuration file %s.", self.dotenv_path or '.env')
yield StringIO('')

def dict(self):
@@ -214,13 +214,8 @@ def resolve_nested_variables(values):
# type: (Dict[Text, Optional[Text]]) -> Dict[Text, Optional[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
"""
default = default if default is not None else ""
ret = os.getenv(name, new_values.get(name, default))
ret = new_values.get(name, os.getenv(name, default))
return ret # type: ignore

def _re_sub_callback(match):
2 changes: 1 addition & 1 deletion src/dotenv/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.13.0"
__version__ = "0.14.0"
18 changes: 13 additions & 5 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -74,14 +74,19 @@ def test_get_key_no_file(tmp_path):
nx_file = str(tmp_path / "nx")
logger = logging.getLogger("dotenv.main")

with mock.patch.object(logger, "warning") as mock_warning:
with mock.patch.object(logger, "info") as mock_info, \
mock.patch.object(logger, "warning") as mock_warning:
result = dotenv.get_key(nx_file, "foo")

assert result is None
mock_info.assert_has_calls(
calls=[
mock.call("Python-dotenv could not find configuration file %s.", nx_file)
],
)
mock_warning.assert_has_calls(
calls=[
mock.call("File doesn't exist %s", nx_file),
mock.call("Key %s not found in %s.", "foo", nx_file),
mock.call("Key %s not found in %s.", "foo", nx_file)
],
)

@@ -228,10 +233,10 @@ def test_load_dotenv_existing_file(dotenv_file):
def test_load_dotenv_no_file_verbose():
logger = logging.getLogger("dotenv.main")

with mock.patch.object(logger, "warning") as mock_warning:
with mock.patch.object(logger, "info") as mock_info:
dotenv.load_dotenv('.does_not_exist', verbose=True)

mock_warning.assert_called_once_with("File doesn't exist %s", ".does_not_exist")
mock_info.assert_called_once_with("Python-dotenv could not find configuration file %s.", ".does_not_exist")


@mock.patch.dict(os.environ, {"a": "c"}, clear=True)
@@ -329,6 +334,9 @@ def test_dotenv_values_file(dotenv_file):
# Reused
({"b": "c"}, "a=${b}${b}", True, {"a": "cc"}),
# Re-defined and used in file
({"b": "c"}, "b=d\na=${b}", True, {"a": "d", "b": "d"}),
],
)
def test_dotenv_values_stream(env, string, interpolate, expected):