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

Fix Linux build after python-appimage release disappeared #722

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

jonathanperret
Copy link
Contributor

@jonathanperret jonathanperret commented Oct 29, 2024

Problem

Fixes #721 — at least until python-appimage breaks us again.

Proposed solution

This PR slightly changes the logic used to download the python-appimage build: instead of a hardcoded .9 added to the specified Python version (3.11), the build now uses a full Python version (e.g. 3.11.10) and tries to download a matching python-appimage build.

Note that the mismatch between the Python versions used for Windows and macOS (3.11.9) on one side, and Linux (3.11.10) on the other, is caused by the fact that:

  • a python-appimage build is now only available for Python 3.11.10;
  • actions/setup-python cannot install Python 3.11.10 on Windows or macOS (apparently because Python 3.11 is EOL, there are no longer official binaries distributions for the security updates).

Note that because we previously were not specifying the full Python version, these specific versions were already being used by the build.

I'd like to investigate the https://github.com/niess/python-appimage release process a bit more to understand why they remove previously published assets, but for the immediate term this fix should let us continue building AYAB releases.

Summary by CodeRabbit

  • New Features

    • Enhanced clarity in Python version handling within GitHub Actions workflows.
  • Bug Fixes

    • Updated Python versions in multiple workflows to more specific minor versions, improving consistency and reliability in builds and tests.
  • Chores

    • Restructured workflow steps for clearer execution order and improved output variable naming conventions.

@jonathanperret jonathanperret self-assigned this Oct 29, 2024
Copy link
Contributor

coderabbitai bot commented Oct 29, 2024

Warning

Rate limit exceeded

@jonathanperret has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Files that changed from the base of the PR and between e8f64f1 and 491d9a5.

Walkthrough

The pull request introduces modifications to several GitHub Actions workflows. Key changes include renaming the output variable for Python version handling, updating Python versions across multiple jobs to more specific minor versions, and restructuring workflow steps for clarity. The updates ensure that the workflows correctly reflect the new naming conventions and utilize precise Python versions, especially addressing issues related to the python-appimage dependency.

Changes

File Change Summary
.github/actions/init-environment/action.yml Renamed output variable python to python-minor, updated python-appimage, and restructured steps for clarity.
.github/workflows/build-multi-os.yml Updated Python versions in jobs from 3.11 to 3.11.9 (for setup, build-windows, build-macos) and to 3.11.10 (for build-appimage). Adjusted AppImage download commands accordingly.
.github/workflows/python_tests.yml Updated Python version in matrix strategy from 3.11 to 3.11.10.

Assessment against linked issues

Objective Addressed Explanation
Ensure python-appimage dependency is correctly referenced (721)

Possibly related PRs

Suggested reviewers

  • dl1com

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (3)
.github/workflows/python_tests.yml (1)

13-13: Add a comment explaining the version discrepancy.

To prevent future confusion about the different Python versions used across platforms (3.11.9 for Windows/macOS vs 3.11.10 for Linux), consider adding a comment.

+        # Using Python 3.11.10 specifically for Linux builds due to python-appimage availability
         python-version: [3.11.10]
.github/actions/init-environment/action.yml (1)

Line range hint 18-33: Consider adding AppImage availability check.

To prevent future build failures, it would be helpful to verify the AppImage existence before proceeding with the build.

Add a new step after Python setup:

- name: Verify AppImage availability
  shell: bash
  run: |
    APPIMAGE_URL="https://github.com/niess/python-appimage/releases/download/python${{steps.py.outputs.python-version}}/${{steps.vars.outputs.python-appimage}}"
    if ! curl --output /dev/null --silent --head --fail "$APPIMAGE_URL"; then
      echo "::error::AppImage not found at $APPIMAGE_URL"
      exit 1
    fi
.github/workflows/build-multi-os.yml (1)

27-27: LGTM! Consider documenting version split rationale.

The Python version split (3.11.9 for Windows/macOS, 3.11.10 for Linux) is a valid workaround for the python-appimage availability issue. However, this divergence might need attention in future updates.

Consider adding a comment in the workflow file explaining why different Python versions are used across platforms to help future maintainers understand this decision.

Also applies to: 176-176, 304-304, 427-427

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 205d651 and e8f64f1.

📒 Files selected for processing (3)
  • .github/actions/init-environment/action.yml (2 hunks)
  • .github/workflows/build-multi-os.yml (6 hunks)
  • .github/workflows/python_tests.yml (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/build-multi-os.yml

460-460: shellcheck reported issue in this script: SC2086:info:1:19: Double quote to prevent globbing and word splitting

(shellcheck)


460-460: shellcheck reported issue in this script: SC2086:info:2:56: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (6)
.github/workflows/python_tests.yml (1)

13-13: LGTM! Verify test consistency across platforms.

The update to Python 3.11.10 aligns with the Linux build requirements. However, since Windows and macOS builds use 3.11.9, we should ensure test results remain consistent across platforms.

Let's verify the Python package dependencies:

✅ Verification successful

Version difference is intentional and safe

The Python version difference between platforms (3.11.10 for Linux, 3.11.9 for Windows/macOS) is intentionally coordinated across the build workflows. The requirements files show no Python version-specific dependencies or constraints that would be affected by this minor version difference.

Key findings:

  • Linux build specifically needs 3.11.10 for AppImage compatibility
  • All dependencies use compatible version ranges
  • No Python version constraints found in requirements files
  • Core dependencies (PySide6, PyInstaller, etc.) are pinned to specific versions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any version-specific dependencies that might be affected
# by the Python version difference between platforms.

# Test: Look for Python version constraints in requirements
rg -A 5 "python_version|Python>=|Python==|Python>|Python<" requirements.txt

# Test: Look for setup.py version constraints
rg -A 5 "python_version|Python>=|Python==|Python>|Python<" setup.py

Length of output: 196


Script:

#!/bin/bash
# Let's try different approaches to find Python dependency files and version constraints

# Find all potential Python dependency files
fd -e txt -e toml -e cfg -e ini -e yaml -e yml . | grep -iE 'require|depend|python|setup|pip'

# Look for Python version constraints in any file
rg -g '!.git' -l "python_version|Python>=|Python==|Python>|Python<"

# Check if pyproject.toml exists and examine its contents
if [ -f "pyproject.toml" ]; then
    echo "=== pyproject.toml contents ==="
    cat pyproject.toml
fi

# Look for any Python version references in workflow files
rg "python-version" .github/workflows/

Length of output: 849


Script:

#!/bin/bash
# Let's examine the contents of requirements files to check for version constraints

echo "=== requirements.txt ==="
cat requirements.txt

echo -e "\n=== requirements.build.txt ==="
cat requirements.build.txt

echo -e "\n=== windows_build_requirements.txt ==="
cat windows-build/windows_build_requirements.txt

# Also check the workflow files for any Python-dependent steps
echo -e "\n=== build-multi-os.yml ==="
cat .github/workflows/build-multi-os.yml

Length of output: 24645

.github/actions/init-environment/action.yml (3)

18-23: LGTM! Good improvements to the Python setup.

The changes include:

  • Using the latest version (v5) of setup-python action
  • Enabling pip caching for better performance
  • Proper step ordering to ensure outputs are available

32-32: LGTM! Clean version string manipulation.

The sed command correctly extracts the minor version (e.g., "3.11" from "3.11.10").


11-12: Verify the impact of renaming the output variable.

The output variable has been renamed from python to python-minor, which better reflects its content. However, this is a breaking change that could affect other workflows.

Let's check for any references to the old output name:

✅ Verification successful

Renaming output from python to python-minor is safe

Based on the evidence from the git history and workflow usage:

  1. The action was newly introduced in commit 205d651 and only modified once in e8f64f1
  2. The only usage of this output is in the Linux build workflow where it's used as steps.vars.outputs.python-minor to download the Python AppImage
  3. The rename from python to python-minor was part of the same commit that modified the AppImage download logic
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for references to the old output name in workflow files
# Test: Look for references to python output. Expect: No references to the old name.
rg -g '*.yml' -g '*.yaml' "steps\.vars\.outputs\.python[^-]"

Length of output: 62


Script:

#!/bin/bash
# Let's try a broader search pattern to catch any references to the output
# This will help us find both old and new usage patterns
rg -g '*.yml' -g '*.yaml' "outputs\.python" -A 2 -B 2

Length of output: 55


Script:

#!/bin/bash
# Let's also check for any direct references to the action itself
# to understand its usage context
rg -g '*.yml' -g '*.yaml' "uses.*init-environment" -A 5 -B 2

Length of output: 62


Script:

#!/bin/bash
# Let's examine the complete init-environment action file
# to understand the full context of changes
cat .github/actions/init-environment/action.yml

Length of output: 1741


Script:

#!/bin/bash
# Let's search for any workflow files that use this action
# and check their actual usage of outputs
fd -e yml -e yaml . .github/workflows/ -x cat {} \; | grep -A 10 -B 2 "init-environment"

Length of output: 2215


Script:

#!/bin/bash
# Let's also check git history to see if this is a new action
# or if there are previous versions we should compare
git log --patch -- .github/actions/init-environment/action.yml

Length of output: 5443

.github/workflows/build-multi-os.yml (2)

443-443: LGTM! Improved URL construction for python-appimage.

The dynamic URL construction using python-minor version makes the workflow more maintainable and resilient to version changes.


457-457: LGTM! Consistent version variable usage.

The PATH configuration correctly uses the same python-minor version variable, maintaining consistency with the AppImage changes.

Also applies to: 462-462

.github/actions/init-environment/action.yml Show resolved Hide resolved
.github/workflows/build-multi-os.yml Show resolved Hide resolved
This should give us more control over which exact Python
version we're using for the build (i.e. 3.11.9 vs. 3.11.10).

For the Linux build, this also lets us select a version which has
a `python-appimage` build available.
Copy link

@jonathanperret jonathanperret requested a review from dl1com October 30, 2024 19:43
@dl1com dl1com merged commit b9483a7 into AllYarnsAreBeautiful:main Oct 31, 2024
2 checks passed
@dl1com
Copy link
Contributor

dl1com commented Oct 31, 2024

Thanks for taking care of this...supporting multiple OS is hard :(

@jonathanperret jonathanperret deleted the fix-appimage-build branch October 31, 2024 14:04
@coderabbitai coderabbitai bot mentioned this pull request Nov 30, 2024
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.

[BUG] Linux build is broken because of missing python-appimage dependency
2 participants