theskumar / theskumar/python-dotenv

Consider using bashlex

Abierto
#403 0 comentarios 7 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

Hi.

I've been using .env files for a while, namely to setup variable and load python virtual environments, also with stuff like autoenv.
This means that my .env files have bash code, like if statements, sourcing other scripts, commands, functions.

dotenvs limited reader code just uses a couple regexs that can't handle much more than export statements. And this is something some people might not be expecting.

Suggestion:

  • use bashlex to parse the .env files. https://github.com/idank/bashlex
  • gather variables defined only at the top level
  • implement variable substitution (quite easy to implement) e.g. ${VARNAME:-fallback}
  • recursively source other sourced scripts, e.g. .env includes the line source .envrc.

This would be a reimplementation of the module, so perhaps something for a major release ?

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

The issue proposes replacing dotenv's limited reader with bashlex. Start by locating the existing .env reader and reviewing bashlex's parsing model; done means top-level variables, ${VARNAME:-fallback} substitution, and recursive source handling work for files such as .env sourcing .envrc, with the scope suitable for a major release.

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

Evaluación

Stack tecnológico
bash, python
Área
devops, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.