Skip to content

Commit

Permalink
Flux Beartyper: **ENGAGE**.
Browse files Browse the repository at this point in the history
This commit introduces the **Flux Beartyper** (i.e., the combined usage
of both `beartype_this_package()` *and* `beartype_all()` from
`{some_package}.__init__` submodules in a safe and controlled manner) to
a wider audience. Specifically, this commit injects additional code and
explanatory commentary that now prefaces:

* Our abbreviated GitHub-hosted ``README.rst`` documentation.
* Our introductory ReadTheDocs-hosted ``index.rst`` documentation.

(*Humongous inoculation of an innocuous homunculus!*)
  • Loading branch information
leycec committed Feb 4, 2024
1 parent cb377e2 commit 897af31
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
25 changes: 23 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,29 @@ usability, unsubstantiated jargon we just made up, and thrilling puns.
beartype_this_package() # <-- hype goes
Beartype now implicitly type-checks *all* annotated classes, callables, and
variable assignments across *all* submodules of ``{your_package}``. Congrats.
This day all bugs die. :superscript:`...server slowly crashes`
variable assignments across *all* submodules of your package. Congrats. This day
all bugs die.

But why stop at the burning tires in only *your* code? Your app depends on a
sprawling ghetto of other packages, modules, and services. How riddled with
infectious diseases is *that* code? You're about to find out.

.. code-block:: python
# ....................{ BIG BEAR }....................
# Warn about type hint violations in *OTHER* packages outside your control;
# only raise exceptions from violations in your package under your control.
# Again, at the very top of your "{your_package}.__init__" submodule:
from beartype import BeartypeConf # <-- this isn't your fault
from beartype.claw import beartype_all, beartype_this_package # <-- you didn't sign up for this
beartype_this_package() # <-- raise exceptions in your code
beartype_all(conf=BeartypeConf(violation_type=UserWarning) # <-- emit warnings from other code
Beartype now implicitly type-checks *all* annotated classes, callables, and
variable assignments across *all* submodules of *all* packages. When **your**
package violates type safety, beartype raises an exception. When any **other**
package violates type safety, beartype just emits a warning. The triumphal
fanfare you hear is probably your userbase cheering. This is how the QA was won.
Beartype also publishes a `plethora of APIs for fine-grained control over
type-checking <beartype APIs>`. For those who are about to QA, beartype salutes
Expand Down
25 changes: 23 additions & 2 deletions doc/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,29 @@ If seeing is believing, prepare to do both those things.
beartype_this_package() # <-- yay! your team just won
Beartype now implicitly type-checks *all* annotated classes, callables, and
variable assignments across *all* submodules of ``{your_package}``. Congrats.
This day all bugs die. :superscript:`...server slowly crashes`
variable assignments across *all* submodules of your package. Congrats. This day
all bugs die.

But why stop at the burning tires in only *your* code? Your app depends on a
sprawling ghetto of other packages, modules, and services. How riddled with
infectious diseases is *that* code? You're about to find out.

.. code-block:: python
# ....................{ BIG BEAR }....................
# Warn about type hint violations in *OTHER* packages outside your control;
# only raise exceptions from violations in your package under your control.
# Again, at the very top of your "{your_package}.__init__" submodule:
from beartype import BeartypeConf # <-- this isn't your fault
from beartype.claw import beartype_all, beartype_this_package # <-- you didn't sign up for this
beartype_this_package() # <-- raise exceptions in your code
beartype_all(conf=BeartypeConf(violation_type=UserWarning) # <-- emit warnings from other code
Beartype now implicitly type-checks *all* annotated classes, callables, and
variable assignments across *all* submodules of *all* packages. When **your**
package violates type safety, beartype raises an exception. When any **other**
package violates type safety, beartype just emits a warning. The triumphal
fanfare you hear is probably your userbase cheering. This is how the QA was won.
Beartype also publishes a :ref:`plethora of APIs for fine-grained control over
type-checking <api:api>`. For those who are about to QA, beartype salutes you.
Expand Down

0 comments on commit 897af31

Please sign in to comment.