halmos icon indicating copy to clipboard operation
halmos copied to clipboard

[Feature/#125] Enhance configuration management by using toml configuration file

Open pillip opened this issue 1 year ago • 1 comments

Change Type

  • [ ] Bug fix (Not Breaking-change. Solve issue.)
  • [x] New feature (Not Breaking-change. Add new feature.)
  • [ ] Breaking change (Bug fix or New featrure that cause Breaking change.)
  • [ ] Code Convention (Edit Code Convention.)
  • [ ] Refactoring (Refactor Code without feature change.)

Description

This PR introduces enhancements to the configuration management and parsing functionalities of the Halmos project, improving flexibility, usability, and testing robustness. Key changes include the integration of the TOML configuration logic(loading and parsing), fixing a typo in the Black configuration, and ensuring that new functionalities are thoroughly tested.

Related Issues

This PR resolves #125

Changes

  1. Dependency and configuration fix
  • Added toml as a dependency in pyproject.toml to enable TOML file operations.
  • Corrected a typo from target-versions to target-version in the Black configuration, ensuring proper adherence to formatting standards.
  1. toml Configuration File Loading and Parsing
  • Imported necessary packages (os and toml) to facilitate file operations for TOML configurations.
  • Added -f and --configure command-line arguments to specify the path to the TOML configuration file.
  • Implemented load_configure_file function to verify the existence of the configuration file and load its contents.
  • Developed parse_configure_file function to integrate the loaded configuration into the existing argparse arguments.
  • Included a usage example file (halmos.toml) and added pytest tests to validate the functionality of the new loading and parsing routines.
  1. Application of Configuration Parsing in Main Functionality
  • Integrated parse_configure_file function into the main application flow, ensuring that configurations are correctly parsed and applied at runtime.

Tests

pytest tests/test_parser.py

pillip avatar May 22 '24 23:05 pillip

thanks @pillip, this has been long requested! I'll take a detailed look tomorrow

0xkarmacoma avatar May 23 '24 00:05 0xkarmacoma