Preface

Python Microservices Development introduces the design and creation of a microservice-based application using the popular Python programming language, and the Quart web framework. In this book, you will learn about microservice architecture and how it differs from the traditional monolithic approach, what the benefits are, as well as potential trouble that needs overcoming.

Who this book is for

This book is for people familiar with the fundamentals of the Python programming language who want to start writing web services, or who have inherited a web service they want to modernize. It is expected that the reader will be familiar with simple Python structures such as functions and loops, as well as some more advanced features such as decorators. Some familiarity with using web applications would be helpful, although the fundamentals of application design are covered.

What this book covers

Chapter 1, Understanding Microservices, introduces the concepts behind microservices, the differences between monolithic applications and microservices, common benefits and pitfalls, as well as testing and scaling.

Chapter 2, Discovering Quart, covers the Quart web framework and the ways in which it can respond to requests, create templated documents, act as middleware, handle errors, and read configuration.

Chapter 3, Coding, Testing, and Documentation: the Virtuous Cycle, teaches you about the different types of testing that are possible, what benefits each type has, and how to set up automatic testing, as well as generating documentation in CI pipelines.

Chapter 4, Designing Jeeves, looks at Jeeves, which is the sample application we use in this book to explain the various concepts behind microservices. We introduce what we need Jeeves to do and describe a monolithic approach to application design, covering the web API interface, database use, and worker pools.

Chapter 5, Splitting the Monolith, builds on the monolithic Jeeves described in previous chapter. This chapter offers guidance on how to identify components that may be good microservices, measuring the effects of changes on the software architecture, and how to cleanly migrate features to new microservices.

Chapter 6, Interacting with Other Services, explains how to make web requests to other services, how to configure and decide where to send those queries, and how to cache results, as well as make the data transfer more efficient.

Chapter 7, Securing Your Services, looks at how authentication, tokens, encryption, and security vulnerabilities are all essential topics to consider for any service, and here we build an authentication microservice for Jeeves, as well as discuss various things to consider when making an application secure against attack.

Chapter 8, Making a Dashboard, discusses how many applications will have a human view. In this chapter we add a dashboard to Jeeves so that it can be controlled using a ReactJS application, as well as discussing where best to add the front-end into the microservice architecture.

Chapter 9, Packaging and Running Python, shows how, once created, an application needs to be packaged so that it can be deployed and run. In this chapter, we will learn about creating and publishing Python packages, as well as managing dependencies.

Chapter 10, Deploying on AWS, looks at how cloud services provide a flexible platform to run a web service. This chapter covers creating containers for our application and deploying it in Amazon Web Services.

Chapter 11, What's Next?, summarizes the main things we have learned so far, and the topics that would make good further reading, as well as technologies that will prove useful for different types of application.

To get the most out of this book

Readers will find the book easier to follow with some Python programming experience, or experience in a very similar programming language. The basics of Python are not covered, and for the fundamentals we recommend a book such as Learn Python Programming, also from Packt Publishing.

Running the code samples from this book requires a computer with Python 3.8 or greater installed on it. Python is available for free for all popular operating systems, such as Windows, macOS and Linux, among others.

The author recommends not only running the code samples, but also experimenting with them to try different things out.

Download the example code files

The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Python-Microservices-Development-2nd-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781801076302_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example; " The __name__ variable, whose value will be __main__ when you run that single Python module, is the name of the application package."

A block of code is set as follows:

@app.route('/api', methods=['POST', 'DELETE', 'GET']) 
def my_microservice(): 
    return {'Hello': 'World!'}

Any command-line input or output is written as follows:

pip install quart

Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes. For example: "There are many great synchronous frameworks to build microservices with Python, like Bottle, Pyramid with Cornice, or Flask."

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected], and mention the book's title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book we would be grateful if you would report this to us. Please visit http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packtpub.com.

Share your thoughts

Once you've read Python Microservices Development, Second Edition, we'd love to hear your thoughts! click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we're delivering excellent quality content.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.71.237