Skip to content
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

feat: Implement automatic execution of rollback scripts #44

Closed
wants to merge 2 commits into from

Conversation

Tql-ws1
Copy link
Contributor

@Tql-ws1 Tql-ws1 commented Jan 16, 2025

See #37 and #6 (comment) for details

Tests -

  • Added test cases for rollbacker.py

Refactor -

  • Split the rollbacker.rollback() function

Style -

  • Formatted main.py, os_utils.py, rollbacker.py, and rollbacker_test.py using isort and black
    • isort --python-version 310 --profile google --line-length 80 --src-path "src/code"
    • black --line-length 80 --target-version py310 --target-version py311 --target-version py312

See hirak99#37 and hirak99#6 (comment) for details

Tests -
- Added test cases for rollbacker.py

Refactor -
- Split the rollbacker.rollback() function

Style -
- Formatted main.py, os_utils.py, rollbacker.py, and rollbacker_test.py using isort and black
  - `isort --python-version 310 --profile google --line-length 80 --src-path "src/code"`
  - `black --line-length 80 --target-version py310 --target-version py311 --target-version py312`
@Tql-ws1
Copy link
Contributor Author

Tql-ws1 commented Jan 16, 2025

Actually, I also made changes to pyproject.toml and run_full_test.sh, but I didn't commit them. This is why the Github automated build failed.

The changes are as follows:

diff --git a/pyproject.toml b/pyproject.toml
index 6b8565a..14d3426 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,18 @@
 [tool.pyright]
 include = ["src"]
-exclude = [
-    "**/__pycache__",
-]
+exclude = ["**/__pycache__"]
 ignore = []
 defineConstant = {}
-
 reportPrivateUsage = true
-
 pythonVersion = "3.10"
 pythonPlatform = "Linux"
+
+[tool.black]
+line-length = 80
+target-version = ["py310", "py311", "py312"]
+
+[tool.isort]
+py_version = 310
+line_length = 80
+profile = "google"
+src_paths = ["src/code"]
diff --git a/src/run_full_tests.sh b/src/run_full_tests.sh
index 04cc500..bf32ab3 100755
--- a/src/run_full_tests.sh
+++ b/src/run_full_tests.sh
@@ -21,7 +21,7 @@ readonly MY_PATH=$(cd $(dirname "$0") && pwd)
 
 cd ${MY_PATH}
 
-black --check code/
+black -l 80 -t py310 -t py311 -t py312 --check code/
 
 pyright code/
 

@Tql-ws1
Copy link
Contributor Author

Tql-ws1 commented Jan 16, 2025

I didn't update the feat branch with the latest commit from the main branch. I will open a new PR later. 😅

@Tql-ws1 Tql-ws1 closed this Jan 16, 2025
@Tql-ws1 Tql-ws1 deleted the add-rollback-subcommand branch January 16, 2025 15:40
@hirak99
Copy link
Owner

hirak99 commented Jan 16, 2025

I didn't update the feat branch with the latest commit from the main branch. I will open a new PR later. 😅

No probs, thanks a lot!

hirak99 added a commit that referenced this pull request Jan 17, 2025
Also added some additional changes such as documentation.

- Reformatted a few files.
- batch_deleter: Removed interactive_confirm (it's already in os_utils).
- os_utils.interactive_confirm: Moved [Y/n] prompt there.
- rollback.py
  - Reorganized rollback() and some functions.
  - Removed some trivial functions.
  - Using a temporary directory to save script to prevent any collusion.
  - Honor the dry-run flag, and do not actually execute if it is set.
  - Added few tests.
  - Updated README.md and manpage.

Related to #37, #44, #45.
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