<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ernesro Enriquez on Medium]]></title>
        <description><![CDATA[Stories by Ernesro Enriquez on Medium]]></description>
        <link>https://medium.com/@eyenriquez?source=rss-3a9cb44b52ab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Ernesro Enriquez on Medium</title>
            <link>https://medium.com/@eyenriquez?source=rss-3a9cb44b52ab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:58:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eyenriquez/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How Spotipy and Python Power Spotify Data]]></title>
            <link>https://medium.com/@eyenriquez/how-spotipy-and-python-power-spotify-data-376cc59c195f?source=rss-3a9cb44b52ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/376cc59c195f</guid>
            <dc:creator><![CDATA[Ernesro Enriquez]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 07:33:03 GMT</pubDate>
            <atom:updated>2026-09-16T07:36:49.118Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Every day, over 600 million users open Spotify, tap play, and expect instantaneous music delivery. Beyond streaming, Spotify curates hyper-personalized features like Discover Weekly, Daily Mix, and Spotify Wrapped.</p><p>While backend infrastructure utilizes languages like C++ and Java for low-level performance, Python serves as the primary backbone for backend microservices, data engineering, and machine learning pipelines. Up to 80% of Spotify’s backend services were originally built using Python frameworks.</p><p>Python powers Spotify’s architecture across three main domains, supported by open-source libraries like <strong>Spotipy</strong>, <strong>Luigi</strong>, and <strong>Chartify</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*1VYQ73AcyzOgjMblqDBStg.jpeg" /></figure><h3>What Spotipy and Python Can Do for Spotify</h3><p>Python is not limited to a single task within Spotify’s ecosystem. It serves several core engineering needs, and each one relies on specialized libraries to handle music streaming demands.</p><p>Instead of writing raw HTTP requests, developers use <strong>Spotipy</strong>, a dedicated Python library that wraps around the Spotify Web API. The data engineering section uses Spotify’s own Luigi library to orchestrate complex batch data workflows across server clusters. Another part of Spotify&#39;s ecosystem is data visualization, where the internal library Chartify helps data scientists format listening trends quickly.</p><h3>Fetching Song Metadata with Spotipy</h3><p>In music streaming, applications process large amounts of audio information. Spotify measures audio characteristics such as tempo, danceability, and energy for every song in its catalog. To fetch this data using Python, developers use the <strong>Spotipy</strong> library, which simplifies connecting to Spotify’s platform into clean, readable methods.</p><p>In this example, Spotipy initializes an API client with access credentials and fetches the audio features of a specific track with a single line of Python code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*1hpZmGflruabzFg-6eHVoA.png" /><figcaption><a href="https://developer.spotify.com/documentation/web-api/reference/get-audio-features">https://developer.spotify.com/documentation/web-api/reference/get-audio-features</a></figcaption></figure><p>The first line imports the requests library to manage internet connections. The next lines set the URL and security header needed to access Spotify&#39;s backend. The GET request pulls the JSON payload from Spotify, and the final lines display the track’s audio metrics on screen.</p><p><em>Code example adapted from official Spotify Web API endpoints.</em></p><h3>Data Engineering Pipelines with Luigi</h3><p>Data teams at Spotify handle billions of daily user streaming events. Engineers need a way to schedule and chain multi-step data tasks, such as fetching streaming logs and generating personalized recommendations. Spotify created an open-source Python library called Luigi to manage task dependencies.</p><p>In the example shown, Python code defines two separate task classes: FetchUserStreams and ProcessRecommendationData. The second task explicitly depends on the first task completing successfully before it begins running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*5Q8rTGkdw-12HneZWYBY9w.png" /><figcaption><a href="https://github.com/spotify/luigi">https://github.com/spotify/luigi</a></figcaption></figure><p>The first line imports luigi. The FetchUserStreams class defines how raw streaming logs are fetched and stored. The requires method inside ProcessRecommendationData forces Luigi to wait for raw logs before running the recommendation task. The final block executes the pipeline automatically.</p><p><em>Figure 1: Visual dependency graph generated by Spotify Luigi showing task completion states.</em></p><p><em>Code example adapted from official Spotify Luigi documentation.</em></p><h3>Data Visualization with Chartify</h3><p>Spotify data scientists analyze trends across millions of artist streams. To quickly present these insights, Spotify developed Chartify, an open-source Python library built on top of Bokeh. It allows engineers to create clean, styled charts without writing complex visualization code.</p><p>The following code uses Pandas to structure artist stream counts and Chartify to display the bar chart cleanly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*HSTvrXcAPx7PQIgule52YA.png" /><figcaption><a href="https://github.com/spotify/chartify">https://github.com/spotify/chartify</a></figcaption></figure><p>The first two lines load chartify and pandas into the script. Next, the Pandas DataFrame organizes artist names alongside stream numbers. chartify.Chart creates the chart canvas with default Spotify branding styles, and ch.plot.barplot renders the data directly to the screen.</p><p><em>Code example adapted from official Spotify Chartify documentation.</em></p><p><em>Figure 2: Rendered Chartify bar plot showing categorized stream counts generated via Python.</em></p><h3>Benefits and Limitations of Python at Spotify</h3><p>Python helps solve many problems that software engineers face by speeding up the development process. It provides rich libraries like Luigi and Chartify so engineers do not have to write data orchestrators or plotting tools from scratch. When Spotify processes billions of daily events, automated Python pipelines prevent human errors during manual data transfers.</p><p>However, Python also has some limitations. Because it is an interpreted language, Python can be slower for compute-heavy tasks compared to languages like C++ or Java. Spotify overcomes this by running performance-critical tasks in native libraries, while keeping Python to handle control flow and API connections. Furthermore, automated pipelines require proper code logic — if a developer configures a pipeline incorrectly, Python will process erroneous calculations consistently without recognizing the logical error.</p><h3>Conclusion</h3><p>To wrap up, Python is a core language for Spotify’s engineering team, supporting critical tasks across API services, data pipelines, and analytics. As shown, Python works efficiently with HTTP requests, workflow schedulers like Luigi, and charting tools like Chartify. In this blog, three code examples demonstrated how Python powers Spotify behind the scenes.</p><p>In the end, learning Python enables developers to build large-scale applications and manage complex data flows efficiently. Python provides a flexible toolbox that simplifies modern software development for the next generation of engineers. Beyond these technical steps, Python plays a massive role in making software design easier. Because Python code is clear and straightforward, engineers can test new ideas quickly without writing hundreds of lines of complex setup code. This allows teams to focus on creating new app features and improving user experiences instead of fighting with backend systems.</p><p>Additionally, Python shows how modern tech companies handle huge amounts of information. By mixing simple everyday tools with specialized libraries like Luigi, Spotipy, and Chartify, Spotify builds organized systems that work smoothly at a massive scale. Even as millions of new listeners join the platform, Python keeps everything running in the background.</p><p>In the end, learning Python enables developers to build large-scale applications and manage complex data flows efficiently. Python provides a flexible, powerful toolbox that simplifies modern software development for the next generation of engineers, proving that simple code can successfully power giant global platforms.</p><p>References:</p><p>Spotify Engineering Blog: <a href="https://engineering.atspotify.com/2013/03/how-we-use-python-at-spotify">https://engineering.atspotify.com/2013/03/how-we-use-python-at-spotify</a></p><p>Spotify Luigi GitHub Documentation: <a href="https://github.com/spotify/luigi">https://github.com/spotify/luigi</a></p><p>Spotify Chartify Documentation: <a href="https://github.com/spotify/chartify">https://github.com/spotify/chartify</a></p><p>Spotify Web API Developer Documentation: <a href="https://developer.spotify.com/">https://developer.spotify.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=376cc59c195f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>