Skip to content

Refactor mkconcore.py into a modular build system #310

@avinxshKD

Description

@avinxshKD

The mkconcore.py script has grown into a monolithic 1200+ line file that handles critical build logic for multiple platforms (Windows, POSIX, Docker), graph parsing, and code generation for various languages (Python, C++, Verilog, Matlab).

Current Issues:

  • Monolithic Structure: All logic (graph parsing, file I/O, script generation) is mixed in a single linear execution floww
  • Hard Maintenance: Adding support for a new language or platform requires modifying multiple scattered sections of the script
  • Fragile String Generation: Shell scripts and batch files are generated via extensive string concatenation, which is error-prone
  • Implicit Dependencies: The script relies on hardcoded path resolutions and specific file naming conventions that are brittle

Proposed Changes: Refactor mkconcore.py into a modular package structure, separating concerns:

  • Builder Class: Abstract base class for platform-specific builders (DockerBuilder, PosixBuilder, WindowsBuilder).
  • GraphParser Class: Dedicated class for parsing GraphML and extracting node/edge metadata
  • ScriptGenerator Class: Logic for generating run/build/stop scripts, replacing string concatenation with templates (e.g., using jinja2 or cleaner string formatting),
  • Encapsulation: Move global variables and constants into a configuration class or module

This refactoring will significantly improve testability and extensibility. It involves rewriting/moving ~1200 lines of code but should preserve exact functionality.

Verification:, Existing tests in tests/test_cli.py cover the end-to-end flow via the CLI and should pass without modification after refactoring

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions