Sponsored by pythonbytes.fm/digitalocean
Brian #1: Inside python dict — an explorable explanation
Michael #2: Embed Python in Unreal Engine 4
- 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.
Brian #3: Redirecting stdout with contextlib
- You may notice a theme throughout my set of picks on this episode
- Games built on Unreal Engine 4 include
- Plugin embedding a whole Python VM in Unreal Engine 4 (both the editor and runtime).
- This means you can use the plugin to write other plugins, to automate tasks, to write unit tests and to implement gameplay elements.
- Here is an example usage. It’s a really nice overview and tutorial for the editor.
- For game elements, check out this section.
- 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?
- so cool. And very easy to read.
f = io.StringIO()
s = f.getvalue()
Michael #4: Panda3D
- also a version for
Brian #5: Why PyPI Doesn't Know Your Projects Dependencies
- 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.
- 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.
Michael #6: PyGame series
- 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…
setup.py 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
setup.py file. But that would be kinda evil. But could be done. (Listener homework?)
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: https://pythonwheels.com
- “Advantages of wheels
- Faster installation for pure Python and native C extension packages.
- Avoids arbitrary code execution for installation. (Avoids setup.py)
- 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.”
- via @realpython
- Why do Pythons live on land? They are above C-level!