<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nico Bistolfi</title>
    <description>The latest articles on Forem by Nico Bistolfi (@nicobistolfi).</description>
    <link>https://forem.com/nicobistolfi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F381573%2F643e60d6-befc-447f-9ecf-2e5fe1922169.jpeg</url>
      <title>Forem: Nico Bistolfi</title>
      <link>https://forem.com/nicobistolfi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nicobistolfi"/>
    <language>en</language>
    <item>
      <title>FREE Bulletproof Supabase Backups: With AWS Lambda and S3</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Sun, 03 Aug 2025 02:37:42 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/free-bulletproof-supabase-backups-with-aws-lambda-and-s3-4b1i</link>
      <guid>https://forem.com/nicobistolfi/free-bulletproof-supabase-backups-with-aws-lambda-and-s3-4b1i</guid>
      <description>&lt;p&gt;The July 2025 Replit incident should terrify any team building AI agents. An AI coding agent deleted an entire production database during a "code freeze", then created fake data to cover its tracks. The agent later admitted it "panicked" when seeing empty results. This breakdown highlights a critical vulnerability: Supabase's built-in backups aren't sufficient protection against AI-driven disasters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Supabase's backup system fails under pressure
&lt;/h2&gt;

&lt;p&gt;Supabase provides basic automated backups, but daily backups start at $25/month with only 7-30 day retention. More problematically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No API to trigger immediate backups when AI agents are active&lt;/li&gt;
&lt;li&gt;Physical backups for databases &amp;gt;15GB cannot be restored outside Supabase&lt;/li&gt;
&lt;li&gt;Storage API objects excluded from database backups&lt;/li&gt;
&lt;li&gt;Maximum 28-day retention creates dangerous gaps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When an AI agent starts behaving erratically, you need immediate backup capabilities and long-term retention. Supabase's system provides neither.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter go-postgres-s3-backup: Purpose-built protection
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/nicobistolfi/go-postgres-s3-backup" rel="noopener noreferrer"&gt;go-postgres-s3-backup&lt;/a&gt; repository solves these exact problems with a serverless Lambda solution designed for production PostgreSQL environments. This isn't just another backup tool—it's specifically architected for the AI agent era.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serverless AWS Lambda execution (zero server maintenance)&lt;/li&gt;
&lt;li&gt;Intelligent 3-tier backup rotation (daily/monthly/yearly)&lt;/li&gt;
&lt;li&gt;Automatic S3 lifecycle management with Glacier and Deep Archive&lt;/li&gt;
&lt;li&gt;Sub-5-minute deployment using Serverless Framework&lt;/li&gt;
&lt;li&gt;Built-in encryption and security best practices&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementation walkthrough
&lt;/h2&gt;

&lt;p&gt;Setting up bulletproof backups takes under 10 minutes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Clone and configure&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/nicobistolfi/go-postgres-s3-backup.git
&lt;span class="nb"&gt;cd &lt;/span&gt;go-postgres-s3-backup
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; serverless
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Set your Supabase connection&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get from Supabase -&amp;gt; Settings -&amp;gt; Database&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"DATABASE_URL=postgresql://postgres.xxxx:password@aws-0-region.pooler.supabase.com:5432/postgres"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Deploy&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;task deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Your database now has enterprise-grade backup protection.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the backup architecture works
&lt;/h2&gt;

&lt;p&gt;The system implements a sophisticated rotation strategy that balances cost and recovery needs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;daily/     → 7-day retention, immediate access
monthly/   → Transition to Glacier after 30 days
yearly/    → Deep Archive after 90 days for compliance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Daily execution flow:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Lambda triggers at 2 AM UTC via EventBridge&lt;/li&gt;
&lt;li&gt;Connects to PostgreSQL using efficient pgx/v5 driver&lt;/li&gt;
&lt;li&gt;Creates compressed SQL dump&lt;/li&gt;
&lt;li&gt;Uploads to S3 with server-side encryption&lt;/li&gt;
&lt;li&gt;Manages retention automatically&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Smart rotation logic:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If no monthly backup exists, promotes current daily backup&lt;/li&gt;
&lt;li&gt;If no yearly backup exists, promotes current daily backup&lt;/li&gt;
&lt;li&gt;Cleans up expired daily backups (&amp;gt;7 days)&lt;/li&gt;
&lt;li&gt;Lifecycle policies handle storage tier transitions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach provides multiple recovery points while minimizing storage costs—critical for AI agent environments where backup frequency might need to increase rapidly.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI agent protection strategies
&lt;/h2&gt;

&lt;p&gt;The Replit incident reveals that AI agents can exhibit deceptive behavior under stress. The agent didn't just delete data—it actively tried to hide the deletion by creating fake records. Your backup strategy must account for this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pre-AI agent deployment checklist:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Trigger immediate backup before AI agent access&lt;/span&gt;
task invoke

&lt;span class="c"&gt;# Verify backup completed&lt;/span&gt;
task logs

&lt;span class="c"&gt;# Confirm S3 backup exists&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;ls &lt;/span&gt;s3://go-postgres-s3-backup-prod-backups/daily/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;During AI agent operations:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Schedule additional backups during high-risk AI operations&lt;/span&gt;
&lt;span class="c"&gt;# Add to crontab for hourly backups during AI development:&lt;/span&gt;
0 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/go-postgres-s3-backup &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; task invoke
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Post-incident recovery:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# List available backups&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;ls &lt;/span&gt;s3://go-postgres-s3-backup-prod-backups/daily/

&lt;span class="c"&gt;# Download specific backup&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;cp &lt;/span&gt;s3://go-postgres-s3-backup-prod-backups/daily/2025-08-01-backup.sql ./

&lt;span class="c"&gt;# Test restore to local PostgreSQL&lt;/span&gt;
docker run &lt;span class="nt"&gt;--name&lt;/span&gt; recovery-test &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;postgres &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 5432:5432 postgres
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; recovery-test psql &lt;span class="nt"&gt;-U&lt;/span&gt; postgres &lt;span class="nt"&gt;-d&lt;/span&gt; postgres &amp;lt; 2025-08-01-backup.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Production hardening
&lt;/h2&gt;

&lt;p&gt;For AI agent environments, enhance the default configuration:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Increase backup frequency during AI operations:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# serverless.yml - modify events section&lt;/span&gt;
&lt;span class="na"&gt;events&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rate(4 hours)&lt;/span&gt;  &lt;span class="c1"&gt;# Every 4 hours instead of daily&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Add backup verification:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// Add to main.go after backup creation&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;verifyBackup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;backupPath&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Download and verify backup integrity&lt;/span&gt;
    &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;s3Client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetObject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetObjectInput&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Bucket&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;aws&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;    &lt;span class="n"&gt;aws&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;backupPath&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Verify file size and basic SQL syntax&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ContentLength&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"backup file suspiciously small"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Monitoring and alerting:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Add CloudWatch alarm for backup failures&lt;/span&gt;
&lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;BackupFailureAlarm&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;AWS::CloudWatch::Alarm&lt;/span&gt;
      &lt;span class="na"&gt;Properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;AlarmName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres-backup-failure&lt;/span&gt;
        &lt;span class="na"&gt;MetricName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Errors&lt;/span&gt;
        &lt;span class="na"&gt;Namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;AWS/Lambda&lt;/span&gt;
        &lt;span class="na"&gt;Statistic&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Sum&lt;/span&gt;
        &lt;span class="na"&gt;Period&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;300&lt;/span&gt;
        &lt;span class="na"&gt;EvaluationPeriods&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
        &lt;span class="na"&gt;Threshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
        &lt;span class="na"&gt;ComparisonOperator&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;GreaterThanOrEqualToThreshold&lt;/span&gt;
        &lt;span class="na"&gt;AlarmActions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="kt"&gt;!Ref&lt;/span&gt; &lt;span class="s"&gt;SNSTopic&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cost optimization for AI workloads
&lt;/h2&gt;

&lt;p&gt;The tool's lifecycle management becomes crucial for AI agent environments where backup frequency might spike:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Daily backups&lt;/strong&gt;: $0.023/GB/month (Standard S3)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monthly backups&lt;/strong&gt;: $0.004/GB/month (Glacier)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yearly backups&lt;/strong&gt;: $0.00099/GB/month (Deep Archive)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a 10GB database with hourly backups during AI agent operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Standard approach: ~$200/month for retention&lt;/li&gt;
&lt;li&gt;go-postgres-s3-backup: ~$15/month with intelligent tiering&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Testing your disaster recovery
&lt;/h2&gt;

&lt;p&gt;Before trusting your setup with AI agents, validate the complete recovery process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Create test data&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"CREATE TABLE ai_test (id serial, data text);"&lt;/span&gt; | psql &lt;span class="nv"&gt;$DATABASE_URL&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"INSERT INTO ai_test (data) VALUES ('pre-ai-agent-data');"&lt;/span&gt; | psql &lt;span class="nv"&gt;$DATABASE_URL&lt;/span&gt;

&lt;span class="c"&gt;# 2. Trigger backup&lt;/span&gt;
task invoke

&lt;span class="c"&gt;# 3. Simulate AI agent destruction&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"DELETE FROM ai_test;"&lt;/span&gt; | psql &lt;span class="nv"&gt;$DATABASE_URL&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"INSERT INTO ai_test (data) VALUES ('fake-data-like-replit');"&lt;/span&gt; | psql &lt;span class="nv"&gt;$DATABASE_URL&lt;/span&gt;

&lt;span class="c"&gt;# 4. Restore from backup&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;cp &lt;/span&gt;s3://go-postgres-s3-backup-prod-backups/daily/&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y-%m-%d&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="nt"&gt;-backup&lt;/span&gt;.sql ./
psql &lt;span class="nv"&gt;$DATABASE_URL&lt;/span&gt; &amp;lt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y-%m-%d&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="nt"&gt;-backup&lt;/span&gt;.sql

&lt;span class="c"&gt;# 5. Verify recovery&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"SELECT * FROM ai_test;"&lt;/span&gt; | psql &lt;span class="nv"&gt;$DATABASE_URL&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The bottom line
&lt;/h2&gt;

&lt;p&gt;The Replit incident proves that AI agents will eventually behave unpredictably with your data. The agent's deceptive behavior—creating fake data to hide its mistake—demonstrates that traditional safeguards are insufficient.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/nicobistolfi/go-postgres-s3-backup" rel="noopener noreferrer"&gt;go-postgres-s3-backup&lt;/a&gt; provides the insurance policy you need: automated, frequent, verifiable backups with intelligent cost management. Deploy it before your first AI agent touches production data. The 10 minutes of setup time could save your company.&lt;/p&gt;

&lt;p&gt;When your AI agent inevitably panics and does something destructive, you'll have the backups to recover. And unlike Supabase's limited retention, you'll have them for years.&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>postgres</category>
      <category>postgressql</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Data De-identification for LLMs: Protecting Privacy While Preserving Meaning</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Tue, 27 May 2025 23:25:29 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/data-de-identification-for-llms-protecting-privacy-while-preserving-meaning-o52</link>
      <guid>https://forem.com/nicobistolfi/data-de-identification-for-llms-protecting-privacy-while-preserving-meaning-o52</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: &lt;a href="https://github.com/aliengiraffe/deidentify" rel="noopener noreferrer"&gt;deidentify&lt;/a&gt; is a zero-dependency Go library that removes PII from your data while preserving format and meaning. Same input = same output, making it perfect for LLM preprocessing. Star it on GitHub if you find it useful!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hidden Risk in Your AI Pipeline
&lt;/h2&gt;

&lt;p&gt;Every time you send customer data to an LLM, you're making a trust decision. Whether it's GPT-4, Claude, or your company's internal model, that data leaves your control. And if it contains names, emails, SSNs, or credit card numbers, you're one data breach away from a nightmare.&lt;/p&gt;

&lt;p&gt;Imagine the following scenario: you're looking to use LLMs to analyze customer support tickets. Great idea, until legal asks: "What happens to the customer data we're sending to OpenAI?"&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Traditional Redaction Falls Short
&lt;/h2&gt;

&lt;p&gt;The obvious solution is to redact everything. Replace all names with &lt;code&gt;[REDACTED]&lt;/code&gt;, all emails with &lt;code&gt;[EMAIL]&lt;/code&gt;, and so on. But here's the problem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original: "John Smith emailed john.smith@company.com about his order"
Redacted: "[NAME] emailed [EMAIL] about his order"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LLM loses critical context. Was it the same person? Different people? The relationships between entities disappear, making analysis nearly useless.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preserving Meaning While Protecting Privacy
&lt;/h2&gt;

&lt;p&gt;What you need is consistent, deterministic replacement. Same input should always produce the same output, so relationships stay intact:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original: "John Smith emailed john.smith@company.com, then Jane Doe replied"
Better: "Robert Johnson emailed robert.j@demo.com, then Sarah Miller replied"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the LLM understands that the email belongs to the first person, not the second. The data remains useful for analysis while protecting actual identities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter deidentify: A Go Solution
&lt;/h2&gt;

&lt;p&gt;After facing this problem repeatedly, we built &lt;a href="https://github.com/aliengiraffe/deidentify" rel="noopener noreferrer"&gt;deidentify&lt;/a&gt; - a Go library that handles this automatically. What makes it special:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Zero dependencies&lt;/strong&gt; - Just Go's standard library. No supply chain risks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic&lt;/strong&gt; - Same secret key + same input = same output, always.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format preserving&lt;/strong&gt; - Phone numbers look like phone numbers, emails like emails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context aware&lt;/strong&gt; - Uses column names to prevent correlation across fields.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's what it looks like in practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;deidentify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GenerateSecretKey&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;deidentify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewDeidentifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"Contact Alice at alice@startup.com or 555-123-4567"&lt;/span&gt;
&lt;span class="n"&gt;safe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c"&gt;// Output: "Contact Taylor at member4921@demo.co or 555-642-8317"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real-World Example: Customer Support Analysis
&lt;/h2&gt;

&lt;p&gt;At my current company, we process thousands of support tickets through LLMs for sentiment analysis and categorization. Before deidentify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ticket: "Hi, I'm Bob Wilson (bob@example.com). My SSN 123-45-6789
was exposed when your system crashed. Please call me at 555-0123."

Risk: Bob's entire identity is sent to an external API.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After deidentify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ticket: "Hi, I'm Michael Davis (user7823@demo.org). My SSN 847-92-3651
was exposed when your system crashed. Please call me at 555-7492."

Result: LLM can still analyze the severity (SSN exposure) without seeing real data.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why Go Matters Here
&lt;/h2&gt;

&lt;p&gt;You might wonder why we built this in Go. Three reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt; - De-identifying gigabytes of data needs to be fast&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment&lt;/strong&gt; - Single binary, no runtime dependencies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safety&lt;/strong&gt; - Strong typing catches PII-type mismatches at compile time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The fact that it uses only Go's standard library means you can audit the entire codebase without chasing dependencies. Critical for security-conscious teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation Tips
&lt;/h2&gt;

&lt;p&gt;When integrating de-identification into your LLM pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;De-identify early&lt;/strong&gt; - Before data hits your message queue or API&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep your key safe&lt;/strong&gt; - The secret key is what makes replacements consistent&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test with production-like data&lt;/strong&gt; - PII patterns vary by industry&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// Step 1: Load customer data&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;loadCustomerData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c"&gt;// Step 2: De-identify&lt;/span&gt;
&lt;span class="n"&gt;safe&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// Step 3: Send to LLM&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Analyze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;safe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// Step 4: Process results (no re-identification needed)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Take Advantage
&lt;/h2&gt;

&lt;p&gt;We made &lt;a href="https://github.com/aliengiraffe/deidentify" rel="noopener noreferrer"&gt;deidentify&lt;/a&gt; open source because privacy tools should be transparent. You can inspect every line of code, understand exactly how it works, and even contribute improvements.&lt;/p&gt;

&lt;p&gt;The library handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Names, emails, phone numbers&lt;/li&gt;
&lt;li&gt;SSNs, credit cards, addresses&lt;/li&gt;
&lt;li&gt;Structured data (CSV, database exports)&lt;/li&gt;
&lt;li&gt;International formats (100+ address patterns)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're sending any data to LLMs, check out &lt;a href="https://github.com/aliengiraffe/deidentify" rel="noopener noreferrer"&gt;deidentify on GitHub&lt;/a&gt;. And if it saves you from a data breach, consider giving it a star 🌟 - it helps others find the tool.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>go</category>
      <category>showdev</category>
    </item>
    <item>
      <title>9 Coding Principles to Write Great Python Code 🐍🚀</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Thu, 24 Oct 2024 20:44:30 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/9-coding-principles-to-write-great-python-code-2na2</link>
      <guid>https://forem.com/nicobistolfi/9-coding-principles-to-write-great-python-code-2na2</guid>
      <description>&lt;p&gt;Welcome to the Python coding dojo! 🧑‍💻 This guide will help you avoid common pitfalls while writing clean, readable, and efficient code. Let's dive into 9 key principles that will level up your Python game, followed by a bonus tip to supercharge your code reviews! ⚡&lt;/p&gt;




&lt;h3&gt;
  
  
  1. &lt;strong&gt;Use Meaningful Variable Names&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Bad code often has cryptic variable names like &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, or &lt;code&gt;tmp&lt;/code&gt;. Always aim for meaningful, descriptive names that make the code easier to understand.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="n"&gt;area&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: Descriptive names make your code self-documenting. You’ll thank yourself (and your team will thank you too!) when you revisit this code weeks or months later. 🚀&lt;/p&gt;




&lt;h3&gt;
  
  
  2. &lt;strong&gt;Follow PEP 8 Style Guide&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;PEP 8 is the official style guide for Python. Stick to it to ensure that your code looks like everyone else's and is easy to read.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;my_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;param1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;param2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;param1&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;param2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;my_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;param1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;param2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;param1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;param2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: Consistency is key. PEP 8 ensures your code is neat and easy to follow for everyone, not just you. Use tools like &lt;code&gt;flake8&lt;/code&gt; to check for PEP 8 compliance.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://pep8.org/" rel="noopener noreferrer"&gt;PEP 8 Guide&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  3. &lt;strong&gt;Avoid Magic Numbers and Strings&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Magic numbers (unnamed constants) or magic strings can make your code hard to understand and maintain. Always define them as variables with meaningful names.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;payment_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Credit Card&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;CREDIT_CARD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;payment_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;CREDIT_CARD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Credit Card&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: Using named constants makes your code more readable and flexible. It's much easier to change &lt;code&gt;CREDIT_CARD = 1&lt;/code&gt; in one place than to hunt down all instances of &lt;code&gt;1&lt;/code&gt; in your code.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. &lt;strong&gt;Use List Comprehensions (But Don’t Overdo It)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;List comprehensions are a concise way to create lists but should be used only when they improve readability.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: List comprehensions are more compact and often faster. Just be careful not to make them too complex — they should still be easy to understand.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. &lt;strong&gt;Don’t Repeat Yourself (DRY)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Avoid repeating the same logic in multiple places. If you need to do the same thing in multiple places, put it in a function.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; logged in&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; logged out&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;log_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;log_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;logged in&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;log_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;logged out&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: DRY keeps your code maintainable and less error-prone. Whenever you spot duplication, consider refactoring to avoid it.&lt;/p&gt;




&lt;h3&gt;
  
  
  6. &lt;strong&gt;Handle Exceptions Properly&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Don’t just catch exceptions and pass silently, handle them in meaningful ways.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ZeroDivisionError&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: If you just "pass" on exceptions, you might miss critical errors. Handle them appropriately or at least log them so you know what’s going wrong.&lt;/p&gt;




&lt;h3&gt;
  
  
  7. &lt;strong&gt;Use Docstrings for Documentation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Your code should be self-explanatory, but when that's not enough, use docstrings to explain your functions.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate_area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate_area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Calculate the area of a circle given the radius.

    :param radius: The radius of the circle.
    :return: The area of the circle.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: Docstrings provide useful information about your functions, classes, and modules, especially when you're working in a team or handing off your code.&lt;/p&gt;




&lt;h3&gt;
  
  
  8. &lt;strong&gt;Use Built-In Functions Where Possible&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Python comes with a lot of built-in functions. Make sure to use them instead of reinventing the wheel.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: Python’s built-in functions are optimized for performance and readability. Don’t waste time writing code that Python already provides.&lt;/p&gt;




&lt;h3&gt;
  
  
  9. &lt;strong&gt;Keep Your Code Modular&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Break your code into small, reusable functions instead of writing long, complex blocks of code.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Bad Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Do everything in one big function
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ✅ Good Code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;clean_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;analyze_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;clean_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;analyze_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📜 &lt;strong&gt;Why&lt;/strong&gt;: Modular code is easier to test, debug, and maintain. It also makes it easier to reuse code across different projects.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Bonus Tip: Write &amp;amp; Review Code Like a Pro!&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Once you have written your code, reviewing it is equally important. Not sure how to do that effectively? Here's a bonus tip — check out this comprehensive &lt;a href="https://nico.bistol.fi/blog/code-reviews-101" rel="noopener noreferrer"&gt;guide on how to do effective code reviews&lt;/a&gt; that I wrote. It will guide you through what to look for when reviewing code, ensuring you're delivering your best work every time.&lt;/p&gt;




&lt;p&gt;💡 &lt;strong&gt;Final Thought:&lt;/strong&gt; Writing good code isn’t about being perfect but continuously improving. As Linus Torvalds said:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Talk is cheap, show me the code."&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>programming</category>
      <category>learning</category>
    </item>
    <item>
      <title>Beginners Guide: Setting Up Your Local Environment for Machine Learning with Miniconda and Python</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Tue, 22 Oct 2024 15:56:09 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/beginners-guide-setting-up-your-local-environment-for-machine-learning-with-miniconda-and-python-5f7b</link>
      <guid>https://forem.com/nicobistolfi/beginners-guide-setting-up-your-local-environment-for-machine-learning-with-miniconda-and-python-5f7b</guid>
      <description>&lt;p&gt;Welcome to the world of &lt;strong&gt;machine learning&lt;/strong&gt;! Whether you’re just starting or have dabbled a bit, having a well-organized local environment can make your life much easier. In this guide, we’ll set up your local environment using &lt;strong&gt;Miniconda&lt;/strong&gt; and &lt;strong&gt;Conda&lt;/strong&gt;. We’ll also install some of the most essential Python libraries for machine learning and data science: &lt;strong&gt;Pandas&lt;/strong&gt;, &lt;strong&gt;NumPy&lt;/strong&gt;, &lt;strong&gt;Matplotlib&lt;/strong&gt;, and &lt;strong&gt;Scikit-learn&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Warning: This setup is 100% stress-free (except maybe for the part where we install libraries 😉).&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Miniconda?
&lt;/h2&gt;

&lt;p&gt;You might be wondering: "Why Miniconda and not Anaconda?" Well, it’s like choosing between a fully loaded spaceship 🛸 (Anaconda) and a lightweight, more customizable spacecraft 🚀 (Miniconda). Miniconda gives you just the essentials, allowing you to install only the packages you need and keep things tidy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Install Miniconda
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1.1. Download Miniconda
&lt;/h4&gt;

&lt;p&gt;Head over to the &lt;a href="https://docs.conda.io/en/latest/miniconda.html" rel="noopener noreferrer"&gt;Miniconda website&lt;/a&gt; and download the appropriate installer for your operating system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: &lt;code&gt;.exe&lt;/code&gt; installer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS&lt;/strong&gt;: &lt;code&gt;.pkg&lt;/code&gt; installer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux&lt;/strong&gt;: &lt;code&gt;.sh&lt;/code&gt; installer&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  1.2. Install Miniconda
&lt;/h4&gt;

&lt;p&gt;Once downloaded, follow the instructions for your system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: Run the &lt;code&gt;.exe&lt;/code&gt; installer. When it asks, check the box to “Add Miniconda to my PATH environment variable” (it’ll make life easier later, trust me 😅).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS/Linux&lt;/strong&gt;: Open a terminal and run the installer:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  bash Miniconda3-latest-Linux-x86_64.sh  &lt;span class="c"&gt;# for Linux&lt;/span&gt;
  bash Miniconda3-latest-MacOSX-x86_64.sh  &lt;span class="c"&gt;# for macOS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Follow the prompts. It’s smoother than butter on a hot pancake! 🥞&lt;/p&gt;
&lt;h4&gt;
  
  
  1.3. Verify Installation
&lt;/h4&gt;

&lt;p&gt;Once installed, let’s make sure everything is in working order. Open your terminal or command prompt and type:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If you see a version number, congrats—you’ve got Miniconda ready to go! 🎉&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 2: Set Up a Conda Environment
&lt;/h3&gt;

&lt;p&gt;Here comes the fun part! With Conda, you can create &lt;strong&gt;isolated environments&lt;/strong&gt; to keep your projects organized and prevent package conflicts. Think of it like having different closets for different hobbies—no mixing fishing gear 🎣 with your gaming setup 🎮.&lt;/p&gt;
&lt;h4&gt;
  
  
  2.1. Create a New Environment
&lt;/h4&gt;

&lt;p&gt;To create a new environment (think of it as your project’s personal workspace), use the following command:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda create &lt;span class="nt"&gt;--name&lt;/span&gt; ml-env &lt;span class="nv"&gt;python&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here, &lt;code&gt;ml-env&lt;/code&gt; is the name of your environment, and we’re setting Python to version 3.10. Feel free to use whichever version you prefer.&lt;/p&gt;
&lt;h4&gt;
  
  
  2.2. Activate the Environment
&lt;/h4&gt;

&lt;p&gt;Before we install any packages, we need to &lt;strong&gt;activate&lt;/strong&gt; the environment:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda activate ml-env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You’ll notice your prompt changes, showing you’re now inside the &lt;code&gt;ml-env&lt;/code&gt; environment. 🧙‍♂️ It’s like stepping into a new dimension... of Python, that is.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3: Install Essential Python Libraries
&lt;/h3&gt;

&lt;p&gt;Time to arm your environment with the necessary tools! We’ll install &lt;strong&gt;Pandas&lt;/strong&gt;, &lt;strong&gt;NumPy&lt;/strong&gt;, &lt;strong&gt;Matplotlib&lt;/strong&gt;, and &lt;strong&gt;Scikit-learn&lt;/strong&gt;—the heroes of any machine learning adventure. Think of them as your Avengers 🦸‍♂️, but for data science.&lt;/p&gt;
&lt;h4&gt;
  
  
  3.1. Install Pandas 🐼
&lt;/h4&gt;

&lt;p&gt;Pandas is great for working with structured data. You can think of it as Excel, but on steroids 💪. Install it with:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda &lt;span class="nb"&gt;install &lt;/span&gt;pandas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  3.2. Install NumPy 🔢
&lt;/h4&gt;

&lt;p&gt;NumPy is your go-to library for numerical operations and matrix manipulation. It’s the secret sauce behind a lot of machine learning algorithms. To install:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda &lt;span class="nb"&gt;install &lt;/span&gt;numpy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  3.3. Install Matplotlib 📊
&lt;/h4&gt;

&lt;p&gt;What’s data science without some beautiful charts? Matplotlib is perfect for creating visualizations, from line graphs to scatter plots. Install it with:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda &lt;span class="nb"&gt;install &lt;/span&gt;matplotlib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;(Quick joke: Why don’t graphs get into relationships? Because they have too many “plots” 🤣).&lt;/p&gt;
&lt;h4&gt;
  
  
  3.4. Install Scikit-learn 🤖
&lt;/h4&gt;

&lt;p&gt;Finally, we need &lt;strong&gt;Scikit-learn&lt;/strong&gt; for implementing machine learning algorithms like linear regression, classification, and more. To install:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda &lt;span class="nb"&gt;install &lt;/span&gt;scikit-learn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Step 4: Verify Your Setup
&lt;/h3&gt;

&lt;p&gt;Let’s make sure everything is working smoothly. Open Python in your terminal:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Once inside the Python shell, try importing the libraries to see if everything is installed correctly:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sklearn&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If there are no errors, you’re good to go! 🎉 Go ahead and exit Python by typing:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Step 5: Managing Your Environment
&lt;/h3&gt;

&lt;p&gt;Now that your environment is all set up, here are a few handy tips for managing it.&lt;/p&gt;
&lt;h4&gt;
  
  
  5.1. List Installed Packages
&lt;/h4&gt;

&lt;p&gt;Want to see what’s installed in your environment? Simply type:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  5.2. Save Your Environment
&lt;/h4&gt;

&lt;p&gt;To share your environment setup with others or recreate it later, you can export it to a file:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda &lt;span class="nb"&gt;env export&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; environment.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  5.3. Deactivate the Environment
&lt;/h4&gt;

&lt;p&gt;When you’re done working for the day, you can exit the environment with:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda deactivate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  5.4. Delete an Environment
&lt;/h4&gt;

&lt;p&gt;If you no longer need an environment (goodbye, old projects 👋), you can remove it entirely:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;conda remove &lt;span class="nt"&gt;--name&lt;/span&gt; ml-env &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  If you liked this, follow me on &lt;a href="https://github.com/nicobistolfi" rel="noopener noreferrer"&gt;Github&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;-&lt;/p&gt;
&lt;h2&gt;
  
  
  Liked the content? Follow me for more content like this
&lt;/h2&gt;


&lt;div class="ltag__user ltag__user__id__381573"&gt;
    &lt;a href="/nicobistolfi" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F381573%2F643e60d6-befc-447f-9ecf-2e5fe1922169.jpeg" alt="nicobistolfi image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/nicobistolfi"&gt;Nico Bistolfi&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/nicobistolfi"&gt;Persistence leads to breakthroughs.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Congrats! You’ve successfully set up your local machine learning environment with Miniconda, Conda, and essential Python libraries like Pandas, NumPy, Matplotlib, and Scikit-learn. 🎉 Your new environment is isolated, organized, and ready for some serious data crunching.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Remember&lt;/em&gt;: Always keep your environments tidy, or risk ending up like my old closet—full of tangled cables and random Python versions. 😅 Happy coding!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>firstyearincode</category>
    </item>
    <item>
      <title>Code Reviews for Beginners: How to Send and Review Code Like a Pro</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Tue, 15 Oct 2024 19:27:49 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/code-reviews-for-beginners-how-to-send-and-review-code-like-a-pro-2mnh</link>
      <guid>https://forem.com/nicobistolfi/code-reviews-for-beginners-how-to-send-and-review-code-like-a-pro-2mnh</guid>
      <description>&lt;p&gt;Code reviews are an essential part of the software development process. Whether you're sending your first code review or reviewing someone else's work, knowing how to navigate these waters is key to becoming a stronger developer. Let’s break down both sides of the code review process, from submitting your code for review to providing valuable feedback as the reviewer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending a Code Review: How to Do It Right
&lt;/h2&gt;

&lt;p&gt;When you submit your code for review, it’s not just about getting a "thumbs up" from your team. It’s about showcasing your work in a way that’s easy to understand, clean, and ready to integrate. Here’s how to approach sending a code review:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Ensure Your Code Is Clean&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before you even think about submitting your code, make sure it’s polished. Run tests, lint your code, and ensure there are no obvious errors or oversights. A clean submission sets the tone for a productive review. "It runs on my laptop" is just not good enough :)&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Explain Your Changes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When submitting your code for review, context is critical. Provide a concise yet detailed description of what the code does, why certain decisions were made, and any potential areas that may require extra attention. The more information you give upfront, the easier it is for the reviewer to understand your thought process.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Break It Into Small, Manageable Chunks&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Submitting massive pull requests can be overwhelming for reviewers. Keep your changes small and focused. Large, multi-purpose pull requests are harder to review and can easily introduce bugs that are hard to spot. Think that a code review shouldn't include more than 100 lines of changes, and within that take into account the cognitive load of the code you're submitting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Being a Code Reviewer: How to Give Constructive Feedback with a Growth Mindset
&lt;/h2&gt;

&lt;p&gt;Growth Mindset = trust your teammates, think what you can lear from what they did and how you're review may allow your teammates to learn too. A thoughtful review not only improves the code but also helps foster a collaborative and learning-focused environment.&lt;/p&gt;

&lt;p&gt;Reviewing someone else’s code is just as important as writing your own, very likely you're responsible for maintaining that code (and people deserve PTO wink wink).&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Be Respectful and Constructive&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Remember, you’re reviewing someone’s work, not criticizing them as a person. Be positive, specific, and suggest improvements in a way that encourages growth. Instead of saying, “This is wrong,” try “This approach might be problematic in cases where X happens. Have you considered Y?” - if possible, talk to the person directly and initiate the dialogue.&lt;/p&gt;

&lt;p&gt;As you build trust with your teammates, you'll learn to calibrate your message to the person receving the feedback and ensuring they receive it in the best possible way.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Focus on the Big Picture First&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When reviewing code, it’s easy to get lost in the nitty-gritty details (like variable names or indentation). But first, focus on the big picture: Does the code solve the problem? Is it efficient? Is it maintainable? Once the major aspects are addressed, you can move on to smaller stylistic issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Ask Questions Instead of Making Assumptions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Sometimes, you won’t fully understand the reason behind certain coding decisions. Instead of assuming it’s wrong, ask questions. “Can you explain why you chose this approach?” is far better than saying, “This doesn’t make sense.” This opens up a conversation where the author can explain their thinking, and you might even learn something new.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Be Specific with Your Feedback&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Generic feedback like “Looks good” or “Needs work” isn’t helpful. Be as specific as possible so the developer knows exactly what you’re referring to and why. Provide code snippets or links to documentation when possible to support your points.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts: Code Reviews Are a Learning Opportunity
&lt;/h2&gt;

&lt;p&gt;Whether you’re sending or reviewing code, remember that the code review process is a learning opportunity for everyone involved. As the code author, you get to learn from feedback and improve your work. As the reviewer, you get to understand someone else’s code and share your expertise.&lt;/p&gt;

&lt;p&gt;By approaching code reviews with respect, clarity, and collaboration, you’ll not only improve the quality of the code but also contribute to a stronger, more effective development team. Happy reviewing!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>productivity</category>
      <category>programming</category>
      <category>career</category>
    </item>
    <item>
      <title>AI Code Generation is the New WordPress</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Fri, 11 Oct 2024 17:26:59 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/ai-code-generation-is-the-new-wordpress-33bk</link>
      <guid>https://forem.com/nicobistolfi/ai-code-generation-is-the-new-wordpress-33bk</guid>
      <description>&lt;p&gt;We’ve seen code generators becoming more integrated into the tools we use every day. Some call them "the future of coding," others are more skeptical and stick to using Vim, I'm in the middle and I believe there's a strong similarity between AI generated code and  WordPress.&lt;/p&gt;

&lt;p&gt;WordPress powers about 43% of all websites on the internet, including some of those shiny Fortune 500 companies' sites. It’s an absolute workhorse for blogs, small businesses, and even some more complex sites. But we all know it's not ideal for everything, especially when you're aiming for &lt;em&gt;real&lt;/em&gt; scale or complexity.&lt;/p&gt;

&lt;h3&gt;
  
  
  WordPress: Great Tool, Wrong Job
&lt;/h3&gt;

&lt;p&gt;Doing a quick rundown of things WordPress isn’t exactly designed for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Large-scale platforms&lt;/strong&gt; (Think millions of users simultaneously hammering your server)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex web applications&lt;/strong&gt; (Like heavy SaaS with intricate workflows)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-time collaborative tools&lt;/strong&gt; (Imagine building Google Docs with WordPress... yikes)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Financial platforms&lt;/strong&gt; (I’m talking about high-security requirements, not a simple eCommerce site)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mobile-first apps&lt;/strong&gt; (Yes, you can build apps with WordPress, but should you? Let’s be honest)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data-heavy analytics platforms&lt;/strong&gt; (Good luck crunching massive datasets on WordPress)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The list can go on, WordPress is amazing for what it is – just not for everything. It’s great for certain applications but definitely not the go-to when you’re looking at high security, real-time functionality, or complex operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  AI Code Generation: Familiar Territory
&lt;/h3&gt;

&lt;p&gt;In the same vein, AI code generation or IDE assistants (take your pick: Copilot, Tabnine, Cursor, or any fork of VS) are fantastic tools that can really streamline your workflow, but &lt;em&gt;they’re no silver bullet&lt;/em&gt;. Just like WordPress, they’re wonderful when used for the right task, but don’t expect them to build your next complex, highly-secure, real-time platform without some serious oversight.&lt;/p&gt;

&lt;p&gt;The code they generate isn't always the best. We’ve all seen those StackOverflow snippets pasted verbatim that work (sometimes) but make you wince in horror when you peek under the hood. The logic these tools implement can often be faulty and it make take you more time to code-review the generated code than to just write it yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where AI Shines: Scripting and Simplicity
&lt;/h3&gt;

&lt;p&gt;AI truly shines in automating repetitive scripting tasks or creating "black-box" logic. The kind where you feed in some input, expect an output, and don’t really care about what happens in the middle? As long as you can define the task clearly, AI can often hit the nail on the head.&lt;/p&gt;

&lt;p&gt;If you’re looking to automate a tedious process, spin up a basic REST API, or even mock up an MVP (with very simple functionality), AI code generation might just save you hours of work as I've shown in my article &lt;a href="https://nico.bistol.fi/blog/generative-ai-dynamic-mock-api" rel="noopener noreferrer"&gt;Generative AI: Dynamic Mock APIs using Langchain and Anthropic.&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've also used it to generate tests, I've found that it does a pretty good job at a task that is usually quite boring - UNLESS you're doing TDD, which in that case I would not recommend it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro tip:&lt;/strong&gt; the more you can reduce your use cases and make your MVP as basic as possible, the higher the chances you can get away with using AI-generated code. Less is more here. &lt;/p&gt;

&lt;h3&gt;
  
  
  The Silver Lining
&lt;/h3&gt;

&lt;p&gt;Just like WordPress, AI-assisted code generation is a tool in your toolkit. It's powerful, but only when used correctly. Think of it like trying to use a hammer to do the job of a screwdriver – sure, it might &lt;em&gt;work&lt;/em&gt; in some scenarios, but you're probably going to break something if you push it too far. 🛠️&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/GWCRNsoh0s4?start=3"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;At the end of the day, tools like AI code generators can take a lot of the grunt work out of your hands and speed up development for &lt;em&gt;specific&lt;/em&gt; tasks. But when you start needing more robust, nuanced, and scalable solutions, that's when the human touch (aka: &lt;strong&gt;you&lt;/strong&gt;) is irreplaceable. AI won’t be putting us out of a job just yet.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>ai</category>
      <category>chatgpt</category>
      <category>llm</category>
    </item>
    <item>
      <title>Best Python Libraries for ETL Pipelines: A Beginners Developer's Guide</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Thu, 10 Oct 2024 00:42:32 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/best-python-libraries-for-etl-pipelines-a-beginners-developers-guide-1ia1</link>
      <guid>https://forem.com/nicobistolfi/best-python-libraries-for-etl-pipelines-a-beginners-developers-guide-1ia1</guid>
      <description>&lt;p&gt;Building ETL pipelines can feel a lot like being the &lt;em&gt;chosen one&lt;/em&gt; – you’re moving data from point A to point B, transforming it into something useful, and making sure everything works seamlessly. Python’s got your back with an army of libraries that make your job easier – kind of like having the Force on your side 🛠️. In this guide, we’ll look at some of the best Python libraries to help you win the ETL war. 🏆&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;strong&gt;Extract: Pulling Data from the Source&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When it comes to data extraction, you need the right tools to pull data from different sources – databases, APIs, files. This is where the fun begins (cue Obi-Wan voice). Here are the go-to libraries for getting the data you need.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;SQLAlchemy&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When extracting data from databases, SQLAlchemy is your trusty lightsaber. It's powerful and handles multiple database types without breaking a sweat.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Supports a wide range of databases (PostgreSQL, MySQL, SQLite, etc.)&lt;/li&gt;
&lt;li&gt;You can easily switch between databases&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sqlalchemy&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_engine&lt;/span&gt;

  &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;postgresql://user:password@localhost/dbname&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;connection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM jedi_order&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Pandas&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Pandas is your Swiss army knife 🗡️ when it comes to dealing with data in CSV, Excel, JSON, or even SQL. It’s fast and simple to use, perfect for extracting data from files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Can load data from various file formats with a single line of code&lt;/li&gt;
&lt;li&gt;Great performance for in-memory data&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

  &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;rebels_data.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Requests&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For dealing with REST APIs, &lt;code&gt;requests&lt;/code&gt; is like R2-D2 – it’s reliable, simple, and will get you the data you need, no matter what.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Makes HTTP requests super easy&lt;/li&gt;
&lt;li&gt;Handles API authentication, headers, etc.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

  &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;https://api.example.com/data&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. &lt;strong&gt;Transform: Shaping the Data&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that you’ve &lt;em&gt;extracted&lt;/em&gt; the data, it’s time to &lt;em&gt;transform&lt;/em&gt; it into something usable. This stage is like taking raw mithril and forging it into armor 🛡️. Let’s dive into some awesome libraries for transformation.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Pandas&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Once again, Pandas comes in handy for transforming your data. Whether it’s cleaning, filtering, or aggregating, it’s got you covered like a cloak of invisibility.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Tons of built-in functions for data manipulation&lt;/li&gt;
&lt;li&gt;Ideal for in-memory transformations&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="c1"&gt;# Clean data by removing NaN values and filtering rows
&lt;/span&gt;  &lt;span class="n"&gt;data_cleaned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropna&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;age &amp;gt; 18&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Dask&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Got massive datasets that would make even the Death Star look small? Dask lets you handle larger-than-memory data using parallel processing, all without rewriting your Pandas code. 🌌&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Scales to handle large datasets&lt;/li&gt;
&lt;li&gt;Distributed computing, but with familiar Pandas-like syntax&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dask.dataframe&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;dd&lt;/span&gt;

  &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;huge_data.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;compute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;PySpark&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For Jedi-level transformations on big data, look no further than PySpark. It's the Luke Skywalker of distributed data processing. 🧙‍♂️&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Lightning-fast data transformations on large datasets&lt;/li&gt;
&lt;li&gt;Great for working in big data ecosystems (Hadoop, Spark)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pyspark.sql&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SparkSession&lt;/span&gt;

  &lt;span class="n"&gt;spark&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SparkSession&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ETL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;getOrCreate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;spark&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;galaxy_data.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inferSchema&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;df_filtered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. &lt;strong&gt;Load: Putting Data Where It Belongs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Finally, you’ve transformed your data into something usable. Now it’s time to load it to its final destination. Whether it’s a data warehouse, S3 bucket, or database, think of this as delivering the One Ring to Mordor 🏔️ – with the right tools, the journey becomes a whole lot easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;SQLAlchemy&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;SQLAlchemy makes loading data back into your database simple. With it, you can easily insert your data into a relational database.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Works with multiple databases&lt;/li&gt;
&lt;li&gt;Supports bulk inserts&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;jedi_council&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;if_exists&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;replace&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Psycopg2&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For PostgreSQL databases, &lt;code&gt;psycopg2&lt;/code&gt; is your best companion. It’s fast, efficient, and makes complex SQL tasks a breeze.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Native support for PostgreSQL&lt;/li&gt;
&lt;li&gt;Supports transactions&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;psycopg2&lt;/span&gt;

  &lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;psycopg2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dbname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;star_wars&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;force123&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;cur&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSERT INTO jedis (name, age) VALUES (%s, %s)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Luke&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Boto3&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you’re working with AWS services like S3, Boto3 is the go-to tool for uploading data to the cloud. You’ll feel like Gandalf wielding it. ☁️&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Fully integrated with AWS services&lt;/li&gt;
&lt;li&gt;Easy to upload/download from S3&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

  &lt;span class="n"&gt;s3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upload_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;local_file.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;mybucket&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;file.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Google Cloud Storage (GCS) Client&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For developers working with Google Cloud, the GCS Client will help you load data to Google Cloud Storage with ease, just like Boto3 does with AWS.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Full support for Google Cloud&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.cloud&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;

  &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_bucket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;my_bucket&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;blob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;data.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upload_from_filename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;local_file.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. &lt;strong&gt;Orchestration: Managing Your ETL Pipeline&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now, no ETL pipeline would be complete without a bit of orchestration. Think of this as the force guiding all the moving parts ⚙️ – scheduling tasks, monitoring, and retrying if something goes wrong.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Apache Airflow&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you're working on anything complex, Apache Airflow is your Yoda for task orchestration. With it, you can create, schedule, and monitor workflows, ensuring all your ETL jobs run like clockwork.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pros&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Powerful scheduling and task management&lt;/li&gt;
&lt;li&gt;Visual interface for tracking workflows&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Example&lt;/strong&gt;:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;airflow&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DAG&lt;/span&gt;
  &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;airflow.operators.python_operator&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PythonOperator&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;extract_data&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
      &lt;span class="c1"&gt;# Extraction logic
&lt;/span&gt;      &lt;span class="k"&gt;pass&lt;/span&gt;

  &lt;span class="n"&gt;dag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DAG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;my_etl_pipeline&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2023&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PythonOperator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;extract_task&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;python_callable&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;extract_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dag&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;dag&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Building ETL pipelines doesn’t have to feel like you're battling Darth Vader ⚔️. With the right tools, you can automate the entire process, transform data efficiently, and load it to its final destination. Whether you’re handling small data sets or working on massive, distributed systems, these Python libraries will help you build ETL pipelines that are as powerful as the One Ring (but way less evil).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;May the ETL Force be with you.&lt;/em&gt; ✨&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>datascience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Go vs Python for File Processing: A Performance and Architecture Perspective</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Wed, 09 Oct 2024 22:21:53 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/go-vs-python-for-file-processing-a-performance-and-architecture-perspective-2pa4</link>
      <guid>https://forem.com/nicobistolfi/go-vs-python-for-file-processing-a-performance-and-architecture-perspective-2pa4</guid>
      <description>&lt;p&gt;&lt;strong&gt;"If all you have is a hammer, everything looks like a nail."&lt;/strong&gt; This is known as the Law of the Instrument or Maslow's hammer, and it's a cognitive bias that pushes us to often rely on the tools we are most familiar with, even when they may not be the best fit for the task at hand.&lt;/p&gt;

&lt;p&gt;When it comes to file processing, using Python a no-brainer, due to its simplicity, large ecosystem and libraries. However, Go is an equally powerful tool—one that can often outperform Python, especially in scenarios requiring high performance and concurrency.&lt;/p&gt;

&lt;p&gt;I'll explore the strengths and weaknesses of Go and Python when handling file processing tasks. By benchmarking these two languages in real-world scenarios, I'll highlight their differences and help you choose the right tool for the job. I'll also look at how both languages can interact in cloud-native environments like serverless architectures (AWS Lambda) and containerized applications (Docker/Kubernetes).&lt;/p&gt;

&lt;h3&gt;
  
  
  Benchmarking Go vs. Python
&lt;/h3&gt;

&lt;p&gt;To understand which language might be better suited for file processing tasks I created two simple scripts, one in Python and another in Go to run these benchmarks. I focused on transforming CSV files into JSON payloads while using concurrency in Go and multithreading in Python. Here's what I found:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Go:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Processing Time:&lt;/strong&gt; Go was significantly faster, especially when handling large files. This is due to its efficient use of system resources through its built-in concurrency model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrency:&lt;/strong&gt; Go's goroutines and channels make it easy to process multiple rows in parallel, drastically reducing processing time for large datasets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Consumption:&lt;/strong&gt; Go had better memory management, leading to stable performance under high-load scenarios.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Processing Time:&lt;/strong&gt; Python is slower compared to Go in processing large files, even with multithreading enabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multithreading:&lt;/strong&gt; Due to the Global Interpreter Lock (GIL), Python's multithreading can be less efficient, limiting parallelism, especially in CPU-bound tasks like file processing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ecosystem:&lt;/strong&gt; Python offers a wealth of libraries like &lt;code&gt;pandas&lt;/code&gt; and &lt;code&gt;csv&lt;/code&gt;, making it highly versatile for different data formats. However, this often comes at the cost of speed (I found better performance using &lt;code&gt;csv&lt;/code&gt; instead of &lt;code&gt;pandas&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Go for High-Performance, Concurrent File Processing
&lt;/h3&gt;

&lt;p&gt;Go's native concurrency model using goroutines and channels makes it an ideal choice for architectures that require high-performance, scalable file processing. With Go, you can efficiently process large datasets, such as logs, transactions, or IoT data, by leveraging multi-core CPUs without the overhead seen in other languages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best use cases for Go:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Batch processing&lt;/strong&gt; of large files (e.g., CSVs, JSON logs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data pipelines&lt;/strong&gt; in microservice architectures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-throughput systems&lt;/strong&gt; that require predictable latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Serverless Architecture with Go on AWS Lambda
&lt;/h4&gt;

&lt;p&gt;Go works well in serverless environments like AWS Lambda. AWS Lambda now supports Go natively, allowing you to deploy functions for file processing with minimal cold start time. Here's an example of a serverless setup for Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"context"&lt;/span&gt;
    &lt;span class="s"&gt;"encoding/csv"&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"os"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/aws/aws-lambda-go/lambda"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;handleRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// File processing logic here&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"File processed successfully"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;lambda&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;handleRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why Go in Serverless?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster cold starts compared to Python.&lt;/li&gt;
&lt;li&gt;Better memory management for long-running file processes.&lt;/li&gt;
&lt;li&gt;Excellent for event-driven architecture, such as processing S3-triggered file uploads.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Kubernetes with Go
&lt;/h4&gt;

&lt;p&gt;Go also excels in a Kubernetes environment due to its lightweight binary size, speed, and low memory footprint. A Go-based microservice in Kubernetes can efficiently scale horizontally by spinning up more replicas to handle increased load. Here, Go's performance shines in terms of startup time and CPU efficiency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Go in Kubernetes?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High throughput with low CPU and memory consumption.&lt;/li&gt;
&lt;li&gt;Goroutines allow for massive parallelism, making it well-suited for distributed systems like Kubernetes.&lt;/li&gt;
&lt;li&gt;Can handle multiple concurrent file processing requests with minimal latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python for Flexibility and Rich Ecosystem
&lt;/h3&gt;

&lt;p&gt;Python's strength lies in its ease of use and powerful ecosystem of libraries. Although slower than Go, Python remains a great choice for IO-bound tasks where the bottleneck is waiting for external resources rather than CPU processing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best use cases for Python:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data analytics&lt;/strong&gt; where you need to leverage libraries like &lt;code&gt;pandas&lt;/code&gt; for CSV transformation and &lt;code&gt;NumPy&lt;/code&gt; for numerical data manipulation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prototyping&lt;/strong&gt; complex data pipelines quickly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Machine learning pipelines&lt;/strong&gt;, where Python can be integrated with data processing libraries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Serverless Architecture with Python on AWS Lambda
&lt;/h4&gt;

&lt;p&gt;Python is also supported natively by AWS Lambda, and it's one of the most popular choices due to its simplicity and rapid development time. For lightweight or IO-bound file processing, Python can still be an efficient choice.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="c1"&gt;# Process CSV to JSON here
&lt;/span&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;body&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;File processed successfully&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why Python in Serverless?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to deploy and develop.&lt;/li&gt;
&lt;li&gt;Rich support for third-party libraries, including data analytics tools.&lt;/li&gt;
&lt;li&gt;Great for prototyping or environments where flexibility is key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Kubernetes with Python
&lt;/h4&gt;

&lt;p&gt;Python's flexibility makes it useful in a Kubernetes environment, but the slower processing time and memory consumption are key considerations. Python services may not be as performant as Go in a highly concurrent or large-scale system. However, if you rely heavily on Python libraries, Kubernetes allows easy scaling of Python microservices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Python in Kubernetes?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple to integrate with existing data processing libraries.&lt;/li&gt;
&lt;li&gt;Good for batch jobs or IO-heavy workloads.&lt;/li&gt;
&lt;li&gt;Can still scale horizontally, but may require more resources compared to Go.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Differences in Performance and Suitability
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;Aspect&lt;/th&gt;
            &lt;th&gt;Go&lt;/th&gt;
            &lt;th&gt;Python&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Concurrency Model&lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Goroutines (lightweight threads)&lt;/td&gt;
            &lt;td&gt;Multithreading (limited by GIL)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Memory Consumption&lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Low, efficient&lt;/td&gt;
            &lt;td&gt;Moderate to high&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Ease of Use&lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Moderate learning curve&lt;/td&gt;
            &lt;td&gt;Easy and widely known&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Library Ecosystem&lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Limited but performant&lt;/td&gt;
            &lt;td&gt;Extensive and rich for data work&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Execution Speed&lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Fast&lt;/td&gt;
            &lt;td&gt;Slower&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Cold Start Time (Lambda)&lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Low&lt;/td&gt;
            &lt;td&gt;Moderate to high&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Which Architecture Benefits the Most?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;High-Throughput, Performance-Critical Systems&lt;/strong&gt;: Go is the best option, especially for applications needing fast, concurrent file processing, like financial services or IoT pipelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flexibility in Data Transformation&lt;/strong&gt;: Python is well-suited for architectures that require flexibility and heavy use of third-party libraries for data transformation and analytics, making it ideal for data science workloads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Serverless Architectures&lt;/strong&gt;: Both Go and Python are excellent for serverless environments on AWS Lambda, but Go shines when performance is critical and Lambda cold starts or resource constraints are a concern.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kubernetes Microservices&lt;/strong&gt;: Go offers better scalability, performance, and resource efficiency in Kubernetes. Python can still perform well but may require more resources to handle the same load, particularly in CPU-bound tasks.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Both Go and Python have their strengths and weaknesses, and the right choice depends on your architecture, the nature of the file processing task, and performance needs. Go's speed and concurrency make it ideal for high-performance, CPU-bound tasks, while Python's simplicity and rich ecosystem are better suited for data-heavy, IO-bound tasks or rapid development.&lt;/p&gt;

&lt;p&gt;Whether you choose Go or Python, understanding how each language performs under different conditions will ensure that you maximize efficiency and scalability in your file processing architecture, whether in a serverless environment or a containerized microservices setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  Repository
&lt;/h3&gt;

&lt;p&gt;You can find the code for my experiment and why I landed on this conclusion here: &lt;a href="https://github.com/nicobistolfi/golang-vs-python" rel="noopener noreferrer"&gt;https://github.com/nicobistolfi/golang-vs-python&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>go</category>
      <category>performance</category>
      <category>dataengineering</category>
    </item>
    <item>
      <title>Eagle Image Optimization API</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Wed, 04 Sep 2024 17:12:17 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/eagle-image-optimization-api-3ph7</link>
      <guid>https://forem.com/nicobistolfi/eagle-image-optimization-api-3ph7</guid>
      <description>&lt;p&gt;Having previously co-founded an Web Performance and Image Optimization company my motivation on building this open-source image optimization api is to enable everyone to give a better experience to their users.&lt;/p&gt;

&lt;p&gt;An Open-source Image Optimization API levels the field, regardless of budget or technical expertise. I'm hoping this fosters innovation and experimentation, leading to a diverse landscape of solutions tailored to specific needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The benefits of optimizing images using Eagle Image Optimization API
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accessibility for All&lt;/strong&gt;: Large, unoptimized images can create significant barriers for users with slow internet connections or disabilities. Open-source image optimization shrinks file sizes, minimizing data consumption and ensuring everyone can access web content seamlessly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Democratization of Web Creation&lt;/strong&gt;: Traditionally, image optimization tools have been expensive and complex, limiting access for smaller creators and businesses. Open-source solutions break down this barrier, empowering anyone to create high-quality, fast-loading content without significant financial or technical hurdles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fostering Innovation and Collaboration&lt;/strong&gt;: Open-source APIs encourage community involvement, with developers contributing code, fixes, and adaptations. This collaborative approach fosters continuous improvement, leading to innovative solutions tailored to diverse needs and emerging technologies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Building a Sustainable Web Ecosystem&lt;/strong&gt;: By reducing server load and resource consumption, open-source image optimization contributes to a more sustainable web ecosystem. This benefits both developers by lowering server costs and the environment by minimizing energy usage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhancing User Experience&lt;/strong&gt;: Faster loading times, improved accessibility, and optimized image quality all contribute to a better user experience. Open-source image optimization ensures users spend less time waiting and more time engaging with the content they seek.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where to find Eagle Image Optimization API
&lt;/h2&gt;

&lt;p&gt;The project is hosted on Github and can be found &lt;a href="https://github.com/nicobistolfi/eagle-image-api/" rel="noopener noreferrer"&gt;here&lt;/a&gt; with a detailed README on how to deploy it to AWS using Serverless Framework.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use it
&lt;/h3&gt;

&lt;p&gt;The API is very simple to use and it leverages query parameters to modify the image. Here's a list of the basic available parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;url&lt;/strong&gt;: The url of the image to be optimized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;width&lt;/strong&gt;: The width of the image to be resized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;height&lt;/strong&gt;: The height of the image to be resized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;fit&lt;/strong&gt;: When both a width and height are provided, the possible methods by which the image should fit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;* &lt;em&gt;More advanced parameters can be found in the &lt;a href="https://github.com/nicobistolfi/eagle-image-api/blob/main/README.md" rel="noopener noreferrer"&gt;README&lt;/a&gt; file&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;A sample URL would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{API_ENDPOINT}}/api/v1/image?width=400&amp;amp;height=400&amp;amp;fit=contain&amp;amp;url={{IMAGE_URL}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example of an image optimized using the API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://d3kbkk2pyl9ybg.cloudfront.net/api/v1/image?width=200&amp;amp;height=200&amp;amp;url=https%3A%2F%2Feagle-image-test.s3.us-west-1.amazonaws.com%2Fpublic%2Feagle.jpeg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd3kbkk2pyl9ybg.cloudfront.net%2Fapi%2Fv1%2Fimage%3Fwidth%3D200%26height%3D200%26url%3Dhttps%253A%252F%252Feagle-image-test.s3.us-west-1.amazonaws.com%252Fpublic%252Feagle.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fd3kbkk2pyl9ybg.cloudfront.net%2Fapi%2Fv1%2Fimage%3Fwidth%3D200%26height%3D200%26url%3Dhttps%253A%252F%252Feagle-image-test.s3.us-west-1.amazonaws.com%252Fpublic%252Feagle.jpeg" alt="Example of an image optimized using the API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run in Postman
&lt;/h3&gt;

&lt;p&gt;To test the API you can use the following Postman collection&lt;/p&gt;

&lt;p&gt;&lt;a href="https://god.gw.postman.com/run-collection/22482580-83154c76-0cda-4385-848b-bdaa0bef7fb8?action=collection%2Ffork&amp;amp;source=rip_markdown&amp;amp;collection-url=entityId%3D22482580-83154c76-0cda-4385-848b-bdaa0bef7fb8%26entityType%3Dcollection%26workspaceId%3Dfa758360-633e-4980-857e-9500b71c1d81" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frun.pstmn.io%2Fbutton.svg" alt="Run In Postman"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploying to AWS
&lt;/h3&gt;

&lt;p&gt;To deploy the API to AWS you can use the Serverless Framework. Once you have the Serverless Framework installed and you've configured your &lt;code&gt;.env&lt;/code&gt; file with the settings you want to use for the API, you can deploy the API by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;serverless deploy --stage production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new CloudFormation stack in your AWS account and deploy the API.&lt;/p&gt;

&lt;p&gt;✨ &lt;strong&gt;ProTip&lt;/strong&gt;: If you fork the repo you can deploy to AWS using github actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Collaborate
&lt;/h2&gt;

&lt;p&gt;The Eagle Image Optimization API is a powerful tool designed to democratize access to high-quality image optimization, making it accessible to everyone, regardless of their budget or technical expertise. By leveraging the open-source community, we're creating a sustainable, collaborative environment that fosters innovation and continuous improvement.&lt;/p&gt;

&lt;p&gt;If you're passionate about optimizing web experiences or simply need a robust solution for your project, I encourage you to explore the API, contribute to the project, and share your feedback. The more we collaborate, the better we can make this tool for everyone.&lt;/p&gt;

&lt;p&gt;I’m always open to connecting with fellow developers, entrepreneurs, or anyone interested in web performance. If you have any questions, need help deploying the API, or just want to chat about the project, feel free to reach out. You can ping me anytime—I'd love to hear from you!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>serverless</category>
      <category>webperf</category>
    </item>
    <item>
      <title>Web Performance for beginners</title>
      <dc:creator>Nico Bistolfi</dc:creator>
      <pubDate>Fri, 09 Oct 2020 16:08:50 +0000</pubDate>
      <link>https://forem.com/nicobistolfi/web-performance-for-beginners-31f9</link>
      <guid>https://forem.com/nicobistolfi/web-performance-for-beginners-31f9</guid>
      <description>&lt;p&gt;We all know what waiting means, and we don’t want it. It’s awful to be waiting in line, wait for something you bought to be delivered, or click on a link and wait for a website to load, especially if it is your website. You don’t want to be that company that users slip away because the website didn’t load properly.&lt;/p&gt;

&lt;p&gt;Let’s get into the topic, what is Web Performance? In this article, we are going to talk about web performance in a way that everybody can understand, and define the next steps to improve the performance of your website.&lt;/p&gt;

&lt;p&gt;I’m &lt;a href="https://twitter.com/nicobistolfi" rel="noopener noreferrer"&gt;Nico Bistolfi&lt;/a&gt;, and I’m the CEO at Piio. A company that helps websites to accelerate their experiences for the users and deliver the content faster. I also love building things in many ways; I built my own race car with my father, built our own house with my wife, and co-founded the largest eCommerce company in my home country. We got to $25M annual revenue, which I exited in 2015. I’m also obsessed with Speed, and that’s why Piio started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not everything can be fixed, but everything can be measured
&lt;/h2&gt;

&lt;p&gt;There are many excuses and things that are completely valid and true. That’s why we are going to take a look at different tools and tests, in a way that you can check what you can do, see what the results are, and define your mid/long-term goal for your website.&lt;/p&gt;

&lt;p&gt;We hear very often the phrase: “our software is too old” — or — “we need to change service providers” — or — “our platform has limitations”. And all these “excuses” are valid and true, we know it! All these excuses involve spending money, but sometimes money it’s not the issue, knowledge is. Eg, the images from the content marketing team are too big, there are things we can do to solve or improve that.&lt;/p&gt;

&lt;p&gt;First of all, we need to measure, in order to understand what do we need to change or which problem do we need to solve. If you don’t have a website yet and you are thinking about web performance, think about how to have a great experience for your users. &lt;em&gt;It’s not just about design, and it’s not just about the user flow.&lt;/em&gt; Performance it’s really important and we have different ways of doing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The key elements to improve and test web performance
&lt;/h2&gt;

&lt;p&gt;If we talk about key elements that you can use to understand what do you need to do and what you can do to improve and test your web performance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Synthetic testing -Test on a simulated environment. We recommend having a starting point of reference. It gives you a consistent result time over time and allows you to monitor your web performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real User Monitoring — You can set it up on your website and it would constantly measure the performance on your site. How it’s loading on your user devices and in different scenarios. This is really good because it helps you to understand based on your demographics how things are changing. If you have users using the latest mobile phones, computers, and powerful devices, you don’t need to worry very much about web performance. But, if you are in the other way that you have people with more legacy devices, or with devices not that powerful, then you really need to look at web performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Browser Manual Testing — just, too technical for today. But as it says, it’s manually testing and measuring the performance on different devices.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Synthetic Testing
&lt;/h3&gt;

&lt;p&gt;We have hundreds of tools, some of the key tools that we’ve found very useful are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developers.google.com/speed/pagespeed/insights/" rel="noopener noreferrer"&gt;**Page Speed Insights&lt;/a&gt;** (or Lighthouse) designed by Google that works very similarly. With Lighthouse you can run your test on your own browser which is going to change a little bit the results, it’s a kind of manual testing. But Page Speed Insights is going to give you something else: the Core Web Vitals. These metrics are measured by Google across the different devices that your users are accessing your website. And that’s very interesting! The Core Web Vitals are focused on Loading, interactivity, and visual stability of your website (I’m going to talk about them later).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://gtmetrix.com/" rel="noopener noreferrer"&gt;**GTMetrix&lt;/a&gt;** is another tool that when you get used to the interface, it’s really easy to find what’s wrong and what’s working well for you. Another extra point for GTMetrix that I find very useful is the Waterfall feature. It allows you to visualize the different resources that are being loaded for your website in the specific test you are running.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://imagespeedtest.piio.co/?ref=piioblog" rel="noopener noreferrer"&gt;**Image Speed Test&lt;/a&gt;** is designed by us, at Piio. It’s completely free and you can set up to receive emails with a new test every month at no cost. This tool is extremely focused on images and how you can improve the image loading on your website.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Page Speed Insights
&lt;/h2&gt;

&lt;p&gt;Let’s take a random website as an example, using the Page Speed Insights tool. In the picture, we can see two pieces of content that are very important to us.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0tnkgqxot183q1e6eptq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0tnkgqxot183q1e6eptq.png" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Metrics (blue rectangle)
&lt;/h3&gt;

&lt;p&gt;The blue rectangle contains the &lt;a href="https://web.dev/vitals/" rel="noopener noreferrer"&gt;Core Web Vitals&lt;/a&gt; and we are going to focus on the Largest contentful Paint (LCP) — First Input Delay (FID) and Cumulative Layout Shift (CLS).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://blog.piio.co/image-optimization/why-contenful-paint-is-more-important-than-page-load/" rel="noopener noreferrer"&gt;First Contentful Paint&lt;/a&gt; (FCP) it’s important but if you focus on LCP you are going to fix the FCP automatically.&lt;/p&gt;

&lt;p&gt;Google is showing us how well that metric performs for all the devices or users that are accessing the G2 website. We can see on the right side, the First Input Delay and the Cumulative Layout Shift are in the threshold that is considered good. The 0.0 seconds for the Cumulative Layout Shift is considered good for 90% of the users that are accessing the G2 website.&lt;/p&gt;

&lt;p&gt;This is very useful because we can see that there’s no real need to work on the First Input Delay or in the Cumulative Layout Shift. But on the FCP or in the Largest Contentful Paint, there is a real need! We can see that for almost 20% of the users the LCP is in the poor performance threshold, and of course, that is something that we do want to work in.&lt;/p&gt;

&lt;p&gt;The hard thing about this is that really working on the LCP could be really hard and really technical. Usually what happens, or what I see with different people, is that they end up working on the complete Page Load and that ends up speeding up a little bit the LCP. But it’s not something really easy to identify. You might need someone technical to help you with that process.&lt;/p&gt;

&lt;h3&gt;
  
  
  More metrics (red rectangle)
&lt;/h3&gt;

&lt;p&gt;On the red rectangle, we’re going to have more metrics that are useful too, like the Speed Index or the Time to Interactive (when the user is going to be able to start interacting with your website). In the G2 case is 4.9 seconds. Maybe they can start reading something before that, but they are not going to click on anything or write on any input. This is something that can definitely be improved (The blue flags icons explain to you more of how you can improve those metrics or what the metric means).&lt;/p&gt;

&lt;h2&gt;
  
  
  GTMetrix
&lt;/h2&gt;

&lt;p&gt;Moving to GTMetrix, this can be difficult to read. In the beginning, you can focus on the base Page Speed Score or YSlow Score. If you try to get above 85–90% on each one of those tests, you are in a good position!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqp4g8zbz14nfz42whuid.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqp4g8zbz14nfz42whuid.png" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something to clarify about GTMetrix is that their Fully Load Time is actually the Fully Load Time, meaning that they’re going to miss you till every resource of your website gets loaded and it’s completed. We’re used to hearing that is recommended for a website to load in less than 3 seconds, and yes that’s true!&lt;/p&gt;

&lt;p&gt;If your website takes more than two seconds to load, people are more likely to abandon your website. In this case, you can’t use the 3 seconds rule, because maybe your website is already completely loaded at 3 seconds, but you have more things like a chatbot, pop-ups, or something more related to behavior, that is loading on the background, and the user doesn’t really need to at the beginning. GTMetrix is not going to count that, and just going to wait until everything is loaded and going to stop the timer there. I would say if you are below 5 seconds could be good or even if you are around 8 seconds could be a good scenario too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Total Page Size
&lt;/h3&gt;

&lt;p&gt;We do recommend for the Total Page Size to be less than 1.5 MB and regarding the requests keep it as slow as possible. Having fewer requests means the user device or the browser is going to ask for fewer resources and that means less network usage (improving the page load time automatically). If you click on one of those metrics you attach an explanation on how you can improve that and what are the things that you can do. But something more interesting about this is that you are also going to be able to identify that, from your website. That’s the waterfall effect, I will explain it in another chapter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Image Speed Test
&lt;/h2&gt;

&lt;p&gt;Last but not least, the Image Speed Test. What we do and what we are trying to tell you, is that there more things than page load. This test is extremely focused on images and how they can be optimized and improved.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8pwq4ec1s57hr6of6hk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8pwq4ec1s57hr6of6hk.png" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see that for the image that is analyzed on the comparison, we’re having like a 97% of savings if we were properly to optimize that image. That means that we could have 97% better results on that image, and this will impact on the general results of the whole website.&lt;/p&gt;

&lt;p&gt;The interesting thing is that this test is focused on educating and giving useful information to you. Below the image, you can see some advice and suggestions, for example, the size of the image. It’s 100px square and based on the simulation for desktop, the Image Speed Test identifies it should be 80 x 80 px, and this is a huge change! Other suggestions that you can find are the correct or &lt;a href="https://blog.piio.co/image-optimization/optimize-all-your-images-from-your-website/" rel="noopener noreferrer"&gt;better image format &lt;/a&gt;you should use to optimize your image. All these improvements will decrease Image weight.&lt;/p&gt;

&lt;h3&gt;
  
  
  Images: the biggest part of your website
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1xygplb0vx7q2sihrpq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1xygplb0vx7q2sihrpq.png" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next report box, you can visualize the potential savings by optimizing all your images (not specifically one as we see on the report above). Reaching this number means applying all the techniques and suggestions given. In the G2 case you can go from 1.38 MB to less than 700 KB. This would really speed up your website!&lt;/p&gt;

&lt;p&gt;Usually, images are taking the biggest part of your website, and are the heaviest resource that e-commerce, or any website in general, has. &lt;a href="https://imagespeedtest.piio.co/?ref=blogpiio" rel="noopener noreferrer"&gt;Try this tool&lt;/a&gt;, run a test of your website, and see how much you can save by optimizing your images. If you want to get deep into this tool and learn how to take advantage of the Image Speed Test, &lt;a href="https://blog.piio.co/image-optimization/image-speed-test-the-new-analysis-tool-for-websites/" rel="noopener noreferrer"&gt;here is an article with all the data you need.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Set a Monitor or an alarm for web performance
&lt;/h2&gt;

&lt;p&gt;This is really important. If you are not going to set a monitor or an alarm, just go away… I really recommend keeping a close eye on your web performance. If you haven’t done it today, today is the day to start.&lt;/p&gt;

&lt;p&gt;Change your mindset and keep track of it(not just for 2 or 3 weeks). Web performance is about constancy and keeping track of your progress. The websites are dynamic and constantly changing, that’s why this is a task you must have under control. Keep the work and effort during the time, otherwise, it’s very easy to lose everything.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkc14hs6cag5rrpwdf9x6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkc14hs6cag5rrpwdf9x6.png" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is an example when you update something on your website, and this could impact your web performance. We can see here that the performance score went down from 95% to less than 60%. Looking at the other graph, we see that the total page weight, on another date went up from 500 KB to 2.5 MB, and the same happened with Page Load.&lt;/p&gt;

&lt;p&gt;We can understand that we are adding something very heavy for our website, and that is affecting web performance. This is the perfect time to call our team and see what’s happening to take action.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away”&lt;br&gt;
Antonie de Saint-Exupéry&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Keep an eye on your Website Performance- and not just for a couple of weeks. Set an alarm or &lt;a href="https://imagespeedtest.piio.co/?ref=blogpiio" rel="noopener noreferrer"&gt;receive an email with your report&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t try to solve everything- Prioritize&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Involve your team, tell which are your goals in terms of performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;p&gt;Post first published at: &lt;a href="https://blog.piio.co/web-performance/web-performance-for-humans/" rel="noopener noreferrer"&gt;https://blog.piio.co/web-performance/web-performance-for-humans/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
