/Clean-Code-in-Python

Clean Code in Python, published by Packt

Primary LanguagePythonMIT LicenseMIT

Clean Code in Python

Clean Code in Python

This is the code repository for Clean Code in Python, published by Packt.

Refactor your legacy code base

What is this book about?

Python is currently used in many different areas such as software construction, systems administration, and data processing. In all of these areas, experienced professionals can find examples of inefficiency, problems, and other perils, as a result of bad code. After reading this book, readers will understand these problems, and more importantly, how to correct them.

This book covers the following exciting features: Set up tools to effectively work in a development environment Explore how the magic methods of Python can help us write better code Examine the traits of Python to create advanced object-oriented design Understand removal of duplicated code using decorators and descriptors Effectively refactor code with the help of unit tests Learn to implement the SOLID principles in Python

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

Setup

Create a virtual environment, and once activated run:

make setup

This will install the common dependencies. Besides this, each chapter might have additional ones, for which another make setup will have to be run inside that particular directory.

Each chapter has its corresponding directory given by its number.

Inside each chapter directory, tests can be run by:

make test

This requires the make application installed (in Unix environments). In environments without access to the make command, the same code can be tested by running the commands on the Makefile:

python -m doctest *.py
python -m unittest *.py

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

class Point:
    def __init__(self, lat, long):
        self.lat = lat
        self.long = long

Following is what you need for this book: This book will appeal to team leads, software architects and senior software engineers who would like to work on their legacy systems to save cost and improve efficiency. A strong understanding of Programming is assumed.

With the following software and hardware list you can run all code files present in the book (Chapter 1-10).

Software and Hardware List

Chapter Software required Hardware required
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Python 3.7 System with 4GB RAM
10 Docker System with 4GB RAM

Related products

Get to Know the Author

Mariano Anaya is a software engineer who spends most of his time creating software with Python and mentoring fellow programmers. Mariano's main areas of interests besides Python are software architecture, functional programming, distributed systems, and speaking at conferences.

He was a speaker at Euro Python 2016 and 2017. To know more about him, you can refer to his GitHub account with the username rmariano.

His speakerdeck username is rmariano.

Suggestions and Feedback

Click here if you have any feedback or suggestions.