Setup a Ready-For-Production Python Project
Improve your python projects quality and make them ready for production
Python is one of the most used programming languages nowadays. It is very simple to set up, its syntax is quite user-friendly compared with Java, and has a lot of pre-built modules that can help to create machine learning algorithms.
With Python, it’s very easy to build something that works. But sometimes, taking a python project to the next step — and making it more than a simple script — can be very challenging if some best practices are not followed. Here are six ways you can improve your python script and make it a production-ready project!
1. Logging
Logging is one of those things that usually developers don’t do when they’re developing a new project because they feel it’s a waste of time. Actually, having a good logging strategy, not only improves a lot your code but can help you save a lot of time. It’s also very easy to implement!
So, instead of using print( ) let’s use the default python module log.
import loggingFORMAT = '%(asctime)-15s- %(levelname)s - %(name)s -%(message)s'
logging.basicConfig(format=FORMAT, level=logging.DEBUG)
logger = logging.getLogger(__name__)