Skip to content

feat: compile with mypyc and add install scripts#58

Merged
kowyo merged 6 commits intomainfrom
feat/mypyc-build
Apr 28, 2026
Merged

feat: compile with mypyc and add install scripts#58
kowyo merged 6 commits intomainfrom
feat/mypyc-build

Conversation

@kowyo
Copy link
Copy Markdown
Owner

@kowyo kowyo commented Apr 28, 2026

Compile the package with mypyc for native performance and streamline installation.

Build

  • Switch from uv_build to setuptools + mypyc

Type fixes

  • agent.py: annotate working_status/thinking_status as Status | None
  • models.py: annotate model_id as str | None at first assignment

CI

  • Matrix build across ubuntu/macos/windows; ubuntu builds sdist + wheel, others wheel only
  • Release job updates README install version and uploads platform-native wheels

Install scripts

  • install.sh: macOS/Linux — detects arch, prefers native wheel, falls back to pure Python
  • install.ps1: Windows — same logic via Invoke-RestMethod

Makefile

  • Add build (uv build --wheel) and clean targets
  • Scope ty check to src/ to exclude setup.py

- Switch build backend to setuptools + mypyc; compile all modules
  except __init__.py (avoids __path__ init bug with compiled packages)
- Add mypy config: mypy_path, ignore_missing_imports, yaml override
- Fix type errors: narrow Status|None in agent.py, annotate model_id
- Update CI: matrix build (ubuntu/macos/windows), release job updates
  README version and uploads platform-native wheels
- Add install.sh (macOS/Linux) and install.ps1 (Windows) to install
  the latest release wheel via uv tool install
- Add Makefile targets: build, clean; scope ty check to src/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gemini-code-assist[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-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.

3 issues found across 9 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="README.md">

<violation number="1" location="README.md:18">
P1: Pin the PowerShell install script URL to a release tag/commit instead of `main` before piping to `iex` to avoid executing mutable remote code.</violation>
</file>

<file name="install.sh">

<violation number="1" location="install.sh:17">
P2: `aarch64` is normalized to `arm64`, which breaks Linux ARM wheel matching (`manylinux`/`musllinux` wheels are tagged `aarch64`).</violation>

<violation number="2" location="install.sh:35">
P1: The script assumes `uv` is installed; the documented one-line installer will fail on fresh systems without a prerequisite check or guidance.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread README.md Outdated
Comment thread scripts/install.sh Outdated
Comment thread scripts/install.sh
esac

case "${ARCH}" in
arm64|aarch64) ARCH_TAG="arm64" ;;
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 28, 2026

Choose a reason for hiding this comment

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

P2: aarch64 is normalized to arm64, which breaks Linux ARM wheel matching (manylinux/musllinux wheels are tagged aarch64).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At install.sh, line 17:

<comment>`aarch64` is normalized to `arm64`, which breaks Linux ARM wheel matching (`manylinux`/`musllinux` wheels are tagged `aarch64`).</comment>

<file context>
@@ -0,0 +1,36 @@
+esac
+
+case "${ARCH}" in
+  arm64|aarch64) ARCH_TAG="arm64" ;;
+  x86_64)        ARCH_TAG="x86_64" ;;
+  *) echo "Unsupported architecture: ${ARCH}"; exit 1 ;;
</file context>
Fix with Cubic

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

- Add interactive check in install.sh and install.ps1
- If uv is not found, ask user and install it automatically
- Improve formatting of 'From source' section in README

Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

@kowyo kowyo force-pushed the feat/mypyc-build branch from 897d671 to c2d896c Compare April 28, 2026 09:21
…rectory

Pin install script URLs to v0.12.0 instead of main to avoid executing
mutable remote code via iex/bash. Move install.ps1 and install.sh into
a scripts/ directory for better project organization.

Also update CI release workflow to auto-bump the version tag in both
install script URLs in README.md on new releases.

Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.com>
@kowyo kowyo force-pushed the feat/mypyc-build branch from c2d896c to c96509f Compare April 28, 2026 09:24
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/install.sh">

<violation number="1" location="scripts/install.sh:10">
P2: The default reply value conflicts with `[Y/n]`: pressing Enter now defaults to `n` and aborts instead of installing `uv`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread scripts/install.sh
if ! command -v uv &>/dev/null; then
echo "'uv' is required but not installed."
read -r -p "Would you like to install uv now? [Y/n] " REPLY </dev/tty
if [[ "${REPLY:-n}" =~ ^[Yy]$ ]]; then
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 28, 2026

Choose a reason for hiding this comment

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

P2: The default reply value conflicts with [Y/n]: pressing Enter now defaults to n and aborts instead of installing uv.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/install.sh, line 10:

<comment>The default reply value conflicts with `[Y/n]`: pressing Enter now defaults to `n` and aborts instead of installing `uv`.</comment>

<file context>
@@ -7,7 +7,7 @@ API_URL="https://api.github.com/repos/${REPO}/releases/latest"
   echo "'uv' is required but not installed."
   read -r -p "Would you like to install uv now? [Y/n] " REPLY </dev/tty
-  if [[ "${REPLY:-y}" =~ ^[Yy]$ ]]; then
+  if [[ "${REPLY:-n}" =~ ^[Yy]$ ]]; then
     echo "Installing uv..."
     curl -LsSf https://astral.sh/uv/install.sh | sh
</file context>
Suggested change
if [[ "${REPLY:-n}" =~ ^[Yy]$ ]]; then
if [[ "${REPLY:-y}" =~ ^[Yy]$ ]]; then
Fix with Cubic

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 12 additional findings in Devin Review.

Open in Devin Review

Comment thread scripts/install.sh
if ! command -v uv &>/dev/null; then
echo "'uv' is required but not installed."
read -r -p "Would you like to install uv now? [Y/n] " REPLY </dev/tty
if [[ "${REPLY:-n}" =~ ^[Yy]$ ]]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 install.sh default reply is 'n' but prompt convention [Y/n] implies default is 'Y'

On line 10, ${REPLY:-n} sets the default to n when the user presses Enter without typing anything. However, the prompt on line 9 uses the [Y/n] convention (capital Y), which universally signals that pressing Enter should accept (i.e., default to 'Y'). As a result, a user who presses Enter expecting to proceed with installation will instead get the "Aborting" message. Compare with the PowerShell version (scripts/install.ps1:7) which correctly handles the empty-input case by checking $reply -eq "" first.

Suggested change
if [[ "${REPLY:-n}" =~ ^[Yy]$ ]]; then
if [[ "${REPLY:-Y}" =~ ^[Yy]$ ]]; then
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

- Default uv install prompt from [Y/n] to [Y/n] requiring explicit y/Y
- Add || true to grep pipelines in install.sh to prevent set -euo pipefail
  from silently exiting when no platform-specific wheel is found

Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-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.

2 issues found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/install.ps1">

<violation number="1" location="scripts/install.ps1:7">
P2: This change breaks the `[Y/n]` default behavior: empty input is no longer treated as consent, so pressing Enter aborts installation unexpectedly.</violation>
</file>

<file name="scripts/install.sh">

<violation number="1" location="scripts/install.sh:39">
P2: `|| true` on the asset-fetch pipeline hides real curl/API failures and can produce a misleading "No compatible wheel found" error instead of failing at the fetch step.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread scripts/install.ps1
Comment thread scripts/install.sh
Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 12 additional findings in Devin Review.

Open in Devin Review

Comment thread scripts/install.ps1
@kowyo kowyo merged commit e2adb97 into main Apr 28, 2026
12 checks passed
@kowyo kowyo deleted the feat/mypyc-build branch April 28, 2026 09:48
kowyo added a commit that referenced this pull request Apr 28, 2026
* feat: compile with mypyc and add install scripts

- Switch build backend to setuptools + mypyc; compile all modules
  except __init__.py (avoids __path__ init bug with compiled packages)
- Add mypy config: mypy_path, ignore_missing_imports, yaml override
- Fix type errors: narrow Status|None in agent.py, annotate model_id
- Update CI: matrix build (ubuntu/macos/windows), release job updates
  README version and uploads platform-native wheels
- Add install.sh (macOS/Linux) and install.ps1 (Windows) to install
  the latest release wheel via uv tool install
- Add Makefile targets: build, clean; scope ty check to src/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: prompt and auto-install uv if missing in install scripts

- Add interactive check in install.sh and install.ps1
- If uv is not found, ask user and install it automatically
- Improve formatting of 'From source' section in README

Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>

* chore: pin install script URLs to release tag and move to scripts/ directory

Pin install script URLs to v0.12.0 instead of main to avoid executing
mutable remote code via iex/bash. Move install.ps1 and install.sh into
a scripts/ directory for better project organization.

Also update CI release workflow to auto-bump the version tag in both
install script URLs in README.md on new releases.

Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>

* fix: script

* fix(scripts): require explicit confirmation and prevent silent grep exit

- Default uv install prompt from [Y/n] to [Y/n] requiring explicit y/Y
- Add || true to grep pipelines in install.sh to prevent set -euo pipefail
  from silently exiting when no platform-specific wheel is found

Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>

* fix(scripts): force reinstall to handle already-installed mini

Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: kowyo-bot <258374017+kowyo-bot@users.noreply.github.com>
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.

1 participant