12 Python Libraries You Need to Try by Year End
Python libraries move fast, and the last three months were busy. If you want the new Python libraries worth your time before 2026 ends, this list covers 12 of them across data, AI agents, and developer tooling.
DuckDB 2.0 shipped on October 21, FastMCP 4 went stable on the new Model Context Protocol (MCP), and Meta's Pyrefly reached 1.0 while Astral's ty keeps closing in on it.
Each entry has a link, a current metric, and a short example you can run today.
How These 12 Were Picked
I used three filters: popularity (GitHub stars), real usage (PyPI downloads and survey data), and usefulness (does it solve a job you have this week). Every number is dated, because stars and downloads change quickly.
Four of the picks, Polars, FastMCP, Pydantic AI and Pyrefly, also appeared in KDnuggets' February list, so those entries focus on what changed since then.
All code was run on Python 3.12 with Polars 2.1.0, DuckDB 2.0.0, Narwhals 2.28.0, marimo 0.25.2, Pydantic AI 2.68.0, OpenAI Agents SDK 0.24.0, Google Agent Development Kit (ADK) 2.14.0, FastMCP 4.1.8, uv 0.13.7, Ruff 0.17.4, ty 0.0.101 and Pyrefly 1.4.1.
The two examples that call a hosted model need an API key, so for those I tested the agent and tool definitions only.
Part 1: Data Libraries
The biggest release of the quarter landed here, so we start with data.
1. Polars
Polars is a DataFrame library written in Rust. Its main idea is lazy execution: you describe the whole query, and Polars optimizes the plan before it reads anything, so it only loads the rows and columns it needs.
The numbers show it is still the challenger. In the last month, pandas had 546.9 million PyPI downloads and Polars 49.9 million (pypistats, October 7, 2026), which puts Polars at roughly a tenth of pandas' volume. pandas is not standing still either, since pandas 3.0 was released on January 21.
Try Polars if your data fits in memory and your group-bys feel slow.
import polars as pl
# Build a small sales table and save it as Parquet so we have a file to scan
pl.DataFrame({
"region": ["west", "east", "west", "north", "east", "west"],
"amount": [120.0, 80.5, 99.9, 45.0, 210.0, 15.5],
}).write_parquet("sales.parquet")
result = (
pl.scan_parquet("sales.parquet") # lazy: nothing is read yet
.filter(pl.col("amount") > 20) # keep rows above 20
.group_by("region") # group by region
.agg(pl.col("amount").sum().alias("total"))
.sort("total", descending=True)
.collect() # run the optimized plan now
)
print(result)
The first block just creates a Parquet file to work with. scan_parquet builds a lazy query instead of loading the file, and filter, group_by, agg and sort add steps to the plan. Nothing executes until collect(), which is where Polars optimizes and runs everything at once.
The output has three rows, with east first at 290.5. Use scan_csv for the same pattern on CSV files.
2. DuckDB
DuckDB is an analytical SQL database that runs inside your Python process, with no server to set up. The news is version 2.0. DuckDB 2.0.0, a long-term support release, shipped on October 21 and will be supported until at least October 2027.
It was built from roughly 20,000 commits since 1.5, and its headline feature is the Quack protocol, which lets any DuckDB process serve its databases. DuckDB can now work as a server, not only an embedded engine.
Usage backs it up, with 52.2 million PyPI downloads in the last month. One caution: moving from 1.4 to 2.0 includes breaking changes, so read the migration guide before touching production.
import duckdb
import polars as pl
orders = pl.DataFrame({"customer": ["ada", "ben", "ada", "cy"], "total": [30, 12, 45, 8]})
# DuckDB finds the Polars DataFrame by its variable name
top = duckdb.sql("""
SELECT customer, SUM(total) AS spent
FROM orders
GROUP BY customer
ORDER BY spent DESC
""")
print(top.pl())
# The same engine can query a file directly (sales.parquet from the Polars example)
print(duckdb.sql("SELECT region, COUNT(*) AS n FROM 'sales.parquet' GROUP BY region ORDER BY region").fetchall())
DuckDB looks up orders in your Python scope and queries it as if it were a table, so there is no loading step. .pl() converts the result back to a Polars DataFrame.
The second query reads a Parquet file straight from disk, which is why DuckDB pairs so well with Polars: one handles SQL, the other handles Python-style transformations, and they pass data back and forth cheaply.
3. Narwhals
If you write helper functions, you have probably written one version for pandas and another for Polars. Narwhals removes that duplication. It is a thin compatibility layer with full API support for cuDF, Modin, pandas, Polars and PyArrow, and lazy-only support for Dask, DuckDB, Ibis, PySpark and others.
Releases are frequent, with 2.27.1 published on October 10. It matters most if you maintain a library, but any team with mixed pandas and Polars code can use it. The rule is simple: you get back the same type you passed in.
import narwhals as nw
import pandas as pd
import polars as pl
from narwhals.typing import IntoFrameT
def add_tax(df_native: IntoFrameT, rate: float = 0.075) -> IntoFrameT:
df = nw.from_native(df_native) # wrap whatever we got
out = df.with_columns((nw.col("price") * (1 + rate)).alias("price_with_tax"))
return out.to_native() # hand back the same type
data = {"item": ["pen", "book"], "price": [2.0, 15.0]}
print(add_tax(pd.DataFrame(data)))
print(add_tax(pl.DataFrame(data)))
from_native wraps any supported DataFrame in a common interface that uses Polars-style expressions. with_columns adds the new column, and to_native unwraps the result.
The same function ran on a pandas frame and a Polars frame and returned each one in its own type, with a price_with_tax column of 2.15 and 16.125.
4. marimo
marimo is a reactive Python notebook. When you change a cell, every cell that depends on it re-runs automatically, so hidden state and out-of-order execution stop being a problem. Notebooks are saved as plain .py files, which means they diff cleanly in Git and run with python notebook.py.
Growth has been steady. As of August 19, the repo had 22,393 stars, and PyPI recorded 2,625,051 downloads in the preceding month, which Zyte puts in the same order of magnitude as Scrapy.
Save the code below as nb.py and open it with marimo edit nb.py.
import marimo
app = marimo.App()
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
# A UI element; changing it re-runs every cell that reads slider.value
slider = mo.ui.slider(1, 10, value=3, label="Multiplier")
slider
return (slider,)
@app.cell
def _(mo, slider):
mo.md(f"10 x {slider.value} = **{10 * slider.value}**")
return
if __name__ == "__main__":
app.run()
Each @app.cell function is one notebook cell, and the function arguments declare what it depends on. The third cell takes slider as an input, so moving the slider re-runs it and updates the text with no callback code.
Running python nb.py executes the same file as a normal script.
Part 2: AI Agent Libraries
Every major AI lab now has its own agent framework, so I looked at which ones developers actually install. Here is how three of the newer ones compared on November 2, according to BetterClaw's framework comparison: the OpenAI Agents SDK had 30K stars and 12.4M monthly downloads, Google ADK had 22K and 10.1M, and Pydantic AI had 21K and 5.4M.
For context, the same source shows LangChain at 170M monthly downloads and LangGraph at 45M, so these three are rising, not leading. Add FastMCP, which handles the tool side, and you have a practical set.
5. Pydantic AI
Pydantic AI comes from the team behind Pydantic and focuses on typed, validated output. You describe the shape of the answer as a Pydantic model, and the framework makes the model's reply fit it.
Per BetterClaw's November data, it has about 21K stars and 5.4M monthly downloads. It is a library only, with no hosted deployment product attached, which some teams will like.
from pydantic import BaseModel
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
class CityInfo(BaseModel):
city: str
country: str
agent = Agent(TestModel(), output_type=CityInfo)
# TestModel needs no API key
result = agent.run_sync("Where is the Eiffel Tower?")
print(result.output)
print(type(result.output).__name__)
CityInfo is the schema the answer must follow, and output_type tells the agent to return that type. TestModel is a built-in fake model that fills the schema with placeholder values, so you can test the wiring offline.
The output is a real CityInfo object, not loose text. To use a real model, replace TestModel() with a model string from the Pydantic AI docs and set that provider's API key.
6. OpenAI Agents SDK
The OpenAI Agents SDK is a small Python toolkit with agents, tools, handoffs between agents, guardrails and sessions. It has over 30,500 stars and the highest monthly downloads of the three newer frameworks above. It is also still a 0.x release, so expect API changes between versions.
from agents import Agent, Runner, function_tool
@function_tool
def word_count(text: str) -> int:
"""Count the words in a piece of text."""
return len(text.split())
agent = Agent(
name="Editor",
instructions="Use the word_count tool when asked about length.",
tools=[word_count],
)
if __name__ == "__main__":
# Needs OPENAI_API_KEY in your environment
result = Runner.run_sync(agent, "How many words are in 'to be or not to be'?")
print(result.final_output)
@function_tool turns a normal function into a tool, using the type hints and docstring to describe it to the model. The Agent bundles a name, instructions and its tools.
Runner.run_sync runs the loop: the model decides to call word_count, the SDK runs it, and the final answer comes back in final_output.
7. Google Agent Development Kit
Google's ADK is code-first and built for Gemini and Google Cloud, with Python, TypeScript, Java and Go versions. The Python repo has about 22K stars and 10.1M monthly downloads, and ADK 2.0 added graph-based workflows for agents that need explicit control flow. It deploys to Cloud Run or Vertex AI Agent Engine.
# clock_agent/agent.py
from google.adk.agents import Agent
def get_time(city: str) -> dict:
"""Return a fixed time for a city (stand-in for a real lookup)."""
return {"city": city, "time": "10:30"}
root_agent = Agent(
name="clock_agent",
model="gemini-2.5-flash", # use any Gemini model your key can access
description="Answers questions about the time in a city.",
instruction="Use the get_time tool to answer time questions.",
tools=[get_time],
)
ADK reads a plain Python function as a tool, again using the signature and docstring. The agent must be named root_agent so the command-line interface can find it.
Put this file at clock_agent/agent.py, add an __init__.py containing from . import agent, set GOOGLE_API_KEY, and run adk run clock_agent from the parent folder to chat with it.
8. FastMCP
FastMCP is the Python framework for building MCP servers, the tools your agents call. It is also the freshest release in this group. FastMCP 4 is stable and built for the new MCP, and the maintainers say most FastMCP 3 applications upgrade without code changes.
One breaking change to know about: server-initiated sampling is removed. On adoption, the project's own PyPI page says it is downloaded a million times a day and powers 70% of MCP servers, which is the maintainers' claim and not an independent figure. An outside write-up put it at 26,000 GitHub stars in July.
import asyncio
from fastmcp import FastMCP, Client
mcp = FastMCP("Demo")
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers."""
return a + b
async def main():
# Passing the server object connects in memory, no network or subprocess
async with Client(mcp) as client:
result = await client.call_tool("add", {"a": 2, "b": 3})
print(result.data)
if __name__ == "__main__":
asyncio.run(main())
@mcp.tool registers add as an MCP tool and builds its schema from the type hints. Passing mcp directly to Client tests the server in memory, so you can check a tool without starting anything.
The script prints 5. To serve it for real, call mcp.run() instead of the client.
Part 3: Tooling
The tooling story of the year is Astral. OpenAI announced on March 19 that it would acquire Astral, the company behind uv, Ruff and ty. The open-source licenses are permissive (MIT and Apache 2.0), and on the Talk Python podcast, founder Charlie Marsh said the release rate held roughly constant before and after the deal.
A second thread runs underneath: Rust. An estimated 25 to 33% of native PyPI extensions are now written in Rust, and uv, Ruff and ty are all part of that shift.
9. uv
uv replaces pip, virtualenv and pip-tools with one tool. In the 2025 Python Software Foundation and JetBrains survey, uv already had 11% adoption, and one pypistats-based write-up counts about 128 million downloads in the 30 days to October 8.
uv init demo # create a project with pyproject.toml
cd demo
uv add polars # install a package and record it
uv run main.py # run inside the project's environment
uv init creates the project files. uv add installs Polars into a managed virtual environment and writes it to pyproject.toml and a lockfile. uv run executes your script in that environment without you activating anything, so the same commands work on any machine.
10. Ruff
Ruff is a linter and formatter in one, and it is the most downloaded tool of the three Astral projects, at roughly 304 million downloads in the 30 days to October 8 according to that same write-up. It is not new, but it has become t
Comments
No comments yet. Start the discussion.