Skip to content

Conversation

@jansaldo
Copy link
Contributor

@jansaldo jansaldo commented Aug 8, 2025

This pull request updates the backend dependency to a new version and enhances the frontend installation process by ensuring the required Archivo font is installed if not already present. The changes improve both dependency management and user experience during installation.

Dependency update:

  • Updated the backend dependency from aymurai-1.1.10-py3-none-any.whl to aymurai-1.1.11-py3-none-any.whl in resources/environment.yml, scripts/headers/install_backend.nsh (installation and cleanup steps). [1] [2] [3]

Installer enhancements:

  • Added logic to scripts/headers/install_frontend.nsh to check for the presence of any Archivo font in the Windows Fonts directory; if not found, the Archivo font is copied, registered, and cleaned up after installation. [1] [2]

Summary by Sourcery

Update the backend package to the latest release and enhance the frontend installation process to auto-install the required Archivo font if not present

New Features:

  • Add detection and automatic installation of the Archivo font in the Windows frontend installer

Enhancements:

  • Upgrade the aymurai backend dependency to version 1.1.11 in environment configuration and installer scripts

@jansaldo jansaldo requested review from Copilot and jedzill4 August 8, 2025 19:59
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 8, 2025

Reviewer's Guide

This PR bumps the backend wheel dependency from version 1.1.10 to 1.1.11 and extends the NSIS frontend installer to automatically detect and install the Archivo font on Windows if it’s not already present.

Flow diagram for Archivo font installation logic in frontend installer

flowchart TD
    A[Start Frontend Installation] --> B{Is Frontend Installed?}
    B -- Yes --> C[Skip Download]
    B -- No --> D[Download Frontend]
    C --> E[Check for Archivo Font]
    D --> E[Check for Archivo Font]
    E -- Found --> F[Finish]
    E -- Not Found --> G[Copy Archivo Font File]
    G --> H[Copy to Windows Fonts]
    H --> I[Add Registry Entry]
    I --> J[Remove Temp Font File]
    J --> F[Finish]
Loading

File-Level Changes

Change Details Files
Bumped backend dependency version
  • Updated wheel file reference in install_backend.nsh to 1.1.11
  • Updated cleanup step in install_backend.nsh to delete the 1.1.11 wheel
  • Updated pip dependency in environment.yml to use version 1.1.11
scripts/headers/install_backend.nsh
resources/environment.yml
Added automatic Archivo font installation in frontend installer
  • Defined ARCHIVO_FONT path for the font file
  • Checked Windows registry for existing Archivo font entries via PowerShell
  • On missing font, copied, registered, and force-copied the font to C:\Windows\Fonts
  • Removed the temporary font file after successful installation
scripts/headers/install_frontend.nsh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jansaldo - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `scripts/headers/install_frontend.nsh:64` </location>
<code_context>
+
+    install_archivo_font:
+        ; Check if any Archivo font already exists in Windows Fonts
+        nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'
+        Pop $0
+        StrCmp $0 "0" finish archivo_font_install
+
+        archivo_font_install:
</code_context>

<issue_to_address>
PowerShell registry check may require elevation and could fail silently.

Since HKLM access often requires admin rights, the registry check may fail or give incorrect results if run without elevation. Please ensure permission errors are detected and communicated to the user.
</issue_to_address>

### Comment 2
<location> `scripts/headers/install_frontend.nsh:75` </location>
<code_context>
+            File "${ARCHIVO_FONT}"
+
+            ; Copy Archivo font file to Windows Fonts
+            nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
+            
+            ; Add registry entry for the font
</code_context>

<issue_to_address>
Copying directly to C:\Windows\Fonts may fail without admin rights.

Check for administrator privileges before copying the font, or implement a fallback if elevation is not available.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 64 to 66
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'
Pop $0
StrCmp $0 "0" finish archivo_font_install
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): PowerShell registry check may require elevation and could fail silently.

Since HKLM access often requires admin rights, the registry check may fail or give incorrect results if run without elevation. Please ensure permission errors are detected and communicated to the user.

File "${ARCHIVO_FONT}"

; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Copying directly to C:\Windows\Fonts may fail without admin rights.

Check for administrator privileges before copying the font, or implement a fallback if elevation is not available.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates the backend dependency from version 1.1.10 to 1.1.11 and adds automatic Archivo font installation to improve the frontend user experience. The changes ensure users have the required font for proper application display.

  • Updated backend dependency version across installation scripts and environment configuration
  • Added automatic Archivo font detection and installation during frontend setup
  • Enhanced installer cleanup to remove temporary font files after installation

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 4 comments.

File Description
scripts/headers/install_frontend.nsh Added Archivo font detection, installation, and cleanup logic
scripts/headers/install_backend.nsh Updated backend wheel file references from v1.1.10 to v1.1.11
resources/environment.yml Updated pip dependency to use the new backend wheel version


install_archivo_font:
; Check if any Archivo font already exists in Windows Fonts
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

Using -ExecutionPolicy Bypass disables PowerShell's execution policy security feature. Consider using a more restrictive execution policy or implementing alternative font detection methods.

Suggested change
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy RemoteSigned -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'

Copilot uses AI. Check for mistakes.
File "${ARCHIVO_FONT}"

; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

Hard-coded system path 'C:\Windows\Fonts' may not work on all Windows installations. Consider using environment variables like '%WINDIR%\Fonts' or PowerShell's $env:SystemRoot for better compatibility.

Suggested change
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"$env:SystemRoot\Fonts\" -Force"'

Copilot uses AI. Check for mistakes.
Comment on lines 68 to 84
archivo_font_install:
; Copy Archivo font file
DetailPrint "Installing Archivo font..."
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"

; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'

; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."

; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"

Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

Modifying HKLM registry requires administrator privileges. The installation should verify elevated permissions before attempting registry modifications, or handle potential access denied errors gracefully.

Suggested change
archivo_font_install:
; Copy Archivo font file
DetailPrint "Installing Archivo font..."
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."
; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"
archivo_font_install:
; Check for administrator privileges before modifying HKLM
UserInfo::GetAccountType
Pop $0
StrCmp $0 "admin" 0 not_admin
; Copy Archivo font file
DetailPrint "Installing Archivo font..."
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
Pop $1
StrCmp $1 "0" font_reg_success font_reg_fail
font_reg_fail:
MessageBox MB_OK|MB_ICONEXCLAMATION "Failed to add font registry entry. Please run the installer as administrator."
Abort
font_reg_success:
DetailPrint "Archivo font installed successfully."
; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"
Goto finish
not_admin:
MessageBox MB_OK|MB_ICONEXCLAMATION "Administrator privileges are required to install the Archivo font. Please run the installer as administrator."
Abort

Copilot uses AI. Check for mistakes.
Comment on lines 71 to 84
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"

; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'

; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."

; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"

Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The font file is copied to $INSTDIR temporarily and then deleted. Consider copying directly to the destination to avoid unnecessary file operations and potential cleanup issues if the installation fails.

Suggested change
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."
; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"${ARCHIVO_FONT}\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."

Copilot uses AI. Check for mistakes.
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