Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Architecture Patterns

You're reading from   Python Architecture Patterns Master API design, event-driven structures, and package management in Python

Arrow left icon
Product type Paperback
Published in Jan 2022
Publisher Packt
ISBN-13 9781801819992
Length 594 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jaime Buelta Jaime Buelta
Author Profile Icon Jaime Buelta
Jaime Buelta
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Preface 1. Introduction to Software Architecture 2. Part I: Design FREE CHAPTER
3. API Design 4. Data Modeling 5. The Data Layer 6. Part II: Architectural Patterns
7. The Twelve-Factor App Methodology 8. Web Server Structures 9. Event-Driven Structures 10. Advanced Event-Driven Structures 11. Microservices vs Monolith 12. Part III: Implementation
13. Testing and TDD 14. Package Management 15. Part IV: Ongoing operations
16. Logging 17. Metrics 18. Profiling 19. Debugging 20. Ongoing Architecture 21. Other Books You May Enjoy
22. Index

Application example – Overview

In this book, we will be using an application as an example to demonstrate the different elements and patterns presented. This application will be simple but divided into different elements for demonstration purposes. The full code for the example is available on GitHub, and different parts of it will be presented in the different chapters. The example is written in Python, using well-known frameworks and modules.

The example application is a web application for microblogging, very similar to Twitter. In essence, users will write short text messages that will be available for other users to read.

The architecture of the example system is described in this diagram:

Diagram

Description automatically generated

Figure 1.2: Example architecture

It has the following high-level functional elements:

  • A public website in HTML that can be accessed. This includes functionality for login, logout, writing new micro-posts, and reading other users' micro-posts (no need to be logged in for this).
  • A public RESTful API, to allow the usage of other clients (mobile, JavaScript, and so on) instead of the HTML site. This will authenticate the users using OAuth and perform actions similar to the website.

These two elements, while distinct, will be made into a single application, as shown in the diagram. The front-facing part of the application will include a web server, as we saw in the LAMP architecture description, which has not been displayed here for simplicity.

  • A task manager that will execute event-driven tasks. We will add periodic tasks that will calculate daily statistics and send email notifications to users when they are named in a micro-post.
  • A database that stores all the information. Note that access to it is shared between the different elements.
  • Internally, a common package to ensure that the database is accessed correctly for all the services. This package works as a different element.
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image