Skip to content

Windows compatibility fix#408

Open
Powers0909 wants to merge 1 commit intogoodboy:mainfrom
Powers0909:fix/windows
Open

Windows compatibility fix#408
Powers0909 wants to merge 1 commit intogoodboy:mainfrom
Powers0909:fix/windows

Conversation

@Powers0909
Copy link

@Powers0909 Powers0909 commented Dec 5, 2025

Fixes to attempt to get baseline windows goin again per our
oustandings,


Iter-related mult-platform ToDos,

@Powers0909 Powers0909 changed the title Fix(windows): update _addr.py, _server.py, _types.py, and _stackscope.py Windows compatibility fix Dec 5, 2025
@goodboy goodboy added windows_related IPC and transport macos_related gotta tailor to them job bros i suppose labels Jan 25, 2026
@goodboy goodboy requested a review from Copilot January 25, 2026 22:35
Copy link

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 PR adds Windows compatibility fixes by conditionally disabling Unix Domain Socket (UDS) support on Windows platforms. The changes aim to make the codebase work on Windows where AF_UNIX socket support may not be available or is intentionally excluded from this project's scope.

Changes:

  • Conditional UDS backend loading with platform detection across multiple modules
  • SIGUSR1 signal handling made Windows-compatible in the stackscope debugging module
  • Warning logs added when UDS backend is unavailable

Reviewed changes

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

File Description
tractor/ipc/_types.py Implements conditional UDS import with HAS_UDS flag, dynamically builds transport registries based on availability
tractor/ipc/_server.py Adds conditional UDS import with platform check for Windows compatibility
tractor/devx/_stackscope.py Makes SIGUSR1 signal handling optional on Windows where the signal doesn't exist
tractor/_addr.py Conditionally imports UDS address types and registers them only when available

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +62 to +64
if TYPE_CHECKING:
from ._runtime import Actor

Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The duplicate if TYPE_CHECKING: block should be removed. There's already a TYPE_CHECKING block at line 42-43, and this duplicate at lines 62-63 is redundant.

Suggested change
if TYPE_CHECKING:
from ._runtime import Actor

Copilot uses AI. Check for mistakes.
import platform
import signal

from signal import (
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

Trailing whitespace detected at the end of line 38. This should be removed for code cleanliness.

Suggested change
from signal import (
from signal import (

Copilot uses AI. Check for mistakes.

UDSAddress = None

if getattr(socket, "AF_UNIX", None) is not None and platform.system() != "Windows":
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The platform detection pattern here differs from the approach used in _types.py and _addr.py. For consistency, consider defining HAS_AF_UNIX and IS_WINDOWS variables at the module level (like in the other files) and reusing them here: if HAS_AF_UNIX and not IS_WINDOWS:. This would make the codebase more maintainable and ensure consistent behavior across all Windows compatibility checks.

Copilot uses AI. Check for mistakes.
case socket.AF_UNIX:
transport = 'uds'
# Only consider AF_UNIX when both Python exposes it and our backend is active
if transport is None and HAS_UDS and HAS_AF_UNIX and fam == socket.AF_UNIX: # type: ignore[attr-defined]
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The condition checks HAS_AF_UNIX and then accesses socket.AF_UNIX, but HAS_AF_UNIX is already defined as getattr(socket, "AF_UNIX", None) is not None, so the check is redundant. Consider simplifying to just if transport is None and HAS_UDS and fam == socket.AF_UNIX: since HAS_AF_UNIX is already validated by HAS_UDS being True (line 48 ensures UDS is only enabled when HAS_AF_UNIX is True).

Suggested change
if transport is None and HAS_UDS and HAS_AF_UNIX and fam == socket.AF_UNIX: # type: ignore[attr-defined]
if transport is None and HAS_UDS and fam == socket.AF_UNIX: # type: ignore[attr-defined]

Copilot uses AI. Check for mistakes.
from signal import (

import platform
import signal
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

Module 'signal' is imported with both 'import' and 'import from'.

Suggested change
import signal

Copilot uses AI. Check for mistakes.
TYPE_CHECKING,
)

import logging
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

Import of 'logging' is not used.

Suggested change
import logging

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

IPC and transport macos_related gotta tailor to them job bros i suppose windows_related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants