What Is a JIT and How Can Pyjion Speed Up Your Python?
<p>How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10.</p>
<p>Anthony has been working on Pyjion over the past year and recently released version 1.0. He talks about how he took over the project from Brett Cannon and Dino Viehland. He covers the background on compilers and assembly that he needed to take on this project. </p>
<p>We discuss where a tool like this can speed up your Python code, and we consider alternative solutions. We also talk about his desire to make the project as deeply compatible with Python code as possible. </p>
<p>Anthony talks about how his dive into writing the <em>CPython Internals</em> book led him into the project. We talk about what type of developer would benefit from exploring the book. </p>
<p>We also cover his recent Real Python article, titled “Advanced Visual Studio Code for Python Developers.” It’s an excellent resource that VS Code users should bookmark to revisit as they grow with the tool.</p>
<div class="alert alert-primary" role="alert">
<p><strong>Spotlight:</strong> <a href="https://realpython.com/products/cpython-internals-book/">CPython Internals Book: Your Guided Tour Through the Python 3 Interpreter</a></p>
<p>Unlock the inner workings of the Python language, compile the Python interpreter from source code, and participate in the development of CPython.</p>
</div>
<p>Topics:</p>
<ul>
<li>00:00:00 – Introduction</li>
<li>00:02:15 – Cloud Developer Advocate at Microsoft</li>
<li>00:04:57 – Pyjion, a drop-in JIT compiler for CPython</li>
<li>00:07:52 – PyCon 2020 & 2021 talks and wanting to take on the project</li>
<li>00:12:46 – How Pyjion uses .NET 6 </li>
<li>00:17:32 – Trying out Pyjion functionality online </li>
<li>00:21:43 – Sponsor: Honeybadger</li>
<li>00:22:28 – Portability of projects using Pyjion</li>
<li>00:29:55 – Focus on compatibility with Python code</li>
<li>00:33:07 – Choosing to make it based on Python 3.10</li>
<li>00:37:45 – What would be prerequisites to work on the project?</li>
<li>00:40:40 – Other ways to help with project</li>
<li>00:44:34 – CPython Internals: Who is the book for?</li>
<li>00:49:46 – What resources do you need to work through the book?</li>
<li>00:52:04 – Spotlight: CPython Internals Book</li>
<li>00:53:21 – Do you use an IDE or code editor?</li>
<li>00:56:12 – Why did you decide to write the book?</li>
<li>00:57:12 – Advanced Visual Studio Code for Python Developers</li>
<li>01:03:20 – What are you excited about in the world of Python?</li>
<li>01:04:03 – What do you want to learn next?</li>
<li>01:05:33 – Thanks and goodbye</li>
</ul>
<p>Show Links:</p>
<ul>
<li><a href="https://github.com/tonybaloney/pyjion">Pyjion - A JIT for Python based upon CoreCLR</a></li>
<li><a href="https://pyjion.readthedocs.io/en/latest/index.html">Pyjion main documentation</a></li>
<li><a href="https://live.trypyjion.com/">live.trypyjion.com</a></li>
<li><a href="https://www.youtube.com/watch?v=I4nkgJdVZFA">Anthony Shaw - Why is Python slow? - YouTube</a></li>
<li><a href="https://www.youtube.com/watch?v=YFeUUdKBrJ8">Restarting Pyjion, a general purpose JIT for Python- is it worth it? - YouTube</a></li>
<li><a href="https://docs.microsoft.com/en-us/dotnet/standard/clr">Common Language Runtime (CLR) overview - .NET | Microsoft Docs</a></li>
<li><a href="https://tonybaloney.github.io/posts/extending-python-with-assembly.html">Writing Python Extensions in Assembly</a></li>
<li><a href="https://link.springer.com/book/10.1007/978-1-4842-5076-1">Beginning x64 Assembly Programming | SpringerLink</a></li>
<li><a href="https://www.pyston.org/">Pyston | Python Performance</a></li>
<li><a href="https://www.pypy.org/">PyPy</a></li>
<li><a href="https://github.com/facebookincubator/cinder">facebookincubator/cinder: Instagram’s performance oriented fork of CPython.</a></li>
<li><a href="https://hypothesis.readthedocs.io/en/latest/">Welcome to Hypothesis! — Hypothesis 6.36.0 documentation</a></li>
<li><a href="https://realpython.com/products/cpython-internals-book/">CPython Internals Book – Real Python</a></li>
<li><a href="https://realpython.com/advanced-visual-studio-code-python/">Advanced Visual Studio Code for Python Developers – Real Python</a></li>
<li><a href="https://github.com/tonybaloney/vscode-pets">vscode-pets: Adds playful pets 🦀🐱🐶 in your VS Code window</a></li>
<li><a href="https://docs.python.org/3.11/whatsnew/3.11.html">What’s New In Python 3.11 — Python 3.11.0a4 documentation</a></li>
<li><a href="https://suif.stanford.edu/dragonbook/">Compilers: Principles, Techniques, and Tools (Dragon Book)</a></li>
</ul>
<p>Level up your Python skills with our expert-led courses:</p>
<ul>
<li><a href="https://realpython.com/courses/finding-perfect-python-code-editor/">Finding the Perfect Python Code Editor</a></li>
<li><a href="https://realpython.com/courses/python-debugging-pdb/">Debugging in Python With pdb</a></li>
<li><a href="https://realpython.com/courses/looping-with-python-enumerate/">Looping With Python enumerate()</a></li>
</ul> <p><a rel="payment" href="https://realpython.com/join">Support the podcast & join our community of Pythonistas</a></p>
Advice on Getting Started With Testing in Python
<p>Have you wanted to get started with testing in Python? Maybe you feel a little nervous about diving in deeper than just confirming your code runs. What are the tools needed and what would be the next steps to level up your Python testing? This week on the show we have Anthony Shaw to discuss his article on this subject. Anthony is a member of the Real Python team and has written several articles for the site.</p>
<p>We discuss getting started with built-in Python features for testing and the advantages of a tool like pytest. Anthony talks about his plug-ins for pytest, and we touch on the next level of testing involving continuous integration.</p>
<p>Anthony recently finished a talk for PyCon 2020 Online, titled “Why is Python Slow?” He had the idea for the talk while he was working on his upcoming book about the CPython source code. </p>
<p>I also want to give an update on last weeks episode with Kyle Stratis, where we discussed Kyle being let go from his job due to the pandemic. Here’s some good news, Kyle will be joining a Boston startup called Vizit, as a senior data engineer. Congratulations Kyle!</p>
<div class="alert alert-primary" role="alert">
<p><strong>Course Spotlight:</strong> <a href="https://realpython.com/courses/python-print/">The Python <code>print()</code> Function: Go Beyond the Basics</a></p>
<p>This course will get you up to speed with using Python <code>print()</code> effectively. Prepare for a deep dive as you go through the sections. You may be surprised how much <code>print()</code> has to offer!</p>
</div>
<p>Topics:</p>
<ul>
<li>00:00:00 – Introduction</li>
<li>00:01:46 – PyCon 2020 Online Talk - Why is Python slow?</li>
<li>00:04:05 – CPython Internals Book</li>
<li>00:07:08 – Attending Conferences</li>
<li>00:09:01 – Getting Started with Testing in Python</li>
<li>00:12:32 – Unittest</li>
<li>00:17:16 – What does a tool like pytest add?</li>
<li>00:19:53 – pytest plugins</li>
<li>00:21:03 – Anthony’s pytest plugins</li>
<li>00:21:58 – What does coverage mean?</li>
<li>00:25:23 – Test runners </li>
<li>00:27:12 – Testing environments with Tox</li>
<li>00:30:50 – Real Python Video Course Spotlight</li>
<li>00:31:49 – More on continuous integration (CI)</li>
<li>00:37:21 – Recent changes to GitHub</li>
<li>00:38:21 – PSF to move issue tracker to GitHub</li>
<li>00:41:01 – DRY (Don’t Repeat Yourself)</li>
<li>00:43:46 – Benefits of linters and code formatting</li>
<li>00:48:00 – What is a little known part of Python?</li>
<li>00:52:16 – What are you excited about in the world of Python?</li>
<li>00:56:06 – What is something you thought you knew about Python, but were wrong about it?</li>
<li>00:57:27 – Goodbye and thanks</li>
</ul>
<p>Show links:</p>
<ul>
<li><a href="https://www.youtube.com/watch?v=I4nkgJdVZFA">Why is Python slow?: PyCon 2020 Online Talk</a></li>
<li><a href="https://realpython.com/cpython-source-code-guide/">Your Guide to the CPython Source Code: Real Python article</a></li>
<li><a href="https://talkpython.fm/episodes/show/265/why-is-python-slow">TalkPython Podcast Episode #265: Why is Python slow?</a></li>
<li><a href="https://realpython.com/python-testing/">Getting Started With Testing in Python: Real Python article </a></li>
<li><a href="https://docs.pytest.org/en/latest/">pytest: helps you write better programs</a></li>
<li><a href="https://github.com/tonybaloney/pytest-azurepipelines">pytest-azurepipelines: Plugin for pytest that makes it simple to work with Azure Pipelines</a></li>
<li><a href="https://realpython.com/pytest-python-testing/">Effective Python Testing With Pytest</a></li>
<li><a href="https://pypi.org/project/tox/">tox automation project: Command line driven CI frontend</a></li>
<li><a href="https://github.com/features/actions">GitHub Actions: Automate your workflow from idea to production</a></li>
<li><a href="https://realpython.com/python-continuous-integration/">Continuous Integration With Python: An Introduction: Real Python article</a></li>
<li><a href="https://www.youtube.com/watch?v=2R1HELARjUk">Brian K Okken - Multiply your Testing Effectiveness with Parameterized Testing: PyCon 2020 Online Talk</a></li>
<li><a href="https://pragprog.com/book/bopytest/python-testing-with-pytest">Python Testing with pytest: Brian Okken - The Pragmatic Bookshelf</a></li>
<li><a href="https://testandcode.com">Test & Code: Python Testing for Software Engineering: Podcast</a></li>
<li><a href="https://pyfound.blogspot.com/2020/05/pythons-migration-to-github-request-for.html">Python’s migration to GitHub</a></li>
<li><a href="https://realpython.com/python-refactoring/">Refactoring Python Applications for Simplicity: Real Python article</a></li>
<li><a href="https://black.readthedocs.io/en/stable/">Black: The uncompromising code formatter</a></li>
<li><a href="https://pypi.org/project/wily/">Wily: A command-line application for tracking, reporting on complexity of Python tests and applications</a></li>
<li><a href="https://www.python.org/dev/peps/pep-0554/">PEP 554 – Multiple Interpreters in the Stdlib</a></li>
<li><a href="https://blog.python.org">Python Insider: Python core development news and information</a></li>
</ul>
<p>Level up your Python skills with our expert-led courses:</p>
<ul>
<li><a href="https://realpython.com/courses/python-continuous-integration/">Continuous Integration With Python</a></li>
<li><a href="https://realpython.com/courses/test-driven-development-pytest/">Test-Driven Development With pytest</a></li>
<li><a href="https://realpython.com/courses/python-print/">The Python print() Function: Go Beyond the Basics</a></li>
</ul> <p><a rel="payment" href="https://realpython.com/join">Support the podcast & join our community of Pythonistas</a></p>
#265: Why is Python slow?
See the full show notes for this episode on the website at talkpython.fm/265
#100 The big 100 with special guests
Topics covered in this episode:
poetry
Anthony pylama and radon
Nina Tools for teaching Python
Dan My favorite tool of 2018: “Black” code formatter by Łukasz Langa
Brett A Web without JavaScript : Russell Keith-Magee at PyCon AU
Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Extras
Joke
See the full show notes for this episode on the website at pythonbytes.fm/100
#168: 10 Python security holes and how to plug them
See the full show notes for this episode on the website at talkpython.fm/168