Sinopsis
Python Bytes is a weekly podcast hosted by Michael Kennedy and Brian Okken. The show is a short discussion on the headlines and noteworthy news in the Python, developer, and data science space.
Episodios
-
#259 That argument is a little late-bound
17/11/2021 Duración: 47minWatch the live stream: Watch on YouTube About the show Sponsored by Shortcut - Get started at shortcut.com/pythonbytes Special guest: Renee Teate Michael #1: pypi-changes via Brian Skinn, created by Bernát Gábor Visually show you which dependencies in an environment are out of date. See the age of everything you depend upon. Also, shoutout again to pipdeptree Brian #2: Late-bound argument defaults for Python Default values for arguments to functions are evaluated at function definition time. If a value is a short expression that uses a variable, that variable is in the scope of the function definition. The expression cannot use other arguments. Example of what you cannot do: def foo(a, b = None, c = len(a)): ... There’s a proposal by Chris Angelico to add a =: operator for late default evaluation. syntax still up in the air. => and ?= also discussed However, it’s non-trivial to add syntax to an established language, and this article notes: At first blush, Angelico's idea to
-
#258 Python built us an anime dog!
11/11/2021 Duración: 43minWatch the live stream: Watch on YouTube About the show Sponsored by Shortcut - Get started at shortcut.com/pythonbytes Special guest: Karen Dalton Brian #1: stale : github bot to “Close Stale Issues and PRs” Was one response to a question by Will McGugan Something like “An issue filed on an open source project, I’ve asked a followup question about the issue, and filer doesn’t respond. Is there an easy way to close the issue after a set time period of inactivity.” Just trying to get a reference to Will out of the way early in the episode. stale does this: Warns and then closes issues and PRs that have had no activity for a specified amount of time. The configuration must be on the default branch and the default values will: Add a label "Stale" on issues and pull requests after 60 days of inactivity and comment on them Close the stale issues and pull requests after 7 days of inactivity If an update/comment occur on stale issues or pull requests, the stale label will be removed and the timer will re
-
#257 Python Launcher - Launching Python Everywhere
04/11/2021 Duración: 40minWatch the live stream: Watch on YouTube About the show Sponsored by Shortcut Special guest: Morleh So-kargbo Michael #1: Django 4.0 beta 1 released Django 4.0 beta 1 is now available. Django 4.0 has an abundance of new features The new *expressions positional argument of UniqueConstraint() enables creating functional unique constraints on expressions and database functions. The new scrypt password hasher is more secure and recommended over PBKDF2. The new django.core.cache.backends.redis.RedisCache cache backend provides built-in support for caching with Redis. To enhance customization of Forms, Formsets, and ErrorList they are now rendered using the template engine. Brian #2: py - The Python launcher py has been bundled with Python for Windows only since Python 3.3, as py.exe See Python Launcher for Windows I’ve mostly ignored it since I use Python on Windows, MacOS, and Linux and don’t want to have different workflows on different systems. But now Brett Cannon has developed python-launcher
-
#256 And the best open source project prize goes to ...
29/10/2021 Duración: 59minSee the full show notes for this episode on the website at pythonbytes.fm/256.
-
#255 Closember eve, the cure for Hacktoberfest?
20/10/2021 Duración: 46minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Will McGugan Michael #1: Wrapping C++ with Cython By Anton Zhdan-Pushkin A small series showcasing the implementation of a Cython wrapper over a C++ library. C library: yaacrl - Yet Another Audio Recognition Library is a small Shazam-like library, which can recognize songs using a small recorded fragment. For Cython to consume yaacrl correctly, we need to “teach” it about the API using `cdef extern It is convenient to put such declarations in *.pxd files. One of the first features of Cython that I find extremely useful — aliasing. With aliasing, we can use names like Storage or Fingerprint for Python classes without shadowing original C++ classes. Implementing a wrapper: pyaacrl - The most common way to wrap a C++ class is to use Extension types. As an extension type a just a C struct, it can have an underlying C++ class as a field and act as a prox
-
#254 Do Excel things, get notebook Python code with Mito
13/10/2021 Duración: 31minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Muhammad Raza Brian #1: yaml, GH Actions, and Python 3.10 Anthony Shaw (and others) Old: python: [3.7, 3.8, 3.9, 3.10-dev] New: python: ["3.7", "3.8", "3.9", "3.10"] Reasons: Github Actions use yaml. yaml treats 3.10-dev as a string, since it’s got non-numbers in it. yaml treats 3.10 as a number, and is the same as 3.1 hence, we have to use quotes for “3.10” using them on “3.7”, etc is not necessary, but is a nice consistency Michael #2: Beating C and Java, Python Becomes the #1 Most Popular Programming Language, Says TIOBE via Brian Skin "For the first time in more than 20 years we have a new leader of the pack..." the TIOBE Index announced this month. "The long-standing hegemony of Java and C is over.” For Tiobe, its enterprise focus, has seen Java and C dominate in recent years, but Python has been snapping at the heels of Java, and has n
-
#253 A new Python for you, and for everyone!
07/10/2021 Duración: 44minWatch the live stream: Watch on YouTube About the show Special guest: Yael Mintz Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Michael #1: awesome-htmx An awesome list of resources about htmx such as articles, posts, videos, talks and more. Good for all sorts of examples and multiple languages We get a few nice shoutouts, thanks Brian #2: Python 3.10 is here !!!! As of Monday. Of course I have it installed on Mac and Windows. Running like a charm. You can watch the Release Party recording. It’s like 3 hours. And starts with hats. Pablo’s is my fav. Also a What’s New video which aired before that with Brandt Bucher, Lukasz Llanga ,and Sebastian Ramirez (33 min) Includes a deep dive into structural pattern matching that I highly recommend. Reminder of new features: PEP 623 -- Deprecate and prepare for the removal of the wstr member in PyUnicodeObject. PEP 604 -- Allow writing union types as X | Y PEP 612 -- Parameter Specification Variables PEP 626 -- Precis
-
#252 Jupyter is now a desktop app!
29/09/2021 Duración: 44minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Ethan Swan Michael #0: Changing themes to DIY Brian #1: SQLFluff Suggested by Dave Kotchessa. A SQL Linter, written in Python, tested with pytest Configurable, and configuration can live in many places including tox.ini and pyproject.toml. Great docs Rule reference with anti-pattern/best practice format Includes dialects for ANSI, PostgreSQL, MySQL, Teradata, BigQuery, Snoflake Note in docs: “SQLFluff is still in an open alpha phase - expect the tool to change significantly over the coming months, and expect potentially non-backward compatible api changes to happen at any point.” Michael #2: JupyterLab Desktop JupyterLab App is the cross-platform standalone application distribution of JupyterLab. Bundles a Python environment with several popular Python libraries ready to use in scientific computing and data science workflows. JupyterLab App wor
-
#251 A 95% complete episode (wait for it)
22/09/2021 Duración: 55minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Brett Cannon Michael #1: auto-optional by Daan Luttik Did you know that concrete types cannot be None in Python typing? This is wrong: def do_a_thing(extra_info: str = None): ... auto-optional will fix it: def do_a_thing(extra_info: Optional[str] = None): ... Why would you want this? Easily modify external libraries that didn't pay attention to proper use of optional to improve mypy linting. Force consistency in your own code-base: Enforcing that None parameter implies an Optional type. Run via the CLI: auto-optional [path] Brian #2: Making World-Class Docs Takes Effort Daniel Stenberg Six requirements for a project to get a gold star docs in the code repo NOT extracted from the code examples, lots of examples, more than you think you need document every API call you provide easily accessible and browsable and hopefully offline
-
#250 skorch your scikit-learn together with PyTorch
15/09/2021 Duración: 41minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Prayson Daniel Brian #1: Exciting New Ways To Be Told That Your Python Code is Bad Two new pylint errors consider-ternary-expression if condition(): x = 4 else: x = 5 x = 4 if condition() else 5 while-used it unconditionally flags every use of while expressions. generally, while should be avoided. Michael #2: GitHub Readme Stats via Роман Великий Dynamically generated stats for your github readmes This are for your repo or your stats (others too I suppose) posted somewhere outside of github Card for a project: https://github-readme-stats.vercel.app/api/pin/?username=mikeckennedy&repo=python-switch Card for a user: https://github-readme-stats.vercel.app/api?username=mikeckennedy&show_icons=true&theme=radical Card for your languages: https://github-readme-stats.vercel.app/api/top-langs/?username=mi
-
#249 All of Linux as a Python API
09/09/2021 Duración: 37minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Erik Christiansen Michael #1: Fickling via Oli A Python pickling decompiler and static analyzer Pickled ML models are becoming the data exchange and workflow of ML Analyses pickle files for security risks - It can also remove or insert [malicious] code into pickle files... Created by a security firm, it can be a useful defensive or offensive tool. Perhaps it is time to screen all pickles? >>> import ast >>> import pickle >>> from fickling.pickle import Pickled >>> print(ast.dump(Pickled.load(pickle.dumps([1, 2, 3, 4])).ast, indent=4)) Module( body=[ Assign( targets=[ Name(id='result', ctx=Store())], value=List( elts=[ Constant(value=1), Constant(value=2)
-
#248 while True: stand up, sit down
02/09/2021 Duración: 52minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Paul Everitt Brian #1: Why I use attrs instead of pydantic Tin Tvrtković, @tintvrtkovic attrs vs dataclasses Since dataclasses are a strict subset of attrs functionality. Recommend using attrs in most cases over dataclasses attrs is faster, has more features, releases more frequently, offers over a wider range of Python versions. attrs vs Pydantic attrs is a library for generating the boring parts of writing classes; Pydantic is that but also a complex validation library. a structuring/unstructuring library, ex converting to json and back attrs has opt-in validation that you have more control over cattrs can be used for structuring/unstructuring converters are opt-in for attrs, built into Pydantic, and can be wrong. example using Pendulum that Pydantic mishandles Summary attrs + cattrs + validators where necessary, converters where necessa
-
#247 Do you dare to press "."?
26/08/2021 Duración: 46minSee the full show notes for this episode on the website at pythonbytes.fm/247.
-
#246 Love your crashes, use Rich to beautify tracebacks
11/08/2021 Duración: 46minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: David Smit Brain #1: mktestdocs Vincent D. Warmerdam Tutorial with videos Utilities to check for valid Python code within markdown files and markdown formatted docstrings. Example: import pathlib import pytest from mktestdocs import check_md_file @pytest.mark.parametrize('fpath', pathlib.Path("docs").glob("**/*.md"), ids=str) def test_files_good(fpath): check_md_file(fpath=fpath) This will take any codeblock that starts with ```python and run it, checking for any errors that might happen. Putting assert statements in the code block will actually check things. Other examples in README.md for markdown formatted docstrings from functions and classes. Suggested usage is for code in mkdocs documentation. I’m planning on trying it with blog posts. Michael #2: Redis powered queues (QR3) via Scot Hacker QR queues store
-
#245 Fire up your Python time machine (and test some code)
04/08/2021 Duración: 41minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Juan Pedro Araque Espinosa (Youtube Chanel: Commit that Line) Michael #1: State of the community (via Jet Brains) This report presents the combined results of the fifth annual Developer Ecosystem Survey conducted by JetBrains Not just Python, but all of us Python is more popular than Java in terms of overall usage, while Java is more popular than Python as a main language. The 5 fastest growing languages are Python, TypeScript, Kotlin, SQL, and Go. A majority of the respondents (71%) develop for web backend. Does fall into the trap of “Hi, I’m a CSS developer, nice to meet you” though Women are more likely than men to be involved in data analysis, machine learning, and UX/UI design or research. Women are less likely than men to be involved in infrastructure development and DevOps, system administration, or Deployment. Brian #2: Cornell - record &a
-
#244 vendorizing your Python podcast
30/07/2021 Duración: 34minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Brandon Braner Brain #1: pip Environmental Variables The problem with snakes on a plane → no internet Situation: want to work on some code on a plane project set up to use tox, which creates venvs, and pip installs dependencies from pypi.org. but… no internet Preflight work: run tox with an internet connection copy everything from all of the “site-packages” directories under “.tox” into a “wheels” directory or whatever you want to call it. set environmental variables: PIP_FIND_LINKS=file:/Users/okken/wheels PIP_NO_INDEX=1 Try this out first BEFORE getting on the plane, to make sure you didn’t miss anything. In flight: tox works fine now, using local dir as index Thanks Paul Ganssle for helping with this. All command line flags for pip are available as env variables: “pip’s command line options can be set with environment variables using the f
-
#243 Django unicorns and multi-region PostgreSQL
21/07/2021 Duración: 42minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Simon Willison Michael #1: MongoDB 5 Native Time Series: Designed for IoT and financial analytics, our new time series collections, clustered indexing, and window functions make it easier, faster, and lower cost to build and run time series applications MongoDB automatically optimizes your schema for high storage efficiency, low latency queries, and real-time analytics against temporal data. The Versioned API future-proofs your applications. You can fearlessly upgrade to the latest MongoDB releases without the risk of introducing backward-breaking changes that require application-side rework New MongoDB Shell we have introduced syntax highlighting, intelligent auto-complete, contextual help and useful error messages creating an intuitive, interactive experience for MongoDB users (use mongosh rather than mongo on the CLI). Also launched preview releas
-
#242 from lib import * but less
15/07/2021 Duración: 39minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Al Sweigart Brian #1: just From a tweet by Jeff Triplett “just is a handy way to save and run project-specific commands. Commands, called recipes, are stored in a file called justfile with syntax inspired by make 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: a couple spaces is fine, no need for tabs Recipes can accept command line arguments Recipes can be listed from the command line. Recipes can be written in arbitrary languages, 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 th
-
#241 f-yes we want some f-string tricks!
07/07/2021 Duración: 39minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Jay Miller Michael #1: Autosync all branches of a fork Use GitHub actions to keep your fork in sync Step 1: make changes in a separate branch (a branch other than main) to keep the working tree clean and avoiding conflicts with upstream Step 2: Add a new workflow under the “actions” section. We are going to follow the Fork-Sync-With-Upstream-action from the Actions Marketplace. Copy the YAML in the article being careful to use the right repo/branch names Step 3: click on Start Commit and Commit new file and that's it! See your running workflow in the actions tab Brain #2: Measuring memory usage in Python: it’s tricky! Itamar Turner-Trauring Nice, easy to follow discussion of memory Cool example to allocate 3 GB arr = np.ones((1024, 1024, 1024, 3), dtype=np.uint8) that’s a 4 dimensional array of bytes, 1k x 1k x 1k x 3 “Resident Memory” measure
-
#240 This is GitHub, your pilot speaking...
02/07/2021 Duración: 51minSee the full show notes for this episode on the website at pythonbytes.fm/240.