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

Support underscore as first char in env file variable names (#263) #264

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
History
=======

3.4.0 (in development)
----------------------

Backwards incompatible changes:

* Drop support for Python 3.8. Thanks, Rob!

Fixes and features:

* Add support for Python 3.13. (#260) Thanks, Rob!

* Add support for underscore as first character in variable names in env files.
(#263)


3.3.0 (November 6th, 2023)
--------------------------

Backwards incompatible changes:

* Dropped support for Python 3.7. (#220)
* Drop support for Python 3.7. (#220)

Fixes and features:

* Added support for Python 3.12 (#221)
* Add support for Python 3.12 (#221)

* Fix env file parsing in regards to quotes. (#230)

Expand Down
2 changes: 1 addition & 1 deletion src/everett/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@


# Regex for valid keys in an env file
ENV_KEY_RE = re.compile(r"^[a-z][a-z0-9_]*$", flags=re.IGNORECASE)
ENV_KEY_RE = re.compile(r"^[a-z_][a-z0-9_]*$", flags=re.IGNORECASE)

logger = logging.getLogger("everett")

Expand Down
4 changes: 4 additions & 0 deletions tests/data/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ LOGLEVEL=walter
DEBUG=True
YOURE_NOT_A=golfer

# env var with quotes around value
DATABASE_URL="sqlite:///kahlua.db"

# env var that starts with underscore
_TYPER_STANDARD_TRACEBACK=1
2 changes: 2 additions & 0 deletions tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,14 @@ def test_ConfigEnvFileEnv(datadir):
assert cefe.get("not_a", namespace="youre") == "golfer"
assert cefe.get("loglevel") == "walter"
assert cefe.get("LOGLEVEL") == "walter"
assert cefe.get("_typer_standard_traceback") == "1"
assert cefe.get("missing") is NO_VALUE
assert cefe.data == {
"LOGLEVEL": "walter",
"DEBUG": "True",
"YOURE_NOT_A": "golfer",
"DATABASE_URL": "sqlite:///kahlua.db",
"_TYPER_STANDARD_TRACEBACK": "1",
}

cefe = ConfigEnvFileEnv(env_filename)
Expand Down