Brought to you by DigitalOcean - grab your $100 credit and deploy your first project for free

Episode #116: So you want Python in a 3D graphics engine?

Published Wed, Feb 6, 2019, recorded Tues, Jan 29, 2019.

Sponsored by

Brian #1: Inside python dict — an explorable explanation

  • Interactive tutorial on dictionaries
    • Searching efficiently in a list
    • Why are hash tables called has tables?
    • Putting it all together to make an “almost”-Python-dict
    • How Python dict really works internally
  • Yes this is a super deep dive, but wow it’s cool.
  • Tons of the code is runnable right there in the web page, including moving visual representations, highlighted code with current line of code highlighted.
  • Some examples allow you to edit values and play with stuff.

Michael #2: Embed Python in Unreal Engine 4

Brian #3: Redirecting stdout with contextlib

  • When I want to test the stdout output of some code, that’s easy, I grab the capsys fixture from pytest.
  • But what if you want to grab the stdout of a method NOT while testing?
  • Enter [contextlib.redirect_stdout(new_target)](
  • so cool. And very easy to read.
  • ex:
    f = io.StringIO()
    with redirect_stdout(f):
    s = f.getvalue()
  • also a version for stderr

Michael #4: Panda3D

  • via Kolja Lubitz
  • Panda3D is an open-source, completely free-to-use engine for realtime 3D games, visualizations, simulations, experiments
  • Not just games, could be science as well!
  • The full power of the graphics card is exposed through an easy-to-use API. Panda3D combines the speed of C++ with the ease of use of Python to give you a fast rate of development without sacrificing on performance.
  • Features:
    • Platform Portability
    • Flexible Asset Handling: Panda3D includes command-line tools for processing and optimizing source assets, allowing you to automate and script your content production pipeline to fit your exact needs.
    • Library Bindings: Panda3D comes with out-of-the-box support for many popular third-party libraries, such as the Bullet physics engine, Assimp model loader, OpenAL
    • Performance Profiling: Panda3D includes pstats — an over-the-network profiling system designed to help you understand where every single millisecond of your frame time goes.

Brian #5: Why PyPI Doesn't Know Your Projects Dependencies

  • Some questions you may have asked: > How can I produce a dependency graph for Python packages? > Why doesn’t PyPI show a project’s dependencies on it’s project page? > How can I get a project’s dependencies without downloading the package? > Can I search PyPI and filter out projects that have a certain dependency?
  • If everything is in requirements.txt, you just might be able to, but…
  • is dynamic. You gotta run it to see what’s needed.
  • Dependencies might be environment specific. Windows vs Linux vs Mac, as an example.
  • Nothing stopping someone from putting random.choice() for dependencies in a file. But that would be kinda evil. But could be done. (Listener homework?)
  • The wheel format is way more predictable because it limits some of this freedom. wheels don’t get run when they install, they really just get unpacked.
  • More info on wheels: Kind of a tangent, but what why not:
    • From:
    • Advantages of wheels
      • Faster installation for pure Python and native C extension packages.
      • Avoids arbitrary code execution for installation. (Avoids
      • Installation of a C extension does not require a compiler on Linux, Windows or macOS.
      • Allows better caching for testing and continuous integration.
      • Creates .pyc files as part of installation to ensure they match the Python interpreter used.
      • More consistent installs across platforms and machines.”

Michael #6: PyGame series


Joke (maybe, Brain feel free to pick another one):

  • via @realpython
  • Why do Pythons live on land? They are above C-level!

Click to show comments