theskumar / theskumar/python-dotenv

load_dotenv() default behavior change in PyCharm interactive console

Abierto
#596 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
8.9k
Forks
581
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
devops
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.