Click here to code!

Watch Me Code - Solving Bite 21. Query a Nested Data Structure

Posted by Bob on Sat 14 July 2018 in CodeChalleng.es • Tagged with dict, list, beginner, data structures, bites of py, video, sum, list comprehension, dictionary comprehension • 2 min read

I recorded a video solving Bite 21. Query a nested data structure. The exercise presents us with a dictionary of car manufacturers and their corresponding car models. We will extract various bits and pieces from it as well as sort the nested model lists. This is a common type of data structure so specially for a beginner it is important to have this become second nature. Prepare to learn more about looping, some string operations, and list / dict comprehensions.


Continue reading

Enough pytest to be Dangerous, 10 Things I Learned Writing Tests for 100 Python (Bites of Py) Exercises

Posted by Bob on Thu 07 June 2018 in Testing • Tagged with pytest, learning, mock, parametrize, capfd, fixtures • 8 min read

We hit 100 Bite exercises on our Code Platform and that means we have written tests for 100 exercises. In this article I share 10 things I learned about writing test code and pytest.


Continue reading

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

PyBites 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