theskumar / theskumar/python-dotenv

Consider using bashlex

Đang mở
#403 0 bình luận 7 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
8.9k
Fork
581
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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 ?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
bash, python
Lĩnh vực
devops, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.