Skip to content

Conversation

@PtPrashantTripathi
Copy link
Member

This PR includes a series of enhancements and refactors aimed at improving the development workflow, code quality, and CLI tooling for the vedic project. Key areas of focus include:

  • CLI refactoring for reliability and usability
  • Pre-commit hook integration (Black, isort, pyupgrade, etc.)
  • Auto-formatting and code cleanup (Python and Rust)
  • Git diff/patch tooling support

Key Changes

CLI Improvements (tools/cli.py)

  • Refactored the CLI for clarity, modularity, and correctness

  • Fixed malformed argparse argument definitions

  • Added:

    • Clear-screen command (cross-platform)
    • Rust tool checks (cargo, wasm-pack, pre-commit)
    • Format command that runs cargo fmt and pre-commit
    • --verbose mode with unified logging
  • Improved subprocess handling and output

Code Formatting and Cleanup

  • Applied Black, isort, and pyupgrade on all Python files
  • Fixed inconsistent import orders and trailing whitespace
  • Renamed or removed unused variables where appropriate
  • Ran cargo fmt on Rust code for consistent formatting

Pre-commit Integration

  • Added .pre-commit-config.yaml with:

    • black, isort, pyupgrade
    • YAML, JSON, TOML validators
    • Trailing whitespace + newline fixers
  • Hook autoupdate metadata included (autoupdate_schedule, commit_msg)

  • Configured Python hooks to run using Python 3

Git Utilities

  • Documented and tested commands for:

    • Viewing staged diffs: git diff --cached --color-words
    • Creating patch files for unstaged changes
    • Setting file executable bits recursively and cleanly:
      chmod -x $(find tests/ -type f)
      git add --chmod=-x $(find tests/ -type f)

How to Test

  1. Run: python tools/cli.py --help to check all CLI options
  2. Run: python tools/cli.py -f to format and run hooks
  3. Ensure pre-commit run --all-files succeeds

Dependencies

  • Pre-commit should be installed:
    pip install pre-commit

  • Rust environment tools required:

    • cargo, rustc, wasm-pack

- Fixed broken Python syntax in `benchmark_test.py`
- Refactored `cli.py`:
  - Corrected typos and naming issues (e.g., `ENV_VARBOSE` → `ENV_VERBOSE`)
  - Improved command-line argument parsing consistency
  - Added support for running `pre-commit` after formatting
  - Enhanced user messages and command output
  - Ensured tool checks for cargo, wasm-pack, and pre-commit
@PtPrashantTripathi PtPrashantTripathi merged commit 3f8ec42 into main Jul 4, 2025
4 of 5 checks passed
@PtPrashantTripathi PtPrashantTripathi deleted the feat/vedic-cli-improvements branch July 4, 2025 16:17
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.

2 participants