https://www.gravatar.com/avatar/206912d6900c65386f24516df605c206?s=240&d=mp

Kourtney's Space

Multiprocessing, Multithreading and Asyncio in Python Part 1 - Basic Concept

After Python 3.4,
Asyncio emerged,
which can improve performance in specific scenarios.
Combined with the pre-existing Multiprocessing and Multithreading,
I have compiled a few records on the principles, differences, and use cases for these three technologies.
This first post will briefly introduce the basic concepts and suitable scenarios for each of the three.

Sync Obsidian / Joplin Data Across Multiple Devices with Synology WebDAV

I originally used Notion as my note-taking software.
It’s feature-rich and has a beautiful interface.
However, a few years ago, a privacy controversy arose around Notion,
accusing them of looking at a company’s content stored in Notion,
and even proposing a partnership based on that information.
So, I switched to Joplin for a while,
but eventually moved to Obsidian, which has a large number of plugins, strong community support, and is highly customizable.

Managing Pre-existing Global NPM Packages After Installing NVM

Today I encountered a problem:

After installing nvm, the path for installing global packages changed,

making it impossible to directly remove previously installed global packages using npm uninstall -g.

How did I discover this?

A long time ago, I installed a global package that could be executed directly from the terminal using a command.

But because it was so long ago,

when I tried to upgrade that package, I found it wasn’t listed in npm list -g.

Pyenv Notes

Functions and Reasons for Using pyenv

pyenv is a tool used to install various versions of Python on a system,

and to conveniently switch between Python versions.

When you need to develop or maintain projects that require different Python versions simultaneously,

you will need to use pyenv to help switch Python versions.

New Python versions usually include syntax updates or new features.

For example, Python’s async / await feature appeared only in Python 3.5 and later.

Python Coroutine Asyncio

Before the advent of asyncio,
when a Python program had many tasks that needed to be executed concurrently,
and wanted to improve program performance,
the only options were multiprocessing or threading.
After Python 3.4, asyncio became another option.
asyncio can be used to write coroutines,
and execute coroutines concurrently using an event loop,
reducing unnecessary waiting time in the program to improve performance.

Pipenv Notes

Why Pipenv

When maintaining many Python projects,
different projects might use different versions of the same Python libraries.
Not using a virtual environment and installing all Python modules directly on your machine will lead to version conflicts.

In the past, the mechanism of virtualenv + requirements.txt allowed different projects to use different versions of the same package,
and also enabled new developers or production environments to quickly install the packages required by the project.