Skip to content

Conversation

@Andrej730
Copy link
Contributor

@Andrej730 Andrej730 commented Apr 12, 2025

Changes:

  1. Remove curses dependency - it was introduced in bd85af0 but apparently was never used. It was preventing running conformance on Windows as curses is not available.

  2. Provide "utf-8" encoding explicitly to open and subprocess.run to fix errors on Windows.

  3. Add pytype to requirements.txt on Windows too. Previously pytype was excluded from requirements but still used in conformance code leading to errors on Windows. But now pytype is available on Windows with pip install pytype, though it's not precompiled and may be added to conformance too.
    To confirm it's working, below is a diff between results of 'unexpected_fails.py' based on the current repo state vs running conformance now on Windows - and there are no changes for pytype. (No idea where are those pyre errors coming through, but it's unrelated to this PR)

current_repo_unexpected_fails.txt
current_unexpected_fails_windows_pytyped_included.txt

diff --git "a/L:\\oblivion\\current_repo_unexpected_fails.txt" "b/L:\\oblivion\\current_unexpected_fails_windows_pytyped_included.txt"
index 7803806..824cc08 100644
--- "a/L:\\oblivion\\current_repo_unexpected_fails.txt"
+++ "b/L:\\oblivion\\current_unexpected_fails_windows_pytyped_included.txt"
@@ -1,6 +1,47 @@
 mypy\protocols_explicit.toml: Pass vs. Fail
-pyre\namedtuples_define_class.toml: Partial vs. Pass
-pyre\namedtuples_usage.toml: Partial vs. Pass
+pyre\aliases_variance.toml: Pass vs. Fail
+pyre\annotations_typeexpr.toml: Pass vs. Fail
+pyre\callables_kwargs.toml: Pass vs. Fail
+pyre\classes_override.toml: Pass vs. Fail
+pyre\constructors_call_type.toml: Pass vs. Fail
+pyre\dataclasses_descriptors.toml: Partial vs. Pass
+pyre\dataclasses_final.toml: Pass vs. Fail
+pyre\dataclasses_frozen.toml: Pass vs. Fail
+pyre\dataclasses_order.toml: Pass vs. Fail
+pyre\directives_assert_type.toml: Pass vs. Fail
+pyre\directives_cast.toml: Pass vs. Fail
+pyre\directives_no_type_check.toml: Pass vs. Fail
+pyre\directives_reveal_type.toml: Pass vs. Fail
+pyre\directives_type_ignore_file2.toml: Pass vs. Fail
+pyre\enums_behaviors.toml: Pass vs. Fail
+pyre\enums_expansion.toml: Pass vs. Fail
+pyre\enums_member_values.toml: Pass vs. Fail
+pyre\exceptions_context_managers.toml: Partial vs. Pass
+pyre\generics_paramspec_semantics.toml: Pass vs. Fail
+pyre\generics_self_advanced.toml: Partial vs. Pass
+pyre\generics_typevartuple_concat.toml: Partial vs. Pass
+pyre\generics_typevartuple_overloads.toml: Unsupported vs. Pass
+pyre\generics_typevartuple_unpack.toml: Pass vs. Fail
+pyre\historical_positional.toml: Pass vs. Fail
+pyre\literals_semantics.toml: Pass vs. Fail
+pyre\namedtuples_define_functional.toml: Pass vs. Fail
+pyre\namedtuples_type_compat.toml: Pass vs. Fail
+pyre\narrowing_typeguard.toml: Pass vs. Fail
+pyre\narrowing_typeis.toml: Pass vs. Fail
+pyre\overloads_basic.toml: Pass vs. Fail
+pyre\protocols_merging.toml: Pass vs. Fail
+pyre\protocols_subtyping.toml: Pass vs. Fail
+pyre\specialtypes_none.toml: Pass vs. Fail
+pyre\tuples_type_form.toml: Pass vs. Fail
+pyre\tuples_unpacked.toml: Pass vs. Fail
+pyre\typeddicts_final.toml: Partial vs. Pass
+pyre\typeddicts_inheritance.toml: Pass vs. Fail
+pyre\typeddicts_operations.toml: Pass vs. Fail
+pyre\typeddicts_readonly.toml: Pass vs. Fail
+pyre\typeddicts_readonly_consistency.toml: Pass vs. Fail
+pyre\typeddicts_readonly_kwargs.toml: Pass vs. Fail
+pyre\typeddicts_readonly_update.toml: Pass vs. Fail
+pyre\typeddicts_usage.toml: Pass vs. Fail
 pyright\enums_members.toml: Pass vs. Fail
 pyright\protocols_explicit.toml: Pass vs. Fail
 pyright\typeddicts_required.toml: Pass vs. Fail

It was previously failing only for pyright but added it for all type checkers just to be sure.
```
Traceback (most recent call last):
  File "L:\Projects\Github\typing\conformance\src\main.py", line 260, in <module>
    main()
  File "L:\Projects\Github\typing\conformance\src\main.py", line 253, in main
    run_tests(root_dir, type_checker, test_cases, skip_timing=options.skip_timing)
  File "L:\Projects\Github\typing\conformance\src\main.py", line 34, in run_tests
    type_checker.parse_errors(output.splitlines())
  File "L:\Projects\Github\typing\conformance\src\type_checker.py", line 206, in parse_errors
    assert line.count(":") >= 3, f"Failed to parse line: {line!r}"
           ^^^^^^^^^^^^^^^^^^^^
AssertionError: Failed to parse line: 'Â\xa0Â\xa0Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)'
```

Update type_checker.py
On Windows it failed with
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 4590: character maps to <undefined>
Otherwise couldn't run conformance on Windows at all:
```
Traceback (most recent call last):
  File "L:\Projects\Github\typing\conformance\src\main.py", line 16, in <module>
    from reporting import generate_summary
  File "L:\Projects\Github\typing\conformance\src\reporting.py", line 10, in <module>
    from type_checker import TYPE_CHECKERS
  File "L:\Projects\Github\typing\conformance\src\type_checker.py", line 6, in <module>
    from curses.ascii import isspace
  File "L:\Software\Python312\Lib\curses\__init__.py", line 13, in <module>
    from _curses import *
ModuleNotFoundError: No module named '_curses'
```
@erictraut
Copy link
Collaborator

@Andrej730, thanks for the contribution. It looks like you need to agree to the terms of the CLA before we can merge your change.

@Andrej730
Copy link
Contributor Author

I believe it's already signed - https://cla.python.org/dashboard/:
image

@JelleZijlstra
Copy link
Member

Asked on Discord for help with the CLA issue

@JelleZijlstra
Copy link
Member

Ee figured it out, thanks!

@JelleZijlstra JelleZijlstra merged commit 54b6ce2 into python:main Apr 13, 2025
4 checks passed
@Andrej730 Andrej730 deleted the conformance-windows branch April 13, 2025 05:07
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.

4 participants