theskumar / theskumar/python-dotenv

load_dotenv() default behavior change in PyCharm interactive console

Aperta
#596 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
8.9k
Fork
581
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Python Versions tested: 3.10, 3.11, 3.12.10
Environment: Windows (10, 11) in PyCharm interactive console
Affected package versions: 1.0.1+

When using the pycharm interactive console, the following code no longer finds the .env file by default (as of version 1.0.1).

from dotenv import load_dotenv
load_dotenv()

When testing in version 1.0.0, the load_dotenv() function will correctly find the .env file without any additional arguments. In order to successfully load a .env file located within the project's root directory, the following code must be used.

from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv(usecwd=True))

From reading the documentation, it suggests that find_dotenv() doesn't use the CWD by default and works based upon the calling file's location. This creates somewhat unexpected behavior for use in pycharm's interactive console. I wouldn't have expected a change in default behavior like this in a patch release.

PyCharm and Env file Notes
  • .env file is located in the project's root directory
  • PyCharm console is running in the project's root directory

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Start by reproducing the reported load_dotenv() and find_dotenv(usecwd=True) calls in a PyCharm interactive console with the .env file in the project root, comparing package versions 1.0.0 and 1.0.1+. Trace the default path-selection entry point and add or update regression coverage for the console scenario; done means the intended behavior is documented and verified.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
devops
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.