Skip to content

refactor shared.py with a frozen CONFIG dataclass object #116

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

yangm2
Copy link
Contributor

@yangm2 yangm2 commented Jun 17, 2025

use a frozen dataclass object as a cannonical source of truth rather than mutable environment variables

  • consolidate os.getenv() calls to shared.py
    • centralize the resolution of defaults vs execution environment vs .env
  • create an immutable object with configuration data
  • avoid current-working-directory (i.e. CWD) assumptions for dir/file locations (i.e. DATA_DIR, .env). They will now be relative to the backend directory in the repo

@yangm2 yangm2 self-assigned this Jun 17, 2025
@yangm2 yangm2 force-pushed the refactor_shared_py branch from 33376e8 to 98df9b3 Compare June 17, 2025 18:32
@apkostka
Copy link
Contributor

I appreciate the refactor. I'm currently in the process of refactoring the chat module, and I've done a few things in that branch;

  • remove references to feedback / training as they are no longer used (including DATA_DIR)
  • move things in the shared module to their respective modules (DEFAULT_INSTRUCTIONS goes in chat.py)

I like what you've done with the config, maybe make a new module called config.py and move that there? I'd like to avoid having a generic shared module. Then this will be easier to merge with mine.

@yangm2 yangm2 added the backend Bot implementation and other backend concerns label Jun 17, 2025
@yangm2
Copy link
Contributor Author

yangm2 commented Jun 19, 2025

I'm going to put this on the back-burner until after #121 gets merged.

@yangm2 yangm2 linked an issue Jun 19, 2025 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Bot implementation and other backend concerns Not ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor to single-source-of-truth for environment variables
2 participants