Skip to content

fix: enable native Windows source builds#126

Merged
vinarmani merged 2 commits into
mainfrom
fix/windows-native-source-build
Jul 16, 2026
Merged

fix: enable native Windows source builds#126
vinarmani merged 2 commits into
mainfrom
fix/windows-native-source-build

Conversation

@vinarmani

@vinarmani vinarmani commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

setup.py's check_dependencies() shells out to which, so a working build already required Go, MinGW-w64 gcc, MSYS2 make, and gopy on PATH. Once those are present, two remaining bugs still block a native Windows source install:

  • gopy's own generated Makefile indents its Windows-only PyInit_ sed fix-up with two spaces instead of a tab, which GNU Make rejects as "missing separator" before it reaches a shell. Patch it in place right after gopy gen runs. The check is content-matched (not line-numbered) and gated on $(OS) == Windows_NT, so it's a true no-op on Linux/macOS, where gopy doesn't emit that line at all.
  • pyproject.toml's package-data glob only listed .so/.dll/*.dylib, so the compiled extension gopy produces as *.pyd on Windows was silently dropped from the wheel. Adding *.pyd is purely additive.

Verified end-to-end on Windows: make gopy_build produces working .pyd artifacts, pip install --no-build-isolation builds a wheel that actually contains them, and the installed SDK successfully signs and submits a real testnet transaction.

This does not change the Linux or macOS build/install path in any way — both branches above resolve to their prior behavior on those platforms.

Summary by CodeRabbit

  • Bug Fixes

    • Improved Windows build compatibility by correcting generated build instructions automatically.
    • Fixed packaging to include compiled Python extension files on supported platforms.
  • Compatibility

    • Added support for distributing binary extensions with Windows, macOS, and Python-specific filename suffixes.

setup.py's check_dependencies() shells out to `which`, so a working
build already required Go, MinGW-w64 gcc, MSYS2 make, and gopy on
PATH. Once those are present, two remaining bugs still block a native
Windows source install:

- gopy's own generated Makefile indents its Windows-only PyInit_ sed
  fix-up with two spaces instead of a tab, which GNU Make rejects as
  "missing separator" before it reaches a shell. Patch it in place
  right after `gopy gen` runs. The check is content-matched (not
  line-numbered) and gated on `$(OS) == Windows_NT`, so it's a `true`
  no-op on Linux/macOS, where gopy doesn't emit that line at all.
- pyproject.toml's package-data glob only listed *.so/*.dll/*.dylib,
  so the compiled extension gopy produces as *.pyd on Windows was
  silently dropped from the wheel. Adding *.pyd is purely additive.

Verified end-to-end on Windows: `make gopy_build` produces working
.pyd artifacts, `pip install --no-build-isolation` builds a wheel
that actually contains them, and the installed SDK successfully
signs and submits a real testnet transaction.

This does not change the Linux or macOS build/install path in any
way — both branches above resolve to their prior behavior on those
platforms.
@vinarmani
vinarmani requested a review from MicBun July 15, 2026 08:40
@holdex

holdex Bot commented Jul 15, 2026

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
@vinarmani - ⏳ Pending -
@MicBun - ⏳ Pending -

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@vinarmani, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0b49d165-ecce-4d05-ac22-0864d2c099e8

📥 Commits

Reviewing files that changed from the base of the PR and between cf9ba73 and 839727b.

📒 Files selected for processing (1)
  • Makefile
📝 Walkthrough

Walkthrough

The build now applies a Windows-specific correction to generated binding Makefiles, while Python packaging includes .pyd extension files alongside existing shared-library artifacts.

Changes

Cross-platform bindings

Layer / File(s) Summary
Windows binding generation fix
Makefile
gopy_build conditionally runs a Windows-only sed -i correction after gopy gen; non-Windows platforms use a no-op command.
Compiled extension packaging
pyproject.toml
Package data now includes compiled .pyd extension files in addition to existing shared-library patterns.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: micbun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: enabling native Windows source builds through build and packaging fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-native-source-build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@holdex

holdex Bot commented Jul 15, 2026

Copy link
Copy Markdown

Bug Report Checklist

Status Commit Link Bug Author HR Card
❌ Not Submitted

@vinarmani, please use git blame and specify the link to the commit link that has introduced this bug.

Send the following message in this PR: @holdex bug commit <commit-url> && bug author @name

See available commands to help comply with our Guidelines.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
Makefile (1)

43-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Include Windows binary artifacts in the clean-up step.

Currently, the rm -f command only removes .so files before generating the new bindings. On Windows, this can leave behind stale .pyd and .dll files from previous builds. Extending the cleanup command to cover Windows artifacts ensures a consistently clean build environment across all platforms.

♻️ Proposed fix to clean Windows artifacts
 gopy_build:
-	rm -f src/trufnetwork_sdk_c_bindings/*.so
+	rm -f src/trufnetwork_sdk_c_bindings/*.so src/trufnetwork_sdk_c_bindings/*.pyd src/trufnetwork_sdk_c_bindings/*.dll
 	gopy gen -output=src/trufnetwork_sdk_c_bindings -vm=python3 -name=trufnetwork_sdk_c_bindings $(DYNAMIC_LINK_FLAG) ./bindings
 	@$(WINGOPY_PYINIT_FIX)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` around lines 43 - 46, Update the cleanup command in the gopy_build
target to remove Windows .pyd and .dll artifacts in addition to existing .so
files before running gopy gen. Keep the cleanup scoped to
src/trufnetwork_sdk_c_bindings and preserve the current build sequence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Makefile`:
- Around line 43-46: Update the cleanup command in the gopy_build target to
remove Windows .pyd and .dll artifacts in addition to existing .so files before
running gopy gen. Keep the cleanup scoped to src/trufnetwork_sdk_c_bindings and
preserve the current build sequence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2afdeaa8-2426-4b18-91cd-2671ab660c14

📥 Commits

Reviewing files that changed from the base of the PR and between 88183fd and cf9ba73.

📒 Files selected for processing (2)
  • Makefile
  • pyproject.toml

The gopy_build cleanup only removed *.so before regenerating, so a
Windows rebuild never cleared its own *.pyd output (or *.dll, already
listed in pyproject.toml's package-data). A failed regen could
silently leave a stale binary in place. Harmless no-op on Linux/macOS,
which never produce these extensions.

@MicBun MicBun left a comment

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.

It looks good, I assume it has been tested with windows environment? Currently I am not able to directly test on windows

@vinarmani

Copy link
Copy Markdown
Contributor Author

@MicBun yes, builds successfully and tests pass on windows and linux

@vinarmani
vinarmani merged commit d7ba653 into main Jul 16, 2026
5 of 8 checks passed
@vinarmani
vinarmani deleted the fix/windows-native-source-build branch July 16, 2026 01:20
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