Windows: make lint/typecheck/test/docs/pr fail after setup_dev.ps1
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the failing Makefile targets, scripts/audit_paths.py, libp2p/transport/tcp/tcp.py, and the two interop conftest.py files named in the report. Reproduce failures from Git Bash after running scripts/setup_dev.ps1, then check how Windows CI scopes tox and pytest. Done means the listed contributor targets either work on Windows or have documented, supported workarounds; the issue spans several tools and platform-specific behaviors.
Written by the indexing model from the issue text.
Description
Summary
After a successful Windows bootstrap with scripts/setup_dev.ps1 (#1578 / #1577), the usual contributor Makefile workflow does not pass on native Windows (Git Bash + GnuWin32/Chocolatey make).
This issue tracks making local Windows make parity closer to Linux/macOS (or documenting durable workarounds). Windows CI already avoids full make pr by running tox core / demos / utils / wheel only.
Related: #1578, #1577, docs update in eaf38d60.
Environment (repro)
- OS: Windows 11 (
10.0.26200) - Commit:
eaf38d60(fix/setup-dev-scripts) - Shell: Git Bash (
"C:\Program Files\Git\bin\bash.exe" -l) - Python: 3.13.17 from uv in
.venv make: GNU Make 3.81 (C:\Program Files (x86)\GnuWin32\bin\make)- Setup:
pwsh -File .\scripts\setup_dev.ps1succeeded (exit 0)
Matrix
| Target | Exit | Result |
|---|---|---|
make clean |
0 | OK (rm / find via Git Bash) |
make fix |
0 | OK (ruff check --fix) |
make lint |
2 | Fail (mypy-local, pyrefly-local, path-audit) |
make typecheck |
2 | Fail (mypy-local on SO_REUSEPORT) |
make test |
2 | Fail at collection (fcntl in interop conftests) |
make docs |
2 | Fail (nested make path with spaces/()) |
make pr |
2 | Fail (depends on clean+fix+lint+typecheck+test) |
CI-scoped smoke (not a Makefile target):
python -m pytest tests/core tests/examples tests/utils -n auto -m "not serial_only" --maxfail=5
→ 2737 passed, 10 skipped, 5 failed (TLS: RuntimeError: Could not load libssl on Windows)
Failures and why
1. make lint / make typecheck — SO_REUSEPORT
libp2p\transport\tcp\tcp.py:59: error: Module has no attribute "SO_REUSEPORT" [attr-defined]
Runtime already catches AttributeError/OSError, but mypy/pyrefly type the socket module on Windows where the constant is absent.
Suggested fix: getattr(stdlib_socket, "SO_REUSEPORT", None) / hasattr guard that typecheckers understand, or a platform-aware # type: ignore[attr-defined].
2. make lint — pyrefly + Store python3 stub
Failed to query interpreter at C:\Users\luca\AppData\Local\Microsoft\WindowsApps\python3.exe
Python was not found; ... disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.
Pyrefly probes the Microsoft Store alias even when .venv is active.
Suggested fix: configure pyrefly/python path to .venv\Scripts\python.exe; document disabling App execution aliases; prefer uv-managed interpreters in tool config.
3. make lint — pyrefly fcntl on interop conftests
tests\interop\go_libp2p\conftest.py: ... No attribute `flock` in module `fcntl`
tests\interop\nim_libp2p\conftest.py: ... No attribute `flock` / `LOCK_EX` / `LOCK_NB`
fcntl is Unix-only. Typechecking these files on Windows fails.
Suggested fix: lazy/TYPE_CHECKING imports; pytest.importorskip / platform skip before import; exclude interop from Windows typecheck paths.
4. make lint — path-audit emoji on cp1252
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f50d'
scripts/audit_paths.py print("🔍 Scanning...")
Default Windows console encoding is often cp1252.
Suggested fix: ASCII-only log messages, or force UTF-8 (PYTHONUTF8=1 / sys.stdout.reconfigure(encoding="utf-8")) in the script/hook.
5. make test — interop collection imports fcntl
tests/interop/go_libp2p/conftest.py:8: import fcntl
ModuleNotFoundError: No module named 'fcntl'
Same for tests/interop/nim_libp2p/conftest.py. Pytest collection of tests/ loads those conftests and aborts before core tests run. Windows CI never collects tests/interop.
Suggested fix: defer fcntl behind a Windows-friendly lock (msvcrt / portalocker / skip module on win32); and/or change Makefile test on Windows to match CI (tests/core, tests/examples, tests/utils) / --ignore=tests/interop.
6. make docs — recursive make path with spaces
C:/Program Files (x86)/GnuWin32/bin/make -C docs clean
/usr/bin/sh: -c: line 1: syntax error near unexpected token `('
$(MAKE) expands to an unquoted path containing spaces and parentheses.
Suggested fix: quote $(MAKE) invocations; recommend a make whose path has no spaces (Chocolatey / MSYS2); or document WSL for docs builds.
7. Secondary: TLS tests need libssl on this guest
RuntimeError: Could not load libssl on Windows
Seen when running the CI-scoped pytest suite. Likely missing OpenSSL DLLs for the uv CPython build / environment (WinBoat), not necessarily a Makefile bug. Worth confirming on a stock Windows CI image / developer laptop with OpenSSL available.
Proposed workstreams
- Quick wins: ASCII
audit_paths.py; quote$(MAKE)in docs targets;SO_REUSEPORTtyping guard. - Interop Windows safety: don't import
fcntlat module import time; skip/ignore interop on win32 collection. - Makefile Windows profile (optional):
make test-windows/ detectOS=Windows_NTand mirror CI paths; document that fullmake prremains Linux/macOS/WSL. - Tooling: pin typecheckers to
.venvinterpreter; document disabling Store python aliases. - TLS/OpenSSL: document Windows OpenSSL requirement for TLS tests if reproducible outside this VM.
Workaround (today)
From PowerShell / Git Bash with .venv active:
python -m ruff check --fix
python -m pytest tests/core tests/examples tests/utils -n auto -m "not serial_only"
Prefer WSL or Linux/macOS for full make pr / docs until the items above land.
Acceptance ideas
-
make lintandmake typechecksucceed on Windows (or clearly skip Windows-inapplicable hooks) -
make testeither ignores Unix-only interop on Windows or uses a Windows-safe lock -
make docsworks with a spacedmakepath or documents a supported toolchain - contributing docs stay aligned with actual Windows CI scope
- Dominant language
- Python
- Stars
- 629
- Forks
- 261
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 30
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libp2p/py-libp2p
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 22/100
Maintainers usually reply within 1 day
-
Tracking: post-quantum key exchange (X25519MLKEM768) on the QUIC transportPossibly taken @paschal533 claimed this 5 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
libp2p/py-libp2p#1581 · 7 comments ·
Maintainers usually reply within 1 day
-
discussion enhancement feature Interoperability
Difficulty 5/5 Over a week Newbie friendliness 28/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
Maintainers usually reply within 1 day
All issues in libp2p/py-libp2p
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
nael5x/creative-ai#130 ·
-
Make the "%" unit spacing the same in the web and in A10Possibly taken @kragent66-glitch claimed this today. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 comment ·
-
ci severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
TMHSDigital/Spackle#205 ·
Maintainers usually reply within 1 day
-
pkg:lgm type:chore upstream-gaussx
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
jejjohnson/pyrox#610 ·
Maintainers usually reply within 1 day