𝗚𝗿𝗲𝗲𝗻 𝗳𝗹𝗮𝗴𝘀 in 𝗿𝗲𝗹𝗮𝘁𝗶𝗼𝗻𝘀𝗵𝗶𝗽𝘀? Nice. 𝗚𝗿𝗲𝗲𝗻 𝘁𝗲𝘀𝘁𝘀 in 𝗽𝘆𝘁𝗲𝘀𝘁? Legendary. Yesterday while contributing to an open-source Python project, I thought my fix was done. All tests passed locally. Everything looked perfect. Then I ran: pre-commit run --all-files Suddenly… errors everywhere. Not logic errors. But formatting, linting, and style issues the CI pipeline would reject. That command forced 𝗲𝘃𝗲𝗿𝘆 𝗽𝗿𝗲-𝗰𝗼𝗺𝗺𝗶𝘁 hook to run on the entire repository - checking formatting, lint rules, and code quality before pushing. In simple words: It simulates what the repository’s automated checks will do during a Pull Request. Fixing those small issues locally saved me from the classic “𝗣𝗥 𝗳𝗮𝗶𝗹𝗲𝗱 𝗱𝘂𝗲 𝘁𝗼 𝘀𝘁𝘆𝗹𝗲 𝗰𝗵𝗲𝗰𝗸𝘀” moment. And it reminded me of something important: Good engineers don’t just write code that works. They write code that passes the entire ecosystem around it - tests, linting, and quality checks. 𝗤𝘂𝗶𝗰𝗸 𝘁𝗮𝗸𝗲𝗮𝘄𝗮𝘆: Green tests mean your logic works. pre-commit ensures your code is production-ready. How do you usually catch CI failures before pushing code? #Python #OpenSource #Testing #CodingJourney #DeveloperCommunity #Pytest #PreCommit
More Relevant Posts
-
The hardest part of building an open source framework isn't shipping v1. It's what happens the week after. I released FluidKit last week. A bridge between Python and SvelteKit that lets you write backend functions in Python and use them as native SvelteKit remote functions. 7 days later, I found two problems I couldn't ignore. The first was subtle. Edit a decorated function fast enough, or swap its decorator type mid-development, and the route would stick in FastAPI permanently. Ghost endpoints. Invisible unless you checked /docs. The root cause took hours to trace. The hot reload system assumed cleanup would always happen in order. But the reload engine sometimes fires delete before the proxy even attaches. The cleanup path never runs. The route lives forever. The fix: a reconciliation pass after every reload. Compare what the registry thinks exists against what the module actually exports. Mismatches get cleaned up immediately. The second problem was a security gap. FluidKit generates /remote/* endpoints meant only for SvelteKit's server. But anyone who knew the port could call them directly. Now every request carries an HMAC-signed timestamp. No valid signature, no access. Building a framework means your bugs become everyone's bugs. That's why I shipped both fixes within a week. FluidKit v1.3.0 is live. pip install --upgrade fluidkit If you're using FluidKit and hit something weird, open an issue: https://lnkd.in/g3zdvcYJ Docs and source: https://fluidkit.github.io If you're building fullstack apps with Python, I'd love your feedback. And if you've shipped something open source and know that post-launch anxiety, I get it now. #Python #SvelteKit #FastAPI #OpenSource #WebDevelopment #FullStack #Pydantic #BuildInPublic
To view or add a comment, sign in
-
Beyond the Boilerplate: Why Pytest Fixtures are the secret weapon of Python automation. If your test setup logic feels like a teetering Jenga tower of inherited classes and repetitive setUp methods, you’re likely spending more time managing code than actually testing. In the world of Python, moving toward Pytest Fixtures is like switching from manual configuration to a streamlined, automated workflow. The beauty of fixtures lies in their ability to handle complex dependencies while keeping your test files remarkably clean and focused. Why moving away from standard class-based setups changes everything: Explicit Dependency Injection: No more wondering where a database connection or a browser instance magically came from. In Pytest, you pass fixtures as arguments directly to your test function. It’s clear, readable, and tells you exactly what a test requires before you even look at the logic. The Magic of Scopes: Not every resource needs to be recreated for every single test. Pytest allows you to define the "lifetime" of a fixture—whether it’s for a single function, a class, or the entire session. Why log in to your application 50 times when you can do it once, share the state, and significantly speed up your entire pipeline? The "Yield" Revolution: Forget about writing separate, detached cleanup methods. By using the yield keyword, you can combine setup and teardown into a single, intuitive function. Everything before yield happens before the test; everything after handles the cleanup—even if the test fails. Modular Power with conftest.py: You can organize your fixtures in a central conftest.py file, making them globally available across your project without a single import statement. It’s the cleanest way to share configurations across hundreds of test files. Quality in automation is about building a framework that doesn't become a maintenance burden six months down the road. Leveraging fixtures allows you to treat your test infrastructure as a set of modular, reusable components rather than a massive block of copy-pasted boilerplate. Are you still using classic class-based setups, or have you embraced the power of fixtures? Let’s talk about your most complex setup—how many fixtures do you usually "chain" together for a single E2E test? #Python #Pytest #TestAutomation #SDET #SoftwareEngineering #CleanCode #TestGeeks
To view or add a comment, sign in
-
-
The flasgo website is now live. You want a fast async typed Python web framework that has security built in from the start(follows owasp 2025) requires Python 3.14 and has a small attack surface as possible with django like security primatives but is easy as using flask? Then you have come to the right place. #python #webdevelopment #web
To view or add a comment, sign in
-
Log 2/100: Telnetting into the Switch Python Library: telnetlib Today, I wrote a script to Telnet into my lab switch, but it kept crashing. After some troubleshooting, I found the exact issue: Python is just too fast. The script kept pasting the username before the switch had even generated the login prompt. The Fix: I added an extra line to the script (read_until) to force Python to wait and read the output until it actually saw the word "login:", and then asked it to paste the username. I applied the same logic to the Password prompt as well. Suddenly, the script started working flawlessly. The Takeaway: Writing the code is the easy part. Anticipating timing issues and making sure the script actually works without breaking in production is the tough part! The scirpts executes the show version command on the switch. Git Hub Repo: https://lnkd.in/gFkfNyWm Git hub Profile: https://lnkd.in/gjJJJQeT #Python #NetworkAutomation #NetDevOps #NetworkEngineering #100DaysOfCode #ArubaCX #CodingJourney
To view or add a comment, sign in
-
-
Want good code? Let the 𝐢𝐦𝐩𝐥𝐞𝐦𝐞𝐧𝐭𝐚𝐭𝐢𝐨𝐧 𝐟𝐨𝐥𝐥𝐨𝐰 𝐫𝐮𝐥𝐞𝐬 ⚙️ There are two ways of doing that in Python: with either 𝐀𝐁𝐂 𝐈𝐧𝐭𝐞𝐫𝐟𝐚𝐜𝐞𝐬 or with 𝐏𝐫𝐨𝐭𝐨𝐜𝐨𝐥𝐬. 𝐀𝐁𝐂 𝐈𝐧𝐭𝐞𝐫𝐟𝐚𝐜𝐞𝐬 is when you (1) write a base class with methods, (2) let implementations 𝑖𝑛ℎ𝑒𝑟𝑖𝑡 from that class and 𝑓𝑜𝑟𝑐𝑒 𝑡ℎ𝑒𝑚 𝑡𝑜 𝑖𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡 all the required methods. This way you catch errors early, but it may require more code. 🧱 𝐏𝐫𝐨𝐭𝐨𝐜𝐨𝐥𝐬 are when you (1) write a protocol class, and (2) during use 𝑎𝑐𝑐𝑒𝑝𝑡 𝑎𝑛𝑦 𝑐𝑙𝑎𝑠𝑠 𝑡ℎ𝑎𝑡 ℎ𝑎𝑠 𝑡ℎ𝑒 𝑠𝑎𝑚𝑒 𝑚𝑒𝑡ℎ𝑜𝑑𝑠 as defined in the protocol. This gives you flexibility to plug-and-play quickly. Less code, but errors may only appear at runtime. 🧩 𝐆𝐞𝐧𝐞𝐫𝐚𝐥 𝐫𝐮𝐥𝐞: - Protocols are good for 𝘦𝘹𝘵𝘦𝘳𝘯𝘢𝘭 𝘴𝘵𝘶𝘧𝘧 like APIs, LLM providers, data sources 🌍 - Interfaces are good for 𝘪𝘯𝘵𝘦𝘳𝘯𝘢𝘭 𝘴𝘵𝘶𝘧𝘧 like core logic of your system ⚙️ 𝐹𝑙𝑒𝑥𝑖𝑏𝑙𝑒 𝑎𝑡 𝑡ℎ𝑒 𝑒𝑑𝑔𝑒𝑠, 𝑠𝑡𝑟𝑖𝑐𝑡 𝑎𝑡 𝑡ℎ𝑒 𝑐𝑜𝑟𝑒. #software #engineering #best #practices
To view or add a comment, sign in
-
-
Real-world APIs often break Python naming conventions, forcing awkward compromises between code quality and external integration requirements. You want to maintain clean Pythonic code and avoid incidental complexity. But you also need to handle camelCase, kebab-case, and other non-Pythonic field naming for third-party integrations. Unfortunately, most teams end up with messy field mapping or abandoned code standards because traditional approaches force you to choose between code quality and integration functionality. Here's where Pydantic's alias system transforms your integration architecture: use Field(alias='externalName') for clean external mapping while preserving perfect Python naming internally. Result: More maintainable Python code + seamless API integration #Python #Pydantic
To view or add a comment, sign in
-
-
Testing shouldn't be an afterthought. Dyne comes with a built-in, asynchronous test client that makes verifying your API as easy as writing it. The `app.client` uses the familiar Requests-style API, allowing you to perform GET, POST, and other requests against your app without a live server. With support for `url_for()` and automatic JSON/YAML media parsing, you can write robust unit and integration tests in seconds. Ship with confidence every time: https://lnkd.in/eqEc4Tuw #Python #Pytest #SoftwareTesting #Backend #WebDev #DyneFramework
To view or add a comment, sign in
-
-
Crawling an entire website used to take: A Python script. Playwright or Selenium. Proxy rotation. Rate limiting logic. Error handling. 3 hours of debugging why page 47 returned a 403. Now it's one API call. Every web scraping startup that raised millions to solve this problem just became a single endpoint.
To view or add a comment, sign in
-
-
𝗪𝗵𝘆 𝗥𝘂𝗻𝗻𝗶𝗻𝗴 𝗨𝘀𝗲𝗿 𝗖𝗼𝗱𝗲 𝗼𝗻 𝗬𝗼𝘂𝗿 𝗦𝗲𝗿𝘃𝗲𝗿 𝗜𝘀 𝗗𝗮𝗻𝗴𝗲𝗿𝗼𝘂𝘀 While building a Python script execution API, I realized how risky it is to run user-submitted code on a server. A script could try to delete files, access sensitive directories, run infinite loops, or consume all system resources. What sounds like a simple feature quickly becomes a serious security and reliability problem. To explore this, I built 𝗣𝘆𝘁𝗵𝗼𝗻𝗦𝗰𝗿𝗶𝗽𝘁_𝗦𝗲𝗿𝘃𝗶𝗰𝗲𝗦𝗮𝗻𝗱𝗯𝗼𝘅, which executes scripts inside an isolated environment using 𝗻𝘀𝗷𝗮𝗶𝗹 locally and 𝗴𝗩𝗶𝘀𝗼𝗿 in production, enforcing filesystem restrictions and resource limits. The real challenge was 𝗱𝗲𝘀𝗶𝗴𝗻𝗶𝗻𝗴 𝗴𝘂𝗮𝗿𝗱𝗿𝗮𝗶𝗹𝘀 that safely handle untrusted code. If you're curious, you can go through the project and some of the test cases to see how the sandbox handles different scenarios 👇 https://lnkd.in/eZP5mMhP
To view or add a comment, sign in
-
Stop reviewing style. Start reviewing logic. 🛑 We all know the feeling: You open a Pull Request, excited to see the new feature, only to spend the first 10 minutes commenting on missing docstrings, inconsistent variable names, or unused imports. Let’s automate the boring stuff. If you are a Python developer, Pylint needs to be a non-negotiable part of your workflow. It’s not just a linter; it’s a code quality watchdog that sits right in your IDE or CI/CD pipeline. Here is why I keep coming back to it: 🔍 Catches Errors Early: It spots typos, logical issues, and potential bugs before they ever reach production. 📏 Enforces Standards: It keeps the team speaking the same language by adhering to PEP 8. 🧠 Refactoring Helper: That score it gives you? Treat it like a credit score. If it drops below a 7/10, it’s time to simplify that complex function. Pro Tip: Don't aim for a perfect 10/10 on every script—that can lead to over-engineering. Aim for consistency. What linter is non-negotiable in your stack? 👇 #Python #Pylint #Coding #SoftwareEngineering #DeveloperTools #CodeQuality
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development