Drop Terragrunt support and modernize Python codebase#89
Merged
Conversation
Strip out all Terragrunt-specific logic, arguments, and classes (e.g., TerragruntTest). Remove Terragrunt test fixtures and associated test files (test_tg_all.py). Clean up test_args.py to remove Terragrunt argument tests. Update README.md to remove the Terragrunt documentation. Going forward, this library will only support Terraform and OpenTofu.
- Remove legacy Python 2 future imports. - Migrate string formatting to f-strings via flynt. - Replace os.path usage with pathlib.Path. - Add comprehensive type hinting to TerraformTest and related methods.
Replaced long list of if/elif statements with declarative mappings (bool_flags, inverse_bool_flags, kv_flags) to simplify adding new flags and reduce cyclomatic complexity.
Add .style.yapf using google style to match the Cloud Foundation Fabric repository. Apply yapf formatting across all python files.
Replace autopep8 with yapf in the GitHub Actions linting workflow and DEV-REQUIREMENTS.txt to enforce the new Google-style formatting rules defined in .style.yapf.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a major cleanup and modernization of the library. It strips out all Terragrunt-specific functionality to focus exclusively on Terraform and OpenTofu going forward. Additionally, it modernizes the Python codebase by adopting newer standard library features, adding type hints, and refactoring internal logic for better maintainability.
1. Removal of Terragrunt Support
TerragruntTestclass and all associatedtg_*arguments.test_tg_all.py) and fixtures.README.mdto remove Terragrunt documentation.2. Python Modernization
__future__imports.%sand.format()string formatting to modern f-strings.os.pathandglobusage withpathlib.Pathfor safer and more idiomatic file system operations.typing) toTerraformTestpublic methods (plan,apply,init, etc.) to significantly improve IDE autocompletion and developer experience.3. Internal Refactoring
parse_argsfunction. Replaced a massive block ofif/elifstatements with declarative dictionary mappings (bool_flags,inverse_bool_flags,kv_flags). This drastically reduces cyclomatic complexity and makes adding new Terraform CLI flags trivial in the future.Testing
pytestin an isolated virtual environment.