theskumar / theskumar/python-dotenv
set_key creates orphan .env file
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.9k
- Forks
- 581
- PR merge metrics
- No merged PRs in 30d
Description
set_key states "If the .env path given doesn't exist, fails instead of risking creating an orphan .env somewhere in the filesystem".
set_key has no check if the file exists. As it uses rewrite which if path passed is not a file, it creates an empty file.
if not os.path.isfile(path):
with open(path, mode="w", encoding=encoding) as source:
source.write("")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with set_key and rewrite in src/dotenv/main.py, especially the file-existence behavior described in the issue. Reproduce set_key with a nonexistent .env path and inspect the related tests or test entry points. Done means a missing path fails without creating an orphan file, while existing-file behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100