Click here to code!

All You Need to Know to Start Using Fixtures in Your pytest Code

Posted by Bob on Thu 15 March 2018 in Testing • Tagged with pytest, fixtures, testing, refactoring, pytest-cov, coverage • 11 min read

Setting up test cases for code that manage data can be challenging but it's an important skill to reliably test your code. You might have heard of the setup and teardown methods in unittest. In pytest you use fixtures and as you will discover in this article they are actually not that hard to set up. Fixtures have been labelled pytest's killer feature so let's explore them in this article using a practical example.


Continue reading

5 Things we Learned Co-hosting a Live Code Challenge Workshop

Posted by Bob on Sat 11 November 2017 in Reviews • Tagged with code challenges, community, Python Alicante, live coding, learning, retrospective, talks, Marvel, fun • 4 min read

Yesterday we hosted PyChallengeDay together with Python Alicante. I am sure the folks that joined us stretched their coding skills. And we learned a couple of things too which we will share in this article. Hopefullly it inspires you to host a workshop yourself to grow the awesome Python community.


Continue reading

Bootstrap Your Next Python Project With Cookiecutter

Posted by Bob on Wed 25 October 2017 in Tools • Tagged with Cookiecutter, setup, testing, packages, modules, Bottle • 3 min read

I finally did it! I bootstrapped my first project with Cookiecutter. There is a lot to discover but wow this tool can save you a ton of time, making your project more professional.


Continue reading

How to Use Pdb to Debug Your Code

Posted by Bob on Tue 24 October 2017 in Modules • Tagged with pdb, debugging, troubleshooting, bugs, modules • 5 min read

The larger part of our coding time is spent reading and debugging code already written. For this Python's pdb is an unmissable module in your Python toolbox. In this article I show you the most common options and some practical examples.


Continue reading

Learning Python Decorators by Example

Posted by Bob on Fri 20 October 2017 in Concepts • Tagged with decorators, design patterns, logging, caching, memoization, Flask, Django, properties, classmethod, staticmethod, lru_cache, mock.patch, contextmanager • 4 min read

Decorators are a sometimes overlooked feature and they might be hard to grasp for beginning Pythonistas. I agree with Aaron Maxwell that mastering them "can massively magnify the positive impact of the code you write", so make sure you add them to your toolkit if not done so already. In this article I explain what they do, why you want to use them and give some practical examples.


Continue reading

Python Testing With Pytest

Posted by Bob on Mon 25 September 2017 in Books • Tagged with pytest, testing, books, tox, Jenkins, fixtures, unittest, q&a • 3 min read

Review of Brian Okken's new pytest book.


Continue reading

Module of the Week: Openpyxl - Automate Excel!

Posted by Bob on Tue 12 September 2017 in Modules • Tagged with excel, games, first script, vba, automation, openpyxl, hacking, unix • 3 min read

You probably remember your first script. I remember the joy of discovering how I could let the machine automate something for me. It still gets me excited everyday. I played a bit with openpyxl yesterday. I used it to hack an Excel game for which I first used a macro. Not particularly useful but a nice exploration of this module.


Continue reading

Improve the Quality of Your Code with Better Code Hub

Posted by Bob on Wed 30 August 2017 in Tools • Tagged with bettercodehub, SIG, refactoring, code quality, clean code, software development, tools, platform • 5 min read

So you pushed your code to GitHub and deployed v1, congrats! But how maintainable is your code really? Do you have tests? Is your code modular? Are your methods short and concise? What if you could hit a button and a tool conveniently checks this for you? Free and integrated with GitHub? Enter Better Code Hub from Software Improvement Group ...


Continue reading

Fully Automate Login and Banner Generation with Selenium, Requests and Click

Posted by Bob on Sun 20 August 2017 in Modules • Tagged with Selenium, Requests, selenium-requests, Click, Pillow, automation, scraping, tools, PyBites Banner Generator, images • 3 min read

In part 3 of the PyBites Banner Generator article series I show you how to automatically generate a banner with Requests and Selenium.


Continue reading

Making a Banner Generator With Pillow and Flask

Posted by Bob on Sat 19 August 2017 in Tools • Tagged with Pillow, Flask, Heroku, Flask-WTF, Flask-SQLAlchemy, challenges, PyBites Banner Generator, images • 4 min read

In this article I will take last week's banner.py Pillow script and integrate it into a Flask app.


Continue reading