Skip to content

[Refactor] Introduce centralized ConfigManager for safe JSON access #2

Open
aviralsaxena16 wants to merge 2 commits intoOSIPI:mainfrom
aviralsaxena16:lightweight-config-manager
Open

[Refactor] Introduce centralized ConfigManager for safe JSON access #2
aviralsaxena16 wants to merge 2 commits intoOSIPI:mainfrom
aviralsaxena16:lightweight-config-manager

Conversation

@aviralsaxena16
Copy link

Resubmitting this PR to the new repository per guidance.

Motivation

The GSoC project description specifies that model and fitting parameters should be driven via JSON configuration rather than hardcoded logic.

Currently, scripts directly use json.load("config.json"), which can lead to runtime KeyError crashes if expected nested keys are missing.

This PR introduces a lightweight ConfigManager utility that centralizes configuration loading and provides safe nested access via .get().

What This PR Introduces

  • Adds core/config_manager.py
  • Provides a centralized loader to eventually replace direct json.load() calls
  • Introduces safe nested access helper to prevent KeyErrors
  • No changes to mathematical logic
  • No schema redesign (keeps existing config format intact)

Why This Approach

This is a minimal, non-breaking step toward the modular JSON-driven execution required by the GSoC project, while preserving full backward compatibility.

If this direction aligns with expectations, future iterations can introduce:

  • Default schema validation
  • Execution block abstraction
  • Model/fitter selection via config

I welcome any feedback on this approach!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant