-
Notifications
You must be signed in to change notification settings - Fork 1
fix pixi issues with merge #128
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
Merged
Merged
Conversation
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
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts template update and project rename scripts to regenerate pixi.lock instead of force-keeping the old version, and prevents blind string replacement inside the lockfile. Sequence diagram for updated template synchronization scriptsequenceDiagram
actor Developer
participant Script as update_from_template_sh
participant Git
participant Pixi
Developer->>Script: run update_from_template.sh
Script->>Git: fetch --all
Script->>Git: checkout main
Script->>Git: pull origin main
Script->>Git: checkout -B feature/update_from_template
Script->>Git: pull
Script->>Git: merge template/main --allow-unrelated-histories
Script->>Git: checkout --ours pixi.lock
Script->>Pixi: pixi update
Pixi-->>Script: regenerate pixi.lock based on merged pyproject_toml
Script->>Git: add pixi.lock
Script->>Git: diff --cached --quiet
alt lockfile changed
Script->>Git: commit -m chore: update pixi.lock after template merge
end
Script->>Git: remote remove template
Script->>Git: push --set-upstream origin feature/update_from_template
Script->>Git: checkout main
Script-->>Developer: script complete
Flow diagram for updated project rename script behaviorflowchart TD
A[Start rename_project_sh] --> B[Move directory python_template to new_name]
B --> C[Find files excluding .git directory]
C --> D[Exclude files named tasks.json]
D --> E[Exclude files named update_from_template.sh]
E --> F[Exclude file named pixi.lock]
F --> G[Perform sed replacement python_template -> new_name on remaining files]
G --> H[Run pixi update]
H --> I[Regenerate pixi.lock for renamed project]
I --> J{Author name provided}
J -->|Yes| K[Replace author placeholders]
J -->|No| L[Skip author replacement]
K --> M[End]
L --> M[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey - I've found 1 issue, and left some high level feedback:
- Both scripts now assume
pixiis installed and available onPATH; consider adding an explicit check with a clear error message (e.g.,command -v pixi >/dev/null || { echo 'pixi is required'; exit 1; }) to fail fast when it is missing. - In
rename_project.sh,pixi updatewill currently run unconditionally; consider guarding it with a check forpixi.lockor the expected project files so the script behaves more predictably when run in an unexpected directory.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Both scripts now assume `pixi` is installed and available on `PATH`; consider adding an explicit check with a clear error message (e.g., `command -v pixi >/dev/null || { echo 'pixi is required'; exit 1; }`) to fail fast when it is missing.
- In `rename_project.sh`, `pixi update` will currently run unconditionally; consider guarding it with a check for `pixi.lock` or the expected project files so the script behaves more predictably when run in an unexpected directory.
## Individual Comments
### Comment 1
<location> `scripts/rename_project.sh:6` </location>
<code_context>
# change project name in all files
-find . \( -type d -name .git -prune \) -o \( -type f -not -name 'tasks.json' -not -name 'update_from_template.sh' \) -print0 | xargs -0 sed -i "s/python_template/$1/g"
+find . \( -type d -name .git -prune \) -o \( -type f -not -name 'tasks.json' -not -name 'update_from_template.sh' -not -name 'pixi.lock' \) -print0 | xargs -0 sed -i "s/python_template/$1/g"
+
+# regenerate lockfile to match renamed project
</code_context>
<issue_to_address>
**issue:** Handle project names with characters that are special to sed
Using `sed -i "s/python_template/$1/g"` will fail or corrupt replacements when `$1` contains `/`, `&`, or other sed metacharacters. If arbitrary project names are expected, either restrict/validate allowed characters in `$1`, properly escape `$1` before passing it to sed, or switch to a safer mechanism (e.g., perl with `quotemeta` or a different sed delimiter plus escaping).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Summary by Sourcery
Regenerate the Pixi lockfile after template merges and project renaming instead of force-keeping the existing file, and exclude the lockfile from bulk search-and-replace operations during project rename.
Enhancements: