Skip to content

ty in prek fails on Windows on unmodified main (fcntl has no flock) #5302

Closed

Description

@cristiangirlea

What happened?

On a Windows checkout of current main (ac4f582), uv run prek run --all-files fails in the ty hook with four unresolved-attribute errors. A Windows contributor therefore can't tick "I have run uv run prek run --all-files and all checks pass" in the PR template.

The errors come from tests/utilities/json_schema_type/test_real_world_schemas.py, which imports fcntl inside the clone helper. That's fine at runtime, since the code only runs on POSIX. [tool.ty.environment] sets python-version = "3.10" but not python-platform, so ty checks against the host platform, and on win32 typeshed's fcntl has no flock, LOCK_EX or LOCK_UN. CI runs prek on ubuntu-latest, so it never hits this. Checking with --python-platform linux passes cleanly on Windows, so setting python-platform = "linux" in [tool.ty.environment] would make the result the same everywhere.

A smaller Windows-only oddity from the same run: with git's default core.autocrlf=true, the prettier hook rewrites 33 YAML files (.github/, .coderabbit.yaml, .pre-commit-config.yaml and others) from CRLF to LF and still reports "Passed". Git normalizes the change away, so it only shows up as noise in git status.

Example Code

git clone https://github.com/PrefectHQ/fastmcp
cd fastmcp
uv sync
uv run --isolated ty check
uv run --isolated ty check --python-platform linux

On Windows, the first ty check reports:

error[unresolved-attribute]: Module `fcntl` has no member `flock`
   --> tests\utilities\json_schema_type\test_real_world_schemas.py:138:9
error[unresolved-attribute]: Module `fcntl` has no member `LOCK_EX`
   --> tests\utilities\json_schema_type\test_real_world_schemas.py:138:34
error[unresolved-attribute]: Module `fcntl` has no member `flock`
   --> tests\utilities\json_schema_type\test_real_world_schemas.py:185:13
error[unresolved-attribute]: Module `fcntl` has no member `LOCK_UN`
   --> tests\utilities\json_schema_type\test_real_world_schemas.py:185:38

The second reports All checks passed!.

Version Information

fastmcp main at ac4f582e (4.0.6.dev39)
Python 3.12.12, Windows 11 (10.0.26200)
ty 0.0.69, prek 0.4.10, uv 0.12.18
git 2.49.0.windows.1, core.autocrlf=true

Activity

  1. added
    bug
    on Sep 27, 2026
  2. added a commit that references this issue on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglow-prioritytests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions