github beartype/beartype v0.20.0rc1
Beartype 0.20.0 Release Candidate 1: QA Intensifies

pre-release10 hours ago

Beartype 0.20.0 Release Candidate 1 gently rises aloft. The frigid storm blast dumping fifty litres of snow directly onto our cottage is no match for @beartype 0.20.0rc1. Like a hot-air balloon fuelled on hopes and dreams alone, @beartype 0.20.0rc1 asks the critical question: "How hopeful is your codebase that any of this actually works?"

Let our contagious dream of a higher-quality Python world infect your dreams, too. There's room enough on this hot-air balloon for all of us – and more than enough hot air:

pip install --upgrade --pre beartype     # <-- bug off, bugs


pucci (the new @beartype mascot) gasps in wonder as your package collapses

GitHub Sponsors: When You Befriend the Bear, You've got a Bear for Life

This release comes courtesy these proud GitHub Sponsors, without whom @leycec's cats would currently be eating grasshoppers:

Thanks so much, masters of fintech and metrology.


The Masters of Fintech and Metrology. That's who.

And now for something... gothic, grotesque, and morbid!? 😲 😮 🫢

Python 3.8: It Died Quietly in the Corner While No One Shed a Tear

@beartype 0.20.0rc1 officially drops support for Python 3.8. Python 3.8 "recently" hits its official End-of-Life (EOL). Alright. It was ages ago. I still remember when Python 3.8 was the cool new kid who just wanted to come over and show you his $1,000 LEGO Millennium Falcon constructed entirely from deprecated type hints. Now, it's dead. Only my baldness remains. Python makin' me feel old over here.

This means that Python 3.8 now constitutes a security risk. More importantly, @beartype hates Python 3.8. Due to the Transitivity of Loathsomeness Principle (probably discovered by Pythagoras the Pythonic, the unknown balding stepchild of Pythagoras the Elder), your codebase now hates Python 3.8 too. Like a bad dream, feature loss is contagious.


$1000 bucks and 47 weeks of your youth: gone, just like @leycec when the issues pile up

Our New Motto: "We Promise the World and Deliver Less"

@beartype 0.20.0rc1 delivers less bugs – a lot less bugs. Turns out @beartype has been buggy for years. If nobody hits a bug for a decade but that bug still exists, does it make a sound when it crushes your codebase at 4:23AM on an icy Sunday? The answer is: "That sound is your dev team screaming in shared anguish."

@beartype 0.20.0rc1 specifically:

  • Lets you dangerously combine PEP 563 (i.e., from __future__ import annotations) with PEP 695 implicit type parameter instantiation (e.g., def muh_func[T](muh_arg: T) -> T: ...). Against all sanity, this somehow now works:
from __future__ import annotations  # <-- PEP 563, yo. it sucks, but you know best.
from beartype import beartype  # <------- *GOOD*

@beartype
def muh_func[T](muh_arg: T) -> T:  # <-- PEP 695 up in here, y'all!
    return muh_arg
  • Lets you dangerously nest PEP 695 type aliases like you just don't care:
from beartype import beartype  # <------- *GOOD*

# PEP 695 type aliases, deeply nested because you no longer care about coworkers.
type ThatFeeling[T] = WhenYoureIn[T] | float
type WhenYoureIn[T] = TooDeep[T] | str
type TooDeep[T] = int | T

@beartype
def nuther_func(nuther_arg: TooDeep[complex]) -> TooDeep[bytes]:
    return nuther_arg  # <-- a type-check that is doomed to fail. it ain't so good

The above function signature is equivalent to this simpler, more readable, more maintainable, more debuggable, and yet somehow more boring signature:

@beartype
def nuther_func(nuther_arg: int | complex | str | float) -> int | bytes | str | float:
    return nuther_arg  # <-- we can now see this makes less sense than we thought

Boring is bad, though. That's clear. Simplicity doesn't count for much if you're bored all the time. Maximize non-boring even if it costs you your codebase, your career, and your future prospects of a happy family. Do what @leycec would do.

@beartype 0.20.0rc1: because @beartype has to do what you say, even when it no longer wants to


pucci isn't to blame for @beartype's poor decision-making... but your coworker might be

Calling the Last QA Defenders. Will You Answer the Call?

You are @beartype's last line of defence: @EtaoinWu, @Glinte, @rudimichal, @woutdenolf, @PauloHMTeixeira. You know who you are and what @beartype has done to your code.

Let us know if @beartype 0.20.0rc1 has done you less dirty. If so, we'll release the full-blown @beartype 0.20.0 in a week or fifteen. May Pucci the new @beartype mascot be with us all.


pucci curses the futility of her new job description

Don't miss a new beartype release

NewReleases is sending notifications on new releases.