-
Notifications
You must be signed in to change notification settings - Fork 0
fix: execute cli commands from project root #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR ensures that CLI commands execute from the project’s root directory rather than the user’s current directory. Key changes include:
- Adding project root detection functions and integrating them into the CLI initialization.
- Updating project setup and translation state management via the diff_state directory.
- Refactoring installation and synchronization processes across multiple modules.
Reviewed Changes
File | Description |
---|---|
i18nilize/src/internationalize/project_root_utils.py | Added functions to locate and return the project root directory. |
core/Pipfile | Introduced dependency specifications and Python version definition. |
i18nilize/src/internationalize/package_init_utils.py | Added functions to initialize and validate the package setup. |
setup.py | Updated custom install command and project root detection logic. |
i18nilize/src/internationalize/globals.py | Updated global config values and endpoint definitions. |
i18nilize/src/internationalize/diffing_processor.py | Refactored DiffingProcessor for diff state management and file syncing. |
i18nilize/src/internationalize/sync_processor.py | Updated pull and push translation logic with consistent path usage. |
i18nilize/src/internationalize/command_line.py | Updated CLI command parsing and initialization to use the project root. |
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
i18nilize/src/internationalize/diffing_processor.py:68
- Prefer using 'is None' instead of '== None' for comparisons with None.
if hash_dict == None:
i18nilize/src/internationalize/diffing_processor.py:191
- Avoid using 'type' as a parameter name because it shadows the built-in function 'type'. Consider renaming it to something like 'template_type'.
def __initialize_changed_template(self, type):
i18nilize/src/internationalize/diffing_processor.py:90
- The word 'occured' is misspelled; please change it to 'occurred'.
print(f"An exception occured: {e}")
Previously, CLI commands would execute relative to the user's current directory. Now, CLI commands execute from the project root directory regardless of the user's current directory.
Functionality added:
diff_state
folder is deleted).The main files where relevant changes occurred are:
i18nilize/src/internationalize/command_line.py
i18nilize/src/internationalize/package_init_utils.py
i18nilize/src/internationalize/project_root_utils.py
The rest of the changes were to adapt components and tests to use the dynamically set project root variable instead of hardcoded values.
Note: my IDE formats files when saving so the diff shows a lot of unrelated changes to formatting, my bad 😅