Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] Streamlit app에서 디폴트 주소 세팅 #33

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

eyeol
Copy link
Contributor

@eyeol eyeol commented Nov 21, 2024

📝 Summary

기존에 하드코딩된 디폴트 데이터셋 주소를 dotenv로 관리하도록 방식이 변경되었습니다.

✅ Checklist

  • 관련 이슈가 명시되어 있습니다.
  • 테스트가 완료되었습니다.
  • [ ] 문서 업데이트가 포함되었습니다.
  • 코드 리뷰를 위한 사전 검토를 완료했습니다.

📄 Description

# .env
streamlit_default_train_path="data/train_v2.0.1.csv"
# analysis_dashboard.py
import os
from dotenv import load_dotenv
...
load_dotenv()
...
df = pd.read_csv(os.getenv("streamlit_default_train_path"))

.env 파일은 이미 .gitignore에 추가되어 있어 Git에 추적되지 않습니다.

이를 활용해 디폴트 데이터셋 경로를 .env에서 관리하도록 변경하여,
데이터셋 버저닝이 업데이트되더라도 Streamlit 앱 코드는 추가 수정 없이 동작하도록 개선했습니다.

스크린샷 2024-11-21 183219

배포된 주소로 들어가시면 train_v2.0.1.csv에 대한 정보가 기본적으로 출력되는걸 확인하실 수 있습니다.

💡 Notice (Optional)

PR이 merge되면, 제가 공용서버의 .env를 수정해서 다시 배포하겠습니다.

Streamlit app에 대한 추가 기능 건의는 언제나 환영입니다.

🔗 Related Issue(s)

#27

@eyeol eyeol self-assigned this Nov 21, 2024
@eyeol eyeol requested a review from jagaldol November 21, 2024 09:54
@eyeol eyeol added Priority: Low 천천히 진행해도 되는 작업 Type: Enhancement 기능 개선 작업 labels Nov 21, 2024
Copy link
Contributor

@jagaldol jagaldol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotenv로부터 환경변수를 주입받는거니까

.env.example에도 streamlit_default_train_path를 기록해주는 게 좋을거 같아요!

@eyeol
Copy link
Contributor Author

eyeol commented Nov 21, 2024

dotenv로부터 환경변수를 주입받는거니까

.env.example에도 streamlit_default_train_path를 기록해주는 게 좋을거 같아요!

말씀해주신대로 .env.example에 추가했고, .env 컨벤션에 맞게 변수명을 STREAMLIT_DATA_PATH로 수정했습니다.

Copy link
Contributor

@jagaldol jagaldol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@eyeol eyeol merged commit 189f4b1 into main Nov 21, 2024
3 checks passed
@eyeol eyeol deleted the feature/27-streamlit branch November 21, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low 천천히 진행해도 되는 작업 Type: Enhancement 기능 개선 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants