github astral-sh/ty 0.0.1-alpha.19

latest release: 0.0.1-alpha.20
pre-release16 days ago

Release Notes

Bug fixes

  • Fix false-positive diagnostics if a function parameter is annotated with type[P] where P is a protocol class (#19947)
  • Fix ANSI colors in terminal output on old Windows terminals (#19984)
  • Fix protocol interface inference for protocols in stub files with ClassVar members and "subprotocols" that extend other protocols (#19950)
  • Fix inference of equality comparisons between enum members (#19666)
  • Remove incorrect type narrowing for if type(x) is C[int] (#19926)
  • Improve detection of TypeErrors resulting from protocol classes illegally inheriting from non-protocol classes (#19941). We previously detected this error, but only when the protocol class illegally inherited from a non-generic class or an unspecialized generic class. We now also detect it when the protocol class inherits from a specialized generic class.
  • Fix incorrectly precise type inference in some situations involving nested scopes (#19908)
  • Fix unpacking a type alias with a precise tuple spec (#19981)

NamedTuple semantics improvements

  • Synthesize read-only properties for all declared members on NamedTuple classes (#19899)
  • Allow any instance of a NamedTuple class to be passed to a function parameter annotated with typing.NamedTuple (#19915)
  • Detect NamedTuple classes where fields without default values illegally follow fields with default values (#19945). This causes TypeError to be raised at runtime.
  • Detect illegal multiple inheritance with NamedTuple (#19943). This causes TypeError to be raised at runtime.

Other typing and semantics improvements

  • Add support for stubs packages with partial in their py.typed files (#19931)
  • Look for site-packages directories in <sys.prefix>/lib64/ as well as <sys.prefix>/lib/ on non-Windows systems (#19978). This change fixes a number of unresolved-import false-positive diagnostics reported by Poetry users.
  • Add diagnostics for invalid await expressions (#19711)
  • Add else-branch narrowing for if type(a) is A when A is @final (#19925)
  • Improve solving of typevars with defaults, and typing.Self (#19786)
  • Support the kw_only parameter for dataclasses.dataclass() and dataclasses.field() (#19677)
  • Sync vendored typeshed stubs (#19923). Typeshed diff.

Server improvements

  • Improve goto/hover for definitions (#19976)

Performance improvements

  • Short-circuit a server inlay hints request if all settings under ty.inlayHints are disabled (#19963)
  • Speedup server tracing checks (#19965)
  • Add caching to logic for inferring whether a class is a NamedTuple, a dataclass or a TypedDict (#19912)
  • Speedup project file discovery (#19913)

Contributors

Install ty 0.0.1-alpha.19

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.19/ty-installer.sh | sh

Install prebuilt binaries via powershell script

powershell -ExecutionPolicy Bypass -c "irm https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.19/ty-installer.ps1 | iex"

Download ty 0.0.1-alpha.19

File Platform Checksum
ty-aarch64-apple-darwin.tar.gz Apple Silicon macOS checksum
ty-x86_64-apple-darwin.tar.gz Intel macOS checksum
ty-aarch64-pc-windows-msvc.zip ARM64 Windows checksum
ty-i686-pc-windows-msvc.zip x86 Windows checksum
ty-x86_64-pc-windows-msvc.zip x64 Windows checksum
ty-aarch64-unknown-linux-gnu.tar.gz ARM64 Linux checksum
ty-i686-unknown-linux-gnu.tar.gz x86 Linux checksum
ty-powerpc64-unknown-linux-gnu.tar.gz PPC64 Linux checksum
ty-powerpc64le-unknown-linux-gnu.tar.gz PPC64LE Linux checksum
ty-s390x-unknown-linux-gnu.tar.gz S390x Linux checksum
ty-x86_64-unknown-linux-gnu.tar.gz x64 Linux checksum
ty-armv7-unknown-linux-gnueabihf.tar.gz ARMv7 Linux checksum
ty-aarch64-unknown-linux-musl.tar.gz ARM64 MUSL Linux checksum
ty-i686-unknown-linux-musl.tar.gz x86 MUSL Linux checksum
ty-x86_64-unknown-linux-musl.tar.gz x64 MUSL Linux checksum
ty-arm-unknown-linux-musleabihf.tar.gz ARMv6 MUSL Linux (Hardfloat) checksum
ty-armv7-unknown-linux-musleabihf.tar.gz ARMv7 MUSL Linux checksum

Don't miss a new ty release

NewReleases is sending notifications on new releases.