Sign in

pybites.bsky.social

@pybites.bsky.social
94 followers 5 following 27 posts
PostsRepliesMedia
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 04/03/2026
Not having (complete) docs earlier has been a miss! And with AI, it's now easier to fix than ever. Last week we added the whole suite to our @Pybites platform 👇 No more people abandoning the app because it's unclear how it works. 😱
122
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 26/02/2026
What makes up the 2026 #Python stack? Why are uv, ruff, FastAPI, Typer, and SQLModel widely adopted by developers that want to have an ergonomic and performant toolset? What methodologies do we use in our teaching to help you write clean/ robust code consistently?
111
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 09/02/2026
I feel that it's safe to say that every Python dev here has faced this error at some point: AttributeError: 'NoneType' object has no attribute 'get' Somewhere, somehow, a function returned None when you expected data.
121
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 08/02/2026
"Rust is too hard." I hear this constantly from Python developers. The borrow checker. Lifetimes. Ownership. It sounds intimidating. Here's the truth: Rust is different, not harder.
131
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 06/02/2026
I love how we go deep into Rust core features in our Scripter to Rust cohort. Code example that came up:
121
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 03/02/2026
Learning #Rust made me a better #Python programmer. Not because I write Rust at work. Because Rust forced me to think about things I'd been ignoring and I never realized this fact.
141
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 30/01/2026
Your favorite #Python 🐍 libraries are lying to you. • `pip install orjson` - that's Rust. • `pip install polars` - Rust. • `pip install cryptography` - Rust. • `pip install pydantic` - the core is Rust. • `pip install ruff` - Rust again.
131
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 23/01/2026
The difference between a Junior and Senior dev isn't syntax. It's this. Most developers can write a script to fetch data from an API. They get it to work, then they move on.
111
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 22/01/2026
We just shipped a new SQLModel Learning Path on the Pybites Platform: 🔹 Learn the Python ORM to focus on next 🔹 Get type-safe models with Pydantic-style, high-performance validation 🔹 See how cleanly SQLModel plugs into FastAPI for real-world APIs
121
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 22/01/2026
🐍 Pythonista → 🦀 Rustacean? I’ve built a Rust Cohort for Pythonistas with Jim Hodapp, a 6-week, project-driven journey where you’ll: Build a real JSON parser, in Rust 🏗️
111
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 21/01/2026
Watching 10 hours of video tutorials makes you a viewer, not a coder. Passive consumption is the "silent killer" of engineering careers. And after talking to hundreds of developers over the years, it's still all too common. 😱
131
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 27/11/2025
Really enjoyed my chat with Kishan Patel on our @pybites podcast.
111
pybites.bsky.social @pybites.bsky.social · 27/11/2025
We decided to do something different for #BlackFriday Instead of selling you "content," we're discounting "accountability." For the first time, we've slashed the price on our #Python Snipster (Intermediate) and Foundations (Beginner) cohorts (30-35% off).
111
pybites.bsky.social @pybites.bsky.social · 20/11/2025
Did you know you can search our #Python content from the command line? It's one of our open source libraries called `pybites-search` Easy to run (alias) using uvx:
011
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 14/11/2025
Tired of tutorials that don’t go anywhere? 👉 Start implementing these kind of patterns in our 6-week Snipster program: pybitescoaching.com
pybitescoaching.com
Snipster: Build Real Python Projects
011
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 14/11/2025
One of my favorite design patterns: the Repository Pattern. 😍 It keeps business logic separate from the data layer. 📈 Need to swap SQL for CSV or add an API backend later? Plug it in, the interface stays the same. Example below 👇
111
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 13/11/2025
I solved a Bite today and used collections.Counter() 🙂 Good reminder: the right data structure saves a lot of code. 🐍 In this case: apart from a small helper function, you get the top stock by symbol using most_common() Clean, fast, readable. 🚀
111
pybites.bsky.social @pybites.bsky.social · 13/11/2025
One of our PDI clients is building a time tracker app with SQLModel + Flask. It started simple, then grew as he hit real-world edge cases. That’s where the real dev learning happens: ⏱️ Format times ⛔ Avoid duplicates 🛠️ Handle errors clearly What are you building this week?
011
Reposted by @pybites.bsky.social
bjkeefe @bjkeefe.bsky.social · 28/10/2025
Perhaps there is yet hope. futurism.com/artificial-i...
futurism.com
Inventor of Vibe Coding Admits He Hand-Coded His New Project
Even former OpenAI exec Andrej Karpathy, who coined the term "vibe coding," has seemingly fallen out of love with his own creation.
222
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 17/06/2025
Heads up I am running another Snipster #Python training cohort next week - we'll build this cool app:
121
Reposted by @pybites.bsky.social
rajrai0fficial.bsky.social @rajrai0fficial.bsky.social · 06/06/2025
I've completed "User input" on @pybites.bsky.social 🐍🎉 - pybitesplatform.com/bites/user-i...
pybitesplatform.com
Pybites Platform | Master Python Through Hands-On Coding
Overwhelmed by tutorials? Stop consuming books and courses! Confidence will come through a lot of deliberate practice. Our platform helps you master Python and grasp Pythonic best practices.
021
pybites.bsky.social @pybites.bsky.social · 30/05/2025
Tutorials are clean — but real code is messy. 💡 Our coaching cohort helps you thrive in the wild 💪 • write tests, refactor with confidence • debug real issues • build an efficient dev toolkit • collaborate using Git/GitHub • ship code you’re proud of 👉 pybitescoaching.com #Python #Developer
000
pybites.bsky.social @pybites.bsky.social · 28/05/2025
You’ve done 100 Python 🐍 exercises. Now what? 🤔 Building a real app still feels out of reach. 😮 That’s where our cohorts come in - we guide you from confusion to confidence, project by project. 💪 🚀
100
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 27/05/2025
Thanks for joining us 🎧 @tiangolo.com 🎉 and for all you do with @fastapi.tiangolo.com, other libs, and now FastAPI Cloud 😍 It will be so nice to deploy FastAPI apps with just: `fastapi deploy` 🚀 www.youtube.com/watch?v=Q_8a...
youtube.com
Pybites Podcast 191: Code, click, cloud - how Sebastián Ramírez is taking FastAPI to the next level
YouTube video by Pybites
162
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 27/05/2025
I've completed "Build unix' wc program in python" on @pybites.bsky.social 🐍🎉 - pybitesplatform.com/bites/build-...
pybitesplatform.com
Pybites Platform | Master Python Through Hands-On Coding
Overwhelmed by tutorials? Stop consuming books and courses! Confidence will come through a lot of deliberate practice. Our platform helps you master Python and grasp Pythonic best practices.
011
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 09/05/2025
I've completed "Pybites date generator" on @pybites.bsky.social 🐍🎉 - pybitesplatform.com/bites/pybite... #python
pybitesplatform.com
Pybites Platform | Master Python Through Hands-On Coding
Overwhelmed by tutorials? Stop consuming books and courses! Confidence will come through a lot of deliberate practice. Our platform helps you master Python and grasp Pythonic best practices.
011
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 06/05/2025
👨‍🏫 Want in? The main cohort is full, but beginner spots are still open (or join the waiting list for the next intermediate one) Check it out here 👉 pybitescoaching.com
011
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 06/05/2025
🚀 Built a #Streamlit front-end on top of a #FastAPI backend for our next cohort (starting next week!) 🚀 Great stack for quickly prototyping a front-end, all #Python, no JS 😎 (For more serious web apps you definitely want JS and/or htmlx though 💡)
121
pybites.bsky.social @pybites.bsky.social · 29/04/2025
Learn more advanced and real world #python #developer techniques - join us for our first 6 week intermediate cohort 12th of May 🎉 🐍 💪
010
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 25/04/2025
You pick up dozens of these small and subtle #python 🐍 tricks + idioms when you make it a habit to code on our platform every day 💡 🔥 -> join here: pybitesplatform.com 📈
pybitesplatform.com
Pybites Platform | Master Python Through Hands-On Coding
Overwhelmed by tutorials? Stop consuming books and courses! Confidence will come through a lot of deliberate practice. Our platform helps you master Python and grasp Pythonic best practices.
011
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 25/04/2025
𝟱 𝗰𝗼𝗼𝗹 𝘄𝗮𝘆𝘀 to use the underscore in #Python 🐍💡 • Ignore 𝘃𝗮𝗹𝘂𝗲𝘀 when unpacking • Loop 𝗽𝗹𝗮𝗰𝗲𝗵𝗼𝗹𝗱𝗲𝗿 • Access 𝗹𝗮𝘀𝘁 𝗿𝗲𝘀𝘂𝗹𝘁 in REPL • Format 𝗹𝗮𝗿𝗴𝗲 𝗻𝘂𝗺𝗯𝗲𝗿𝘀 • Define "𝗽𝗿𝗶𝘃𝗮𝘁𝗲" methods (convention) See below 👇
121
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 25/04/2025
Potentially underused #Python 🐍 feature: 𝘀𝗲𝘁 𝗼𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝘀 💡 Here's an example how we can remove or update tags, casting new + old into sets, then performing 𝘴𝘦𝘵 𝘰𝘱𝘦𝘳𝘢𝘵𝘪𝘰𝘯𝘴 🔥 Have you used them, how? 😍 (Still on the fence about 𝘸𝘢𝘭𝘳𝘶𝘴, but couldn't bear doing 𝘴𝘵𝘳𝘪𝘱() twice 😅)
131
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 23/04/2025
Making a temporary file/dur is very useful for 𝘁𝗲𝘀𝘁𝗶𝗻𝗴. In the example below, we first use 𝘛𝘦𝘮𝘱𝘰𝘳𝘢𝘳𝘺𝘋𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺 to create 5 temp files. This is a great example of using a 𝗰𝗼𝗻𝘁𝗲𝘅𝘁 𝗺𝗮𝗻𝗮𝗴𝗲𝗿 — a clean way to automatically clean up resources. pytest makes it even easier using the 𝘵𝘮𝘱_𝘱𝘢𝘵𝘩 fixture:
import os
from pathlib import Path
from tempfile import TemporaryDirectory

import pytest


def count_dirs_and_files(directory_path: str = '.' ) -> tuple[int, int]:
    """Function for counting dirs and files in a directory."""
    dirs, files = 0, 0
    for _, directories, filenames in os.walk(directory_path):
        dirs += len(directories)
        files += len(filenames)
    return dirs, files


def test_only_files():
    with TemporaryDirectory(dir="/tmp") as dirname:
        for i in range(1, 6):
            (Path(dirname) / f'{i}.txt').write_text('hello')
        assert count_dirs_and_files(dirname) == (0, 5)

# refactored using pytest's tmp_path fixture + parametrize

@pytest.mark.parametrize("num_files", [1, 5, 10])
def test_only_files_param(tmp_path, num_files):
    for i in range(1, num_files + 1):
        (tmp_path / f'{i}.txt').write_text('hello')
    assert count_dirs_and_files(tmp_path) == (0, num_files)
132
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 18/04/2025
Do you know all these 5 powerful uses of * in #Python? – Keyword-only args – Extended unpacking – Flexible funcs with *args – Unpack into func calls – Merge iterables 👇 See examples below — which ones do you use the most, and which ones are new to you? #coding #tips
141
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 16/04/2025
Keep up2date with relevant #Python developer tips + industry trends joining our weekly @pybites.bsky.social Newsletter: pybit.es/newsletter 💡 🚀
pybit.es
Enhance Your Developer Mindset - Join Our Pybites Newsletter - Pybites
🐍 Elevate your Python, developer and mindset skills. Every week, for free!
041
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 17/04/2025
Becoming a proficient #Python dev isn’t just about syntax, it’s about building usable apps with clean, testable, well-structured code. That’s what we coach in our 6-week cohort starting next month. Real apps. Real feedback. Real growth. 💪 More info: pybitescoaching.com
042
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 16/04/2025
A common #Polars saying: "𝙄 𝙘𝙖𝙢𝙚 𝙛𝙤𝙧 𝙩𝙝𝙚 𝙨𝙥𝙚𝙚𝙙, 𝙗𝙪𝙩 𝙨𝙩𝙖𝙮𝙚𝙙 𝙛𝙤𝙧 𝙩𝙝𝙚 𝙨𝙮𝙣𝙩𝙖𝙭" 😍 I see why now — it's 𝗯𝗲𝗮𝘂𝘁𝗶𝗳𝘂𝗹 and 𝗳𝗮𝘀𝘁. 📈 Switched from Pandas? What’s been your biggest win (or pain)? 🤔 #Python #Rust #DataAnalytics
151
pybites.bsky.social @pybites.bsky.social · 15/04/2025
🎉 💪 🔥
000
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 14/04/2025
De-duped our books category page by reconciling similar titles, e.g. think & grow rich → think and grow rich everything is f*cked → everything is # @%!ed Just stdlib -> `difflib`, no external deps 🚀 (Fun fact: Django’s manage.py uses this too btw 😎) #python #tips
from itertools import combinations
from difflib import SequenceMatcher

tags = ['python', 'pythonista', 'developer', 'development', 'dev', 'devs']

def similar(a: str, b: str) -> float:
    return SequenceMatcher(None, a, b).ratio()

THRESHOLD = 0.8  # tune based on how strict you want to be

for a, b in combinations(tags, 2):
    score = similar(a, b)
    if score >= THRESHOLD:
        print(f"{a} ≈ {b} → {score:.2f}")

# output:
# developer ≈ development → 0.80
# dev ≈ devs → 0.86
231
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 11/04/2025
Pydantic is awesome for data cleaning + validation, but if you want something quick + stdlib only, you can also use dataclasses + `__post_init__` 🐍 😍 - see example below. 🚀 #python #tips
from dataclasses import dataclass

@dataclass
class Bite:
    number: int
    title: str
    description: str

    def __post_init__(self):
        self.number = int(self.number)
        self.title = self.title.strip().title()
        self.description = self.description.strip()
        if not 5 < len(self.title) < 20:
            raise ValueError("Title must be between 5 and 20 characters long")
        if self.number <= 0:
            raise ValueError("Number must be a positive integer")

bite = Bite(1, "  example title  ", "This is a description.")
# Bite(number=1, title='Example Title', description='This is a description.')
bite = Bite(2, "this title is waaaaaaaaaaaay too long", "This is a description.")
# ValueError: Title must be between 5 and 20 characters long
bite = Bite(-1, "another title", "blabla")
# ValueError: Number must be a positive integer
181
Reposted by @pybites.bsky.social
Anthony Shaw @anthonypjshaw.bsky.social · 08/04/2025
Feel like my Python is getting rusty with AI finishing all my… sentences. Doing some code challenges on @pybites.bsky.social with no code completions as nature intended 🪴
262
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 02/04/2025
Who has experienced this? #AI tools: quick wins, but more + longer debugging? (image source: www.reddit.com/r/Programmer...)
052
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 21/03/2025
"The only way to learn a new programming language is by writing programs in it." – Dennis Ritchie No CS degree. Went from Excel macros to #Python 🚀 Code wasn’t that clean at first, but by building a real-world solution I launched my dev career 💡 Build first, polish later! 📈
172
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 20/03/2025
List vs Generator in Python 🐍💡 List: 835MB, 0.99s Generator: 192B, 0.00s 😲 • Use `sys.getsizeof()` to check memory. • Use generators when you don’t need all values at once. Small change, big difference! 📈 #Python #tips #performance
import sys, time

start = time.time()
list_comp = [x for x in range(100_000_000)]
print(f"List: {sys.getsizeof(list_comp):,} bytes, {time.time() - start:.4f}s")

start = time.time()
gen_exp = (x for x in range(100_000_000))
print(f"Generator: {sys.getsizeof(gen_exp):,} bytes, {time.time() - start:.4f}s")
142
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 19/03/2025
@Pybites Books v2 is live! 🚀 Simple, fast book tracking that incentivizes you to keep #reading 😎 Gamified, clean design (Tailwind + Htmx 🙏), and loved by users already. 😍 Let’s keep #books alive 💡, especially in this day and age. 📈 Try it → pybitesbooks.com 📚
011
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 18/03/2025
"In the face of ambiguity, refuse the temptation to guess." 💡 Python prefers clarity over assumptions: • No implicit type coercion • One null: None • Mandatory indentation = no dangling if • Type hints + mypy = catch bugs early >>> import this 🐍 #Python #DevTips #Coding
# js
console.log(1 + "2"); // Outputs "12" 🤯 

# py
1 + "2"  # TypeError
str(1) + "2"  # "12"
141
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 17/03/2025
Elegant API design in #Python libs 🐍 • requests/httpx: no auto errors, you call raise_for_status() → full control • newspaper3k: download(), parse(), nlp() → as needed • pathlib.Path: / operator + chaining methods → clean, OOP fs access Great libs don’t box you in 💡🚀
131
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 14/03/2025
Subclassing dict or list in Python? Beware! 😱 Some built-in methods bypass your overrides. ✅ Use collections.UserDict & UserList instead! They ensure all operations respect your methods. 🚀 Cleaner, predictable behavior. #Python #tips
141
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 13/03/2025
💡 You can use a class method to add an alternative constructor to your class. Inspired by `datetime`, the `MyDate` class below lets you create instances from a `date` or a "YYYY-MM-DD" string. 🚀 #Python #tips
from __future__ import annotations
from dataclasses import dataclass
from datetime import date, datetime
from typing import Self


@dataclass
class MyDate:
    date: date

    @classmethod
    def from_str(cls, date_str: str) -> Self:
        try:
            parsed_date = datetime.strptime(date_str, "%Y-%m-%d").date()
            return cls(parsed_date)
        except ValueError as e:
            raise ValueError(
                f"Invalid date format: {date_str}, exception: {e}"
            )


if __name__ == "__main__":
    d1 = MyDate(date(2021, 5, 1))
    d2 = MyDate.from_str("2021-05-01")
    assert d1 == d2
    # MyDate.from_str("2021-02-30") # ValueError
231
Reposted by @pybites.bsky.social
Bob Belderbos @bbelderbos.bsky.social · 10/03/2025
Need to grab just the first and last items from a list in #Python? 🐍 You could use slicing: first = words[0] last = words[-1] Or take advantage of tuple unpacking with a throwaway variable 🚀 first, *_, last = words Which way do you prefer?
361