Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 23202

Python Bytes: #282 Don't Embarrass Me in Front of The Wizards

$
0
0
<p><strong>Watch the live stream:</strong></p> <a href='https://www.youtube.com/watch?v=tOA5uJthE14' style='font-weight: bold;'>Watch on YouTube</a><br> <br> <p><strong>About the show</strong></p> <p>Sponsored by us! Support our work through:</p> <ul> <li>Our <a href="https://training.talkpython.fm/"><strong>courses at Talk Python Training</strong></a></li> <li><a href="https://testandcode.com/"><strong>Test &amp; Code</strong></a> Podcast</li> <li><a href="https://www.patreon.com/pythonbytes"><strong>Patreon Supporters</strong></a></li> </ul> <p><strong>Brian #1:</strong> <a href="https://www.pyscript.net/"><strong>pyscript</strong></a></p> <ul> <li>Python in the browser, from Anaconda. <a href="https://github.com/pyscript/pyscript">repo here</a></li> <li>Announced at PyConUS</li> <li>“During a keynote speech at PyCon US 2022, Anaconda’s CEO Peter Wang unveiled quite a surprising project — <a href="https://pyscript.net/">PyScript</a>. It is a JavaScript framework that allows users to create Python applications in the browser using a mix of Python and standard HTML. The project’s ultimate goal is to allow a much wider audience (for example, front-end developers) to benefit from the power of Python and its various libraries (statistical, ML/DL, etc.).” from a nice article on it, <a href="https://towardsdatascience.com/pyscript-unleash-the-power-of-python-in-your-browser-6e0123c6dc3f"><strong>PyScript — unleash the power of Python in your browser</strong></a></li> <li>PyScript is built on <a href="https://pyodide.org/en/stable/">Pyodide</a>, which is a port of CPython based on WebAssembly.</li> <li>Demos are cool. </li> <li>Note included in README: “This is an extremely experimental project, so expect things to break!”</li> </ul> <p><strong>Michael #2:</strong> <a href="https://github.com/bloomberg/memray"><strong>Memray from Bloomberg</strong></a></p> <ul> <li>Memray is a memory profiler for Python. </li> <li>It can track memory allocations in <ul> <li>Python code</li> <li>native extension modules</li> <li>the Python interpreter itself</li> </ul></li> <li>Works both via CLI and focused app calls</li> <li>Memray can help with the following problems: <ul> <li>Analyze allocations in applications to help discover the cause of high memory usage.</li> <li>Find memory leaks.</li> <li>Find hotspots in code which cause a lot of allocations.</li> </ul></li> <li>Notable features: <ul> <li>🕵️‍♀️ Traces every function call so it can accurately represent the call stack, unlike sampling profilers.</li> <li>ℭ Also handles native calls in C/C++ libraries so the entire call stack is present in the results.</li> <li>🏎 Blazing fast! Profiling causes minimal slowdown in the application. Tracking native code is somewhat slower, but this can be enabled or disabled on demand.</li> <li>📈 It can generate various reports about the collected memory usage data, like flame graphs.</li> <li>🧵 Works with Python threads.</li> <li>👽🧵 Works with native-threads (e.g. C++ threads in native extensions)</li> </ul></li> <li><a href="https://bloomberg.github.io/memray/run.html#id3"><strong>Has a live view in the terminal</strong></a>.</li> <li>Linux only</li> </ul> <p><strong>Brian #3:</strong> <a href="https://github.com/browsertron/pytest-parallel"><strong>pytest-parallel</strong></a></p> <ul> <li>I’ve often sped up tests that can be run in parallel by using -n from pytest-xdist.</li> <li>I was recommending this to someone on Twitter, and Bruno Oliviera suggested a couple of alternatives. One was pytest-parallel, so I gave it a try.</li> <li>pytest-xdist runs using multiprocessing</li> <li>pytest-parallel uses both multiprocessing and multithreading.</li> <li>This is especially useful for test suites containing threadsafe tests. That is, mostly, pure software tests.</li> <li>Lots of unit tests are like this. System tests are often not.</li> <li>Use <code>--workers</code> flag for multiple processors, <code>--workers auto</code> works great.</li> <li>Use <code>--tests-per-worker</code> for multi-threading. <code>--tesst-per-worker auto</code> let’s it pick.</li> <li>Very cool alternative to xdist.</li> - </ul> <p><strong>Michael #4:</strong> <a href="https://www.fatiando.org/pooch/v1.6.0/index.html"><strong>Pooch: A friend for data files</strong></a></p> <ul> <li>via via Matthew Fieckert</li> <li>Just want to download a file without messing with <code>requests</code> and <code>urllib</code>?</li> <li>Who is it for? Scientists/researchers/developers looking to simply download a file.</li> <li>Pooch makes it easy to download a file (one function call). On top of that, it also comes with some bonus features: <ul> <li>Download and cache your data files locally (so it’s only downloaded once).</li> <li>Make sure everyone running the code has the same version of the data files by verifying cryptographic hashes.</li> <li>Multiple download protocols HTTP/FTP/SFTP and basic authentication.</li> <li>Download from Digital Object Identifiers (DOIs) issued by repositories like figshare and Zenodo.</li> <li>Built-in utilities to unzip/decompress files upon download</li> </ul></li> <li><code>file_path = pooch.retrieve(url)</code></li> </ul> <p><strong>Extras</strong> </p> <p>Michael:</p> <ul> <li>New course! <a href="https://training.talkpython.fm/courses/up-and-running-with-git-a-pragmatic-ui-based-introduction"><strong>Up and Running with Git - A Pragmatic, UI-based Introduction</strong></a>.</li> </ul> <p><strong>Joke:</strong> </p> <ul> <li><a href="https://www.reddit.com/r/ProgrammerHumor/comments/uh8rsb/happens_to_the_best_of_us/"><strong>Don’t embarrass me in front of the wizards</strong></a></li> <li>Michael’s <a href="https://twitter.com/mkennedy/status/1520181145261928448"><strong>crashing github</strong></a> is embarrassing him in front of the wizards!</li> </ul>

Viewing all articles
Browse latest Browse all 23202

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>