pylast
A Python interface to Last.fm and Libre.fm
What it is and what it does
pylast is a Python wrapper around the Last.fm web API and compatible services like Libre.fm. It abstracts the HTTP layer and provides an object-oriented interface to query music metadata, manage user accounts, and submit scrobbles (track plays). The library handles authentication via API keys or session tokens, supports proxy configuration, and includes optional internal caching for repeated queries.
The package is production-stable (Development Status 5) and actively maintained, with support for modern Python versions. It depends only on httpx2 for HTTP operations, making installation straightforward. Use it when you need programmatic access to Last.fm data—querying artist or track information, managing user libraries, or building music-tracking applications.
Use it for:
- Build a music recommendation tool that queries Last.fm for artist and track metadata to suggest similar music.
- Create a scrobbler application that submits user listening history to Last.fm or Libre.fm automatically.
- Analyze personal music listening patterns by fetching user play counts and tag data from Last.fm.
- Integrate Last.fm data into a music player or library management application to enrich metadata.
- Sync music listening history across multiple platforms by reading from and writing to Last.fm.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pylast provides a Python interface to Last.fm and API-compatible music networks like Libre.fm, enabling programmatic access to music data, scrobbling, and user account operations.
Yes. pylast is a well-maintained, production-stable library with low install friction, no known vulnerabilities, and a permissive license. Install it if you need to interact with Last.fm or Libre.fm APIs; skip it if you only need local music metadata or don't require scrobbling or online music service integration.
Install
pylast on PyPI
pip
pip install pylastuv
uv add pylastpoetry
poetry add pylastInstalling pylast
Before you install
Low friction install with a single runtime dependency (httpx2). Active maintenance with a release 45 days ago and recent commits; supports current Python versions (3.10–3.15) on CPython and PyPy.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install pylast
import pylast
network = pylast.LastFMNetwork(
api_key="your_api_key",
api_secret="your_api_secret",
username="username",
password_hash=pylast.md5("password")
)
track = network.get_track("Artist", "Track")
track.love()
Requires a Last.fm API key and secret obtained from https://www.last.fm/api/account/create; authentication also requires a Last.fm account.
Verify before relying
- Whether httpx2 is a typo or intentional dependency name (httpx is the standard HTTP client library).
- Performance characteristics and rate-limiting behavior when making many concurrent API calls.
- Whether internal caching is suitable for production workloads or primarily for development.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — httpx2 |
| Maintenance | actively maintained — 45 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 182,688/month — #10,088 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pylast-7.1.0-py3-none-any.whl
Keywords: Last.fm, music, scrobble, scrobbling
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
librosalibrosa provides audio and music signal…
permissive · top 5,000 on PyPI
music-assistant-clientPython async client library for connecting to…
permissive · top 15,000 on PyPI
music21music21 is a Python toolkit for analyzing,…
permissive · top 15,000 on PyPI
ytmusicapiytmusicapi lets you programmatically interact…
permissive · top 15,000 on PyPI
syncedlyricsFetches synchronized lyrics in LRC format for…
permissive · top 15,000 on PyPI
spotipySpotipy is a Python client library for the…
permissive · top 15,000 on PyPI
pydubPydub provides a high-level Python interface…
permissive · top 5,000 on PyPI
aubioaubio is a Python wrapper around a C library…
copyleft · top 15,000 on PyPI
phaxioA Python client library for the Phaxio API that…
permissive · top 15,000 on PyPI
wiimwiim provides a Python API to discover,…
permissive · top 15,000 on PyPI