Episode #242: from lib import * but less
Published Thu, Jul 15, 2021, recorded Thu, Jul 15, 2021.
Watch the live stream:
About the show
Sponsored by us:
Special guest: Al Sweigart
Brian #1: just
- From a tweet by Jeff Triplett
justis a handy way to save and run project-specific commands.
- Commands, called recipes, are stored in a file called
justfilewith syntax inspired by
- Just is a command runner, not a build system, so it avoids much of Make’s complexity and idiosyncrasies. No need for .PHONY recipes!
- Linux, MacOS, and Windows are supported with no additional dependencies.”
- It’s written in Rust.
- My favorite differences:
like Python hello: echo "Hello World!" pyhello: #!/usr/bin/env python3 print('Hello from python!')
Michael #2: Strong Typing
- via Roman Right (Beanie)
- Decorator which checks whether the function is called with the correct type of parameters.
- Decorator which checks at Runtime whether the function is called with the correct type of parameters.
- Raises TypeMisMatch if the used parameters in a function call where invalid.
Brian #4: testbook
- Suggested by David Nicholson
- Write conventional unit tests for Jupyter Notebooks
- Execute all or some specific cells before unit test
- Share kernel context across multiple tests (using pytest fixtures)
- Support for patching objects
- Inject code into Jupyter notebooks
- Works with any unit testing library, unittest, pytest, etc.
def foo(a, b): return a + b
from testbook import testbook @testbook('foo.ipynb', execute=True) def test_foo(tb): foo = tb.ref("foo") assert foo(1, 2) == 3
Michael #5: auto-all
- Automatically manage the __all__ variable in Python modules.
- Easily populate the
__all__variable in modules.
- Easily exclude imported objects
- Clearly differentiate between internal and external facing objects.
- Use simple, intuitive code.
- Never worry about forgetting to add new objects to
- Help Python IDE's differentiate between internal and external facing objects.
- Easily populate the
- Can use “regions” via
- I prefer the decorator (functions only, seems ripe for a PR for classes)
@public def a_public_function(): pass
- Next book: Untitled Recursion Book
- OhMyPosh + auto env
- A scalable method of determining physiological endotypes of sleep apnea from a polysomnographic sleep study
- Email, inbox woes, and catching up
- Microsoft unveils Windows 365
- Facebook and its advertisers are ‘panicking’ as the majority of iPhone users opt out of tracking