Python

Python Tips: On Getting Started, Unit Testing and Code Coverage

Python Tips: On Getting Started, Unit Testing and Code Coverage

tl;dr Here is a collection of useful Python tips, a starter “Hello World” Python template for both web (using Flask) and stand-alone script. And additional tips in writing effective Python code, getting started, Unit Tests and using the Coverage tool to improve code. Photo by Fabian Grohs on Unsplash Getting Started - Introducing “Python Hello World” Template Sometimes when we need to get started in Python, we need an easy “Hello World” template that gets us started with all the basics including unit test and coverage reports.

Python humanize time-interval without Arrow or Humanize libraries

Python humanize time-interval without Arrow or Humanize libraries

tl;dr Sometimes when we need to debug functions in Python, we need a way to write some quick timer code to capture the time-delta and to compute the time it took for the function to execute. This article shows you a quick and easy way to humanize a time-interval/time-delta without bringing in additional dependencies or libraries like Arrow or Humanize. Elapsed Time: 2 Days, 5 Hours, 7 Minutes, 13 Seconds Yucel Moral (@yucelmoran) at Unsplash

uvloop - Python replacement for asyncio event loop

uvloop - Python replacement for asyncio event loop

uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses libuv under the hood. Benefits: uvloop makes asyncio 2-4x faster. Cons: uvloop is available from PyPI but it requires Python 3.5. (The reason for this is asyncio was introduced in Python 3.4 and above.) Unless your project is based on Python 3.4+ - you may not be able to leverage this library.

Node.js, Python, C/C++, Ruby, PHP development from a tiny Linux embedded for about $10

Came across this tiny IoT embedded micro-controller/computer that runs BusyBox or FreeBSD Linux and can run code written in Node.js, Python, C/C++, Ruby and PHP all at a cost of $5 to $10 with WiFi, 2G/3G, Bluetooth, GPS add-ons for your cloud services. It also has enough GPIO pins to interface with external world and not to mention the I2C and I2S interfaces for talking to other devices and peripherals as well as interfacing for sounds (I2S).