Posts

Showing posts from March, 2024

Offline use of Visual Studio Code

For the past few years, I've been doing most of my coding in "the Scientific Python Stack (NumPy, SciPy, Matplotlib, ...) , and friends. I still use MATLAB and Mathematica where there are gaps in functionality or the numerics in NumPy/SciPy are not up to snuff.  I used to use Spyder, the IDE included with Anaconda Python, but over the last couple of years have switched to Visual Studio Code for both an IDE and Jupyter notebooks. I'm not alone; VSCode has dominated the  Stack Overflow IDE Survey  for several years. One of the main features of VSCode is the rich ecosystem of extensions. When you're online, installing or updating an extension is a couple of mouse clicks; the procedure for offline use isn't so refined and has changed over time.  If you're starting fresh, VSCode supports a "Portable Mode", documented here: https://code.visualstudio.com/docs/editor/portable "This mode enables all data created and maintained by VS Code to live near itse...

Python Asyncio

Each time I need to write a multithreaded program in Python, I read through the Asyncio page in the Python docs, and give up and code with the threading library. This time I found a pretty good five-part tutorial written by someone at the BBC, so I'm bookmarking it here. https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-1.html https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-2 https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-3 https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-4 https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-5 Of course, this leaves the question of why exactly one should use Asyncio instead of threads https://discuss.python.org/t/what-are-the-advantages-of-asyncio-over-threads/2112 The official, and largely opaque (to me anyway) Asyncio docs https://docs.python.org/3/library/asyncio.html The threading docs and a useful tutorial on condition variables https://docs.python.org/3/library/threadin...