Python Trending Weekly
ISSUE 9

Python Trending Weekly #9 (2023-07-01)

2023-07-01 Season 1

TL;DR

The feature is a step-by-step guide to running open-source LLMs locally: LangChain plus Facebook's LLaMA for a document Q&A assistant, with Streamlit for the UI—and submissions are now open.

Articles 15 Projects 10
🦄

Articles & Tutorials

× 15
01 LangChain + Streamlit + Llama: A Comprehensive Guide to Deploying Open-Source Large Language Models Locally ai.plainenglish.io

A step-by-step guide to setting up a document-based question-answering assistant using LangChain and Facebook's open-source LLaMA large language model, along with a user-friendly interface built with Streamlit. (Also available in Chinese.)

LangChain + Streamlit + Llama: A Comprehensive Guide to Deploying Open-Source Large Language Models Locally
02 How much memory does a Python Asyncio coroutine take? so1n.me

The article's test result is about 2Kb. In addition, the article also tested the following questions: How many bare coroutines can be created per second? How many coroutines can be processed per second? How much improvement can be achieved in creating and processing coroutine tasks after using uvloop?

03 How to Execute Multiple Coroutines with asyncio.Runner superfastpython.com

asyncio.Runner is a new feature in Python 3.11 that allows you to execute multiple coroutines in the same event loop. The article covers how to run multiple coroutines using asyncio.run(), how to run multiple coroutines using the wrapper method, and how to use the asyncio.Runner class to execute coroutines in the same event loop in an adaptive or even conditional manner.

04 Concurrency without Locks hakibenita.com

In concurrent programming, it is common to use locks, but it is important to avoid overusing them. This article explores how to achieve concurrency with minimal reliance on locks, using the example of generating short links. The main idea is to "ask for forgiveness" instead of "checking in advance" and to use features provided by the PostgreSQL database.

05 Contributing to CPython Diary (3) How CPython Works zhuanlan.zhihu.com

This article introduces how CPython runs Python code. The main processes are: lexical analysis, syntax analysis, compilation to bytecode, and execution of bytecode.

06 Python JIT Compilers - Just-In-Time Compilation coderslegacy.com

This article explores the concept of JIT compilation and its benefits, and provides an in-depth analysis of the advantages and disadvantages of popular Python JIT compilers (such as PyPy, Numba, and Cython). It also presents best practices and guidelines for using JIT compilers in Python.

07 What are CPython, Pypy, MicroPython, Jython, etc.? bitecode.dev

When we say Python, we usually mean the official implementation CPython, but there are many other "Pythons", such as Pypy, Jython, MicroPython, Brython, RustPython, etc. There are also many things that look like new "Pythons", such as Nuitka, WinPython, Psycho, Pyjion, etc. This article explains the concepts and tools involved.

What are CPython, Pypy, MicroPython, Jython, etc.?
08 Python APScheduler: Experience the Power of AsyncIOScheduler coderslegacy.com

APScheduler is a scheduling and automation task tool. Its AsyncIOScheduler supports scheduling asynchronous functions and coroutines. The article introduces its functions, advantages, and how to optimize asynchronous task scheduling requirements.

09 Avoiding Technical Debt When Generating Code sourcery.ai

GPT and other large language models can generate code quickly and in large quantities, but this can also lead to a lot of messy code. The article explores several ways to improve the code generated by these tools and integrate it into projects, including adopting an expert persona, providing examples, following best practices, adhering to standards and clear guidelines, and placing the code in the right place.

10 When NumPy Is Slow pythonspeed.com

How can you improve NumPy performance without considering parallelization? NumPy has three inherent bottlenecks: eager execution, generic compiled code, and high memory usage due to vectorization. To address these bottlenecks, the article presents four solutions: hand-optimizing the code, using JAX for just-in-time compilation, using Numba for just-in-time compilation, and using ahead-of-time compilation.

11 Numba Tutorial: Accelerate Python Code with JIT Compilation coderslegacy.com

Numba is a specialized just-in-time compiler that eliminates the overhead of interpretation by compiling Python code to efficient machine code, thereby improving performance. The article covers Numba's features, internals, key usage, and common gotchas.

12 Automating Python Code Quality Improvements blog.fidelramos.net

How can you improve code quality with less time and effort? The article introduces several tools for improving code quality (flake8, Black, isort, mypy, bandit, etc.) and ways to automate these tools using IDEs, CI, and pre-commit.

13 Enhancing Data Analysis with PandasAI cognibits.hashnode.dev

PandasAI is a recently trending library that integrates AI conversational capabilities with Pandas, simplifying data manipulation. The article covers how to perform complex queries and visualize charts with PandasAI and introduces a dozen of its handy functions.

14 Best Practices for Writing Unit Tests codium.ai

The benefits of unit testing are well-known, yet writing unit tests is one of the most disliked tasks for developers. The article lists 10 best practices for writing unit tests, explains the steps for writing unit tests manually, and finally introduces a method for automating test writing using Codium.AI.

15 How Netflix Safely Migrated to GraphQL netflixtechblog.com

A blog post from Netflix, introducing three testing strategies used during the safe migration of their mobile app from Falcor to GraphQL: A/B testing, Replay testing, and Sticky Canaries. A/B testing was used to assess the impact of the new feature on customers, Replay testing was used to verify the correctness of the migration, and Sticky Canaries were used to verify performance and business metrics.

🎁 Python Trending Weekly 🎁 organizes its content into seasons, with every 30 issues forming a season. The highlights from the first season have been compiled for your convenience. You can access them online here (Chinese).

🐿️

Projects & Resources

× 10
01 PyGWalker: Convert pandas DataFrames to Tableau-style Visualizations github.com

A visual exploratory data analysis tool that runs in a Jupyter Notebook environment, generating an interactive graphical user interface with a single command, allowing for data exploration via drag-and-drop fields, similar to Tableau/PowerBI. (6.5k stars)

Image of PyGWalker
02 jnumpy: Rapidly write Python C extensions in Julia github.com

Write high-performance C extensions for Python in Julia, with a speedup of about 200x. (Submitted by @xgdgsc)

03 jupyter-ai: Generative AI extension for JupyterLab github.com

The official generative AI extension for JupyterLab, which mainly provides: %%ai directive, native chat UI page, and support for large language models across platforms (AI21, Anthropic, Cohere, Hugging Face, OpenAI, SageMaker, etc.).

04 broadcast-service: A Powerful Python Publisher-Subscriber Framework github.com

A publisher-subscriber framework that supports synchronous and asynchronous scheduling, timed tasks, topic management, publisher-subscriber callbacks, and more. (Submitted by @Zeeland)

05 cushy-storage: A disk-cached ORM framework github.com

A disk-cached ORM framework that enables CRUD operations on basic and custom data types via ORM, supporting multiple serialization operations and data compression methods. (Submitted by @Zeeland)

06 Giskard: A Testing Framework Dedicated to ML Models github.com

How to test machine learning models, what issues to cover, and how to implement the tests? This framework scans for dozens of vulnerabilities (performance bias, data leakage, lack of robustness, spurious correlations, overconfidence, underconfidence, ethical issues, etc.) and generates domain-specific test suites based on the findings. (1K stars)

Giskard: A Testing Framework Dedicated to ML Models
07 DragGAN: Interactive Image Editing Based on Points github.com

This week's hottest project, which can generate new images you want by dragging points on the image, is amazing! (star 28K)

DragGAN: Interactive Image Editing Based on Points
08 plumbum: Never write shell scripts again github.com

In addition to a shell-like syntax and convenient shortcuts, this library provides local and remote command execution (via SSH), local and remote file system paths, easy directory and environment manipulation, and a programmable CLI toolkit. (2.6k stars)

09 threestudio: A Unified Framework for Generating 3D Content github.com

Supports creating 3D content with text prompts, single images, and a small number of camera images. Supports a variety of models, such as ProlificDreamer, DreamFusion, Magic3D, Score Jacobian Chaining, and more. (1.8k stars)

10 rembg: A Tool to Remove Image Backgrounds github.com

Supports removing the background of an image with multiple usage methods (CLI, library, Docker) and a variety of powerful features. (10.5k stars)

rembg: A Tool to Remove Image Backgrounds
ESC
↑↓ select · ↵ open175 issues