Nuno Bispo (aka Developer Service)

5.8K posts

Nuno Bispo (aka Developer Service) banner
Nuno Bispo (aka Developer Service)

Nuno Bispo (aka Developer Service)

@DevAsService

Building better devs, one post at a time. 💻 Practical tips, pro insights, and tools that actually work. Read the blog today.

Netherlands 参加日 Temmuz 2021
632 フォロー中473 フォロワー
固定されたツイート
Nuno Bispo (aka Developer Service)
Hey everyone! I’m Nuno Bispo, aka Developer Service. 💼 Senior Architect 💡 Code Enthusiast 🤖 AI Explorer With 17+ years in tech, I’m here to share what I’ve learned, from Python and Django to AI and beyond. Follow along for real-world tips, tools, and lessons that actually work.
English
0
0
2
321
Nuno Bispo (aka Developer Service)
Python has a dirty secret. It will let you write broken code that runs perfectly fine. No errors. No warnings. No stack traces. Just wrong answers, silently, confidently wrong. Scope bugs are the #1 reason this happens. You think you're reading a local variable. Python is reading a global one. Your function returns a result. The result is garbage. And the interpreter couldn't care less. I've seen this trip up beginners on day 3. I've seen it trip up senior engineers on year 5. The fix isn't talent. It's knowing the rules Python plays by. So I wrote them down. All of them. In plain English. Get the free Python Scope Guide: …variable-scope.developer-service.blog Save it. Share it. Send it to that colleague who keeps asking why their variable "has the wrong value". #Python #Programming #SoftwareEngineering #PythonTips
English
0
0
0
7
Nuno Bispo (aka Developer Service)
Don't flatten what naturally has structure. It's tempting to model everything in a single class. Easy to write, easy to read, at least until your data grows. This is where most codebases start, with just one model. But with model composition, each model has a single responsibility. And Pydantic handles nested validation automatically. Structure your models the way your domain is actually structured. The code gets cleaner, the errors get clearer, and reuse becomes obvious. This and other real-world modelling patterns are covered in Practical Pydantic: 👉 leanpub.com/practical-pyda… Model your domain. Not just your data. #Python #Pydantic #Data #Models #Patterns
Nuno Bispo (aka Developer Service) tweet media
English
0
0
0
19
Nuno Bispo (aka Developer Service)
You push your code. Your teammate pulls it. Nothing works. The "works on my machine" problem is one of the oldest frustrations in software development - and the fix is simpler than you think. I just published a beginner-friendly guide to GitHub Actions for Python projects. One YAML file is all it takes to run your tests, linting, and type checks automatically on every push. In the article: → Key concepts explained simply (workflow, job, step, runner) → A working CI pipeline from scratch with pytest → How to add ruff, mypy, and pip caching → Testing across multiple Python versions with matrix → Common pitfalls and how to avoid them No prior CI/CD experience needed. 🔗 developer-service.blog/github-actions… #Python #GitHub #CI #DevOps #SoftwareDevelopment
English
0
0
0
20
Nuno Bispo (aka Developer Service)
Nobody teaches you this in Python tutorials. You learn variables. You learn functions. You learn classes. But scope? You learn scope the hard way. At 2am. With a bug you can't explain. Staring at code that looks perfectly fine. Here's what's actually happening: Python doesn't look for variables the way you think it does. It follows a very specific lookup order - Local → Enclosing → Global → Built-in - and if you don't know the rules, it will surprise you in the worst moments. I wrote a free guide to fix that gap: ✔ How Python actually resolves variable names ✔ Why closures behave the way they do ✔ The global and nonlocal keywords demystified ✔ Real examples of scope bugs - and how to squash them No fluff. No theory for the sake of theory. Just the stuff that makes you a sharper Python dev. 🎁 Free download: …variable-scope.developer-service.blog Drop a 🐍 in the comments if scope has burned you before. #Python #PythonDeveloper #LearnPython #Debugging #Scope #Variable
English
1
0
1
19
Nuno Bispo (aka Developer Service)
Your model shouldn't just store data. It should understand it. Most developers use Pydantic for validation. Fewer use it to derive meaning from data. Here's a pattern worth adding to your toolkit, computed fields. No manual calculation. No risk of forgetting to update a field. No inconsistent state. order.total is always correct, because it can't be anything else. This matters more than it looks. Every time you store a derived value separately, you create a sync problem. What happens when quantity changes but total doesn't? Bugs that are challenging to trace and easy to introduce. Computed fields eliminate that class of problem entirely. The model owns the logic. Callers just consume the result. That's what Practical Pydantic is about, designing models that carry business logic, not just data shapes. 👉 leanpub.com/practical-pyda… Stop storing what you can compute. #Python #Pydantic #Data #Computed
Nuno Bispo (aka Developer Service) tweet media
English
0
0
0
25
Nuno Bispo (aka Developer Service)
The fix: a Python aggregator on a local server. It fetches all six endpoints, reconstructs current race state, and exposes one endpoint: /api/race-status. The ESP32 makes one request. Gets back exactly what it needs. Renders it.
English
1
0
0
28
Nuno Bispo (aka Developer Service)
I built a live F1 pit wall display with a €10 ESP32 and the free OpenF1 API. It was supposed to be a Sunday afternoon project. Thread 🧵
English
1
0
1
52
Nuno Bispo (aka Developer Service)
I once spent 3 hours debugging a Python script. The logic was right. The data was right. The tests were passing. But the output was wrong. Every. Single. Time. Turns out? A variable I thought was local was leaking from an outer scope. One line. Three hours. A lesson I never forgot. Scope bugs are brutal because Python doesn't yell at you, it just silently uses the wrong value. So I put together a free guide that breaks down exactly how Python scope works: → The LEGB rule, explained simply → The most common scope bugs (and why they're so sneaky) → How to read your own code the way Python reads it → global and nonlocal, when to use them, when to avoid them If you've ever been confused by a variable that "shouldn't" have that value... this guide is for you. Get it free here: …variable-scope.developer-service.blog Save this post. Your future self will thank you. #Python #SoftwareDevelopment #Programming #PythonTips #ChiefOfCode
English
0
0
0
29
Nuno Bispo (aka Developer Service)
Real-world data is messy. Your models shouldn't be. CSV files, external APIs, user input - they all deliver junk like "N/A", "unknown", or empty strings. Technically valid. Logically useless. Instead of scattering cleanup logic across your codebase, normalize once - at the model level. Downstream code stops worrying about edge cases. Business logic gets simpler. That's the real value of structured models: a hard boundary between messy input and reliable internal state. This pattern - and dozens like it - are covered in Practical Pydantic. leanpub.com/practical-pyda… Clean code starts with clean data. #Python #Pydantic #CleanData
Nuno Bispo (aka Developer Service) tweet media
English
2
0
1
31
Nuno Bispo (aka Developer Service)
I just published an article on how to build and publish a Python package to PyPI — and I used a real project to show it. The example is tinyfiledb: a lightweight file-based database that stores records in a local JSON file. Small enough to understand in one sitting, realistic enough to actually use. The article covers the full workflow: → Structuring your package (flat layout vs src/) → Writing pyproject.toml from scratch → Building .whl and .tar.gz distributions with python -m build → Testing on TestPyPI before it counts → Publishing to PyPI with twine → Verifying the install end-to-end in a clean environment The best first package is usually something you've already written — a module you keep copying between projects or a script you've sent to a colleague over Slack. Add a pyproject.toml, a README, and a few minutes of setup. That's all it takes. 👇 Full article at the link in the comments. #Python #OpenSource #PyPI #SoftwareDevelopment #PythonPackaging
English
2
0
1
57
Nuno Bispo (aka Developer Service)
The AI ecosystem is fragmented — every provider has its own API, auth, and rate limits. OpenRouter fixes that with a single unified API. @realpython just published my guide on showing how to: ✅ Connect to OpenRouter with plain requests ✅ Route to specific providers (by cost, speed, or throughput) ✅ Add model fallbacks for production reliability No SDK required. Just Python 🐍 👉 realpython.com/openrouter-api/ #Python #AI #APIdev
English
0
0
0
32
Nuno Bispo (aka Developer Service)
Quick Python question: Why does this happen? A variable works perfectly inside a function… but suddenly behaves differently outside of it. For many developers, this is where Python variable scope becomes confusing. Understanding how Python handles local, global, and nonlocal variables can eliminate a surprising number of bugs and make your code much easier to reason about. I wrote a short guide that explains the concept clearly with practical examples. 👉 …variable-scope.developer-service.blog If you're working with Python and want to strengthen your fundamentals, this is a concept worth mastering. #Python #Programming #SoftwareDevelopment #LearnPython #CodingTips
English
0
0
0
20
Nuno Bispo (aka Developer Service)
If your validation lives outside your models, it will eventually drift. This is one of the most common design issues I see in Python codebases. Validation starts in the API layer. Then some logic gets added in a service. Then a background worker bypasses it. Now you have three different interpretations of what “valid data” means. A cleaner approach is to encode rules directly into your data models. For example, using strict types in Pydantic when correctness matters. Why this matters: - "1" will not silently become 1 - "true" will not quietly convert to True Incorrect data fails immediately. In many systems, silent coercion is more dangerous than a loud failure. Strict validation forces data producers to behave correctly, instead of letting your system “guess” what they meant. More practical examples at: leanpub.com/practical-pyda… Reliable systems are rarely accidental. They’re designed that way. #Python #Pydantic #ValidData #Data #Validations
Nuno Bispo (aka Developer Service) tweet media
English
0
0
0
25