skillfed

pylast

A Python interface to Last.fm and Libre.fm

pylast v7.1.0 182.7K downloads/30d#10,088 on PyPI769
Permissive license Apache-2.0 Active released

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 pylast

uv

uv add pylast

poetry

poetry add pylast

Installing 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

Development Status :: 5 - Production/StableProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: InternetTopic :: Multimedia :: Sound/AudioTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

last.fm python api clientmusic scrobbling librarylast.fm data accesslibre.fm api wrappermusic listening history trackingscrobble submission pythonmusic metadata retrieval
music-apiscrobblinglast-fm

More Python Modules packages