Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load multiple .env files with load_dotenv #5

Merged
merged 5 commits into from
Aug 1, 2021
Merged

Conversation

br3ndonland
Copy link
Owner

@br3ndonland br3ndonland commented Aug 1, 2021

Description

This PR will update load_dotenv to load multiple .env files in a single call.

Changes

  • Load multiple .env files with load_dotenv (0813a5e)
  • Document how to load multiple .env files (07cfa3b)
  • Add missing from __future__ import annotations (83b7696)
  • Organize repetitive assertions with helper methods (b1c8c72)
  • Refactor load_dotenv into smaller methods (74ca273)

Related

#2

@vercel
Copy link

vercel bot commented Aug 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/br3ndonland/fastenv/2EjMhUXmC9wSi6dw6o3Gg6tdS58k
✅ Preview: https://fastenv-git-loaddotenvmulti-br3ndonland.vercel.app

@codecov
Copy link

codecov bot commented Aug 1, 2021

Codecov Report

Merging #5 (74ca273) into develop (400cb3e) will not change coverage.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop       #5   +/-   ##
========================================
  Coverage    100.0%   100.0%           
========================================
  Files            3        3           
  Lines          104      113    +9     
========================================
+ Hits           104      113    +9     
Flag Coverage Δ
unit 100.0% <100.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
fastenv/dotenv.py 100.0% <100.0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 400cb3e...74ca273. Read the comment docs.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Aug 1, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 3.19%.

Quality metrics Before After Change
Complexity 0.43 ⭐ 0.54 ⭐ 0.11 👎
Method Length 61.75 🙂 52.87 ⭐ -8.88 👍
Working memory 6.66 🙂 6.26 🙂 -0.40 👍
Quality 79.38% 82.57% 3.19% 👍
Other metrics Before After Change
Lines 1006 1097 91
Changed files Quality Before Quality After Quality Change
fastenv/dotenv.py 83.53% ⭐ 84.30% ⭐ 0.77% 👍
tests/conftest.py 90.71% ⭐ 86.88% ⭐ -3.83% 👎
tests/test_dotenv.py 78.06% ⭐ 81.73% ⭐ 3.67% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
tests/test_dotenv.py TestDotEnvMethods.test_load_dotenv_file_in_sub_dir 0 ⭐ 104 🙂 10 😞 68.46% 🙂 Extract out complex expressions
tests/test_dotenv.py TestDotEnvMethods.test_load_dotenv_files_in_sub_dirs 0 ⭐ 100 🙂 10 😞 69.00% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@br3ndonland br3ndonland merged commit 796e10c into develop Aug 1, 2021
@br3ndonland br3ndonland deleted the load_dotenv_multi branch August 1, 2021 23:41
br3ndonland added a commit that referenced this pull request Nov 21, 2021
#5

The `load_dotenv` method originally had a default filename argument of
`".env"`. This default was removed in #5, when the ability to load
multiple .env files was implemented. The default filename argument could
potentially be added back in the future, but adding the same default to
the examples in the docs will help ensure the examples work, regardless
of whether or not `load_dotenv` supplies a default filename argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant