#127 That Python code is on fire!

Python Bytes - A podcast by Michael Kennedy and Brian Okken - Luni

Categories:

Sponsored by Datadog: pythonbytes.fm/datadog

Special guest: Kenneth Reitz

Brian #1: inline_python (for rust)

  • “I just made a Frankenstein's monster: Python code embedded directly in rustlang code. Should I kill it before it escapes the lab?” - Mara Bos
  • Writing some rust, and need a little Python?
  • Maybe want to pop open a matplotlib window?
  • This may be just the thing you need.
  • see also:
    • https://pypi.org/project/bash/

Kenneth #2: Requests3: Under Way!

  • Requests 2.x that you know and love is going into CVE-only mode (which it has been for a long time).
  • Requests III is a new project which will bring async/await keywords to Requests.
  • installable as requests3.
  • Type-Annotations
  • Python 3.6+

Michael #3: 🔥 Pyflame: A Ptracing Profiler For Python

  • Pyflame is a high performance profiling tool that generates flame graphs for Python.
  • Pyflame is implemented in C++, and uses the Linux ptrace(2) system call to collect profiling information.
  • It can take snapshots of the Python call stack without explicit instrumentation
  • Capable of profiling embedded Python interpreters like uWSGI.
  • Fully supports profiling multi-threaded Python programs.
  • Why use it?
    • Pyflame usually introduces significantly less overhead than the builtin profile (or cProfile) modules, and emits richer profiling data.
    • The profiling overhead is low enough that you can use it to profile live processes in production.

Brian #4: flit + src

  • Currently a WIP PR.
  • flit is easy.
    • Given a module or a source package.
    • flit init creates pyproject.toml and LICENSE files.
    • commit those to git
    • flit build creates a wheel
    • flit publish (builds and) publishes to whatever you have in your [.pypirc](https://docs.python.org/3/distutils/packageindex.html#the-pypirc-file)
  • Changes in this PR
    • The flit project already has 2 types of projects.
      • just a module, like foo.py
      • a package (directory with __init__.py), like foo/__init__.py
    • This would add a 3rd and 4th.
      • just a module, but in src, like src/foo.py
      • a package in src, like src/foo/__init__.py
  • May be cracking open a can of worms, but I’m ok with that.

Kenneth #5: $ pipx install pipenv

Michael #6: cheat.sh

Extras

Brian:

Michael:

Kenneth (optional):

  • PyColorado CFP
  • PyOhio CFP
  • PyRemote!

Jokes

Don’t know if I’ll do all of these, but I like them. 🙂 Brian and Kenneth, feel free to add yours if you have some!

MK: Ubuntu users are apt to get these jokes. MK: How many programmers does it take to kill a cockroach? Two: one holds, the other installs Windows on it. MK: A programmer had a problem. He thought to himself, 'I know, I'll solve it with threads!'. has Now problems. two he

(mildly offensive) KR: What’s the difference between a musician and a pizza? A pizza can feed a family of four.

(In collaboration with Jonatan Skogsfors) Python used to be directed by the BDFL, Guido. Now it’s directed by a steering council, GUIDs[0:4].

Visit the podcast's native language site