theskumar / theskumar/python-dotenv

Consider using bashlex

Aperta
#403 0 commenti 7 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

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 ?

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

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.

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

Valutazione

Stack tecnologico
bash, python
Ambito
devops, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.