𝔖 Scriptorium
✦   LIBER   ✦

πŸ“

Hands-On Enterprise Application Development with Python: Design data-intensive Application with Python 3

✍ Scribed by Saurabh Badhwar


Publisher
Packt Publishing
Year
2018
Tongue
English
Leaves
362
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Architect scalable, reliable, and maintainable applications for enterprises with Python

Key Features

  • Explore various Python design patterns used for enterprise software development
  • Apply best practices for testing and performance optimization to build stable applications
  • Learn about different attacking strategies used on enterprise applications and how to avoid them

Book Description

Dynamically typed languages like Python are continuously improving. With the addition of exciting new features and a wide selection of modern libraries and frameworks, Python has emerged as an ideal language for developing enterprise applications. Hands-On Enterprise Application Development with Python will show you how to build effective applications that are stable, secure, and easily scalable.

The book is a detailed guide to building an end-to-end enterprise-grade application in Python. You will learn how to effectively implement Python features and design patterns that will positively impact your application lifecycle. The book also covers advanced concurrency techniques that will help you build a RESTful application with an optimized frontend. Given that security and stability are the foundation for an enterprise application, you'll be trained on effective testing, performance analysis, and security practices, and understand how to embed them in your codebase during the initial phase. You'll also be guided in how to move on from a monolithic architecture to one that is service oriented, leveraging microservices and serverless deployment techniques.

By the end of the book, you will have become proficient at building efficient enterprise applications in Python.

What you will learn

  • Understand the purpose of design patterns and their impact on application lifecycle
  • Build applications that can handle large amounts of data-intensive operations
  • Uncover advanced concurrency techniques and discover how to handle a large number of requests in production
  • Optimize frontends to improve the client-side experience of your application
  • Effective testing and performance profiling techniques to detect issues in applications early in the development cycle
  • Build applications with a focus on security
  • Implement large applications as microservices to improve scalability

Who this book is for

If you're a developer who wants to build enterprise-grade applications, this book is for you. Basic to intermediate-level of programming experience with Python and database systems is required to understand the concepts covered in this book.

Table of Contents

  1. Using Python for Enterprise
  2. Design Patterns: Making a Choice
  3. Building for Large Scale Database Operations
  4. Dealing with Concurrency
  5. Building for Large Scale Request Handling
  6. Example: Building BugZot
  7. Building Optimized Frontends
  8. Writing Testable Code
  9. Profiling Applications for Performance
  10. Securing Your Application
  11. Taking the Microservices Approach
  12. Testing and Tracing in Microservices
  13. Going Serverless
  14. Deploying to the Cloud
  15. Enterprise Application Integration and its Patterns
  16. Microservices and Enterprise Application Integration

✦ Table of Contents


Cover
Title Page
Copyright and Credits
About Packt
Contributors
Table of Contents
Preface
Chapter 1: Using Python for Enterprise
Technical requirements
Recent developments in Python
Dropping backward compatibility
It's all Unicode
Support for type hinting
Where Python shines
The requirements of enterprise IT
Python in the enterprise ecosystem
Introducing BugZot – a RESTful bug tracker
Gathering requirements before development
Asking for the user requirements
Categorizing the requirements
Prioritizing the requirements
Generating the software requirement specification document
Summary
Questions
Further reading
Chapter 2: Design Patterns – Making a Choice
Technical Requirements
Design patterns
Classification of design patterns
Defining the choice of design patterns
Object-oriented Python
The basic OOP principles
Encapsulation
Composition
Inheritance
Multiple inheritance in Python
Method resolution order in multiple inheritance
Utilizing mixins
Abstract base classes
Metaclasses
The Singleton pattern
The call magic method
The Factory pattern
The Model-View-Controller pattern
Controller
Model
View
Summary
Questions
Chapter 3: Building for Large-Scale Database Operations
Technical requirements
Database andΒ object relational mappers
Setting up SQLAlchemy
Building optimal database models
Issues with our model definition
Optimizing our models
Taking advantage of indexes
Maintaining database consistency
Utilizing transactions to maintain consistency
Understanding lazy loading versus eager loading
Using relationships
Lazy loading
Eager loading
Optimizing data loading
Utilizing caching
Caching at the database level
Caching at the block level
Using user-level caching
Summary
Questions
Chapter 4: Dealing with Concurrency
Technical requirements
The need for concurrency
Concurrency in GUI applications
Concurrency in enterprise applications
Concurrent programming with Python
Concurrency with multithreading
Thread synchronization
Re-entrant locks
Condition variables
Common pitfalls with multithreading
Race conditions
Deadlocks
The story of GIL
Concurrency with multiprocessing
Python multiprocessing module
Synchronizing processes
Summary
Questions
Chapter 5: Building for Large-Scale Request Handling
Technical requirements
The problems of accommodating increased concurrency
The multiple options to scale up
Engineering the application for scalability
Controlling the concurrency
Using thread pools for handling incoming connections
Asynchronous programming with AsyncIO
AsyncIO terminology
Event loop
Co-routines
Tasks
Writing a simple Python AsyncIO program
Implementing a simple socket server with AsyncIO
Boosting the application concurrency
Running behind a reverse proxy
Improved security
Improved connection handling
Resource caching
Serving static resources
Summary
Questions
Chapter 6: Example – Building BugZot
Technical requirements
Defining the requirements
Entering the development phase
Setting up the development environment
Setting up the database
Setting up the virtual environment
Structuring our project
Initializing the Flask project
Creating the configuration
Developing database models
Migrating the database models
Building the views
Developing the index view
Getting the index view to render
Building the user registration view
Deploying for concurrent access
Setting up Gunicorn
Setting up Nginx as reverse proxy
Establishing communication between Nginx and Gunicorn
Summary
Questions
Chapter 7: Building Optimized Frontends
Technical requirements
The need for optimizing frontends
Components of an optimized frontend
What causes frontend issues
Optimizing the frontend
Optimizing resources
Fetching CSS in parallel by avoiding CSS imports
Bundling JavaScript
Utilizing client-side caching
Setting application-wide cache control
Setting request level cache control
Utilizing web storage
Working with local web storage
Working with session storage
Summary
Questions
Chapter 8: Writing Testable Code
Technical requirements
The importance of testing
The different kinds of testing
Unit testing
Integration testing
Building an application with testing in mind
Test-driven development
Writing unit tests
Writing unit tests with Python unittest
Writing unit tests with pytest
Let's set up pytest
Writing our first test with pytest
Writing functional tests with pytest
Summary
Questions
Chapter 9: Profiling Applications for Performance
Technical requirements
Behind the scenes of performance bottlenecks
Looking at the causes of performance bottlenecks
Probing an application for performance issues
Writing performance benchmarks
Writing our first benchmark
Writing an API benchmark
Doing component-level performance analysis
Measuring slow operations with timeit
Profiling with cProfile
Profiling for memory usage with memory_profiler
Collecting live performance data
Logging performance metrics
Avoiding performance bottlenecks
Summary
Questions
Chapter 10: Securing Your Application
Technical requirements
Enterprise applicationΒ security
The importance of enterprise security
Challenges in system security
Taking a look at the attack vectors
Security issues with native applications
Security issues with web applications
Security anti-patterns
Not filtering user input
Storing Sensitive Data Unencrypted
Ignoring bound-checking
Not keeping the libraries updated
Giving full privileges of the database to a single user
Improving your application's security
Summary
Questions
Further reading
Chapter 11: Taking the Microservices Approach
Technical requirements
The shift toward microservices
Monolithic development model versus microservices
Advantages of the microservices architecture
Guidelines for microservice development
Service-level agreements in microservices
Building your first microservices application
The user microservice
The to-do manager service
Service discovery in microservices
Service registry inside microservices
Client-side service discovery
Server-side service discovery
API gateways in microservices
Asynchronous communication in microservices
Message queues for microservices communication
Summary
Questions
Further reading
Chapter 12: Testing and Tracing in Microservices
Technical requirements
Testing in the microservices world
Unit testing in microservices
Functionality testing in microservices
Integration testing in microservices
End-to-end testing in microservices
Scalability testing
Challenges in microservices testing
Tracing requests inside microservices
The OpenTracing standard
Implementing tracing inside ToDo manager
Distributed tracing
Benefits of distributed tracing
Summary
Questions
Chapter 13: Going Serverless
Technical requirements
The serverless approach to application development
Components of serverless architecture
Backend as a service
Function as a service
The restrictions on state management
Restrictions on execution times
Executing functions inside FaaS
API gateways in the serverless architecture
Understanding the execution of a serverless application
Cold-starting a function
Hot-starting a function
Building our first serverless application
A quick introduction to Apache OpenWhisk
Setting up the development environment
Building our configuration file
Integrating with the GitHub API
Getting the code ready to run with OpenWhisk
Taking the final steps toward deployment
Deploying to OpenWhisk
Understanding the execution of application Inside Openwhisk
Advantages of going serverless
Summary
Questions
Further reading
Chapter 14: Deploying to the Cloud
Technical requirements
Deploying enterprise applications
Making a choice about the deployment strategy
The different deployment strategies
Recreated deployments
Rolling deployments
Blue/green deployments
Canary deployments
A/B deployments
Shadow deployments
Making a choice of infrastructure
The traditional infrastructure
Containerized approach toward application packaging
The move toward the cloud
The different types of cloud deployments
Private clouds
Public clouds
Hybrid clouds
Summary
Questions
Chapter 15: Enterprise Application Integration and its Patterns
Technical requirements
The need for EAI
Point-to-point integration
Moving towardsΒ EAI
The traditional approach to EAI
The introduction of theΒ ESB
Patterns in EAI
Integration patterns
Mediation pattern
Federation pattern
Access patterns
Asynchronous access patterns
Synchronous access patterns
Issues in EAI
Summary
Questions
Chapter 16: Microservices and Enterprise Application Integration
Technical requirements
Microservices and the changing EAI landscape
Challenges of traditional EAI in microservices
Point-to-point integration of microservices
Integrating microservices using the ESB
Utilizing API gateways for the integration of microservices
Transformation of the ESB
Rethinking EAI in microservices
Summary
Questions
Assessment
Other Books You May Enjoy
Leave a review – let other readers know what you think
Index


πŸ“œ SIMILAR VOLUMES


Hands-On Enterprise Application Developm
✍ Saurabh Badhwar πŸ“‚ Library πŸ“… 2018 πŸ› Packt Publishing 🌐 English

<span><p><b>Architect scalable, reliable, and maintainable applications for enterprises with Python</b></p><h4>Key Features</h4><ul><li>Explore various Python design patterns used for enterprise software development </li><li>Apply best practices for testing and performance optimization to build sta

Hands-On Application Development with Py
✍ Bruce M. Van; Horn II Quan Nguyen πŸ“‚ Library πŸ“… 20232 πŸ› Packt 🌐 English

Unleash the power of PyCharm to craft business, scientific, and web applications in Python with this definitive guide Key Features Learn basic to advanced PyCharm concepts to improve developer efficiency on your Python projects Learn with practical examples that focus on efficient application d

Python Desktop Applications with Kivy: D
✍ Verdugo, Leire πŸ“‚ Library πŸ“… 2024 🌐 English

Python is one of the most versatile high-level programming languages ever developed. Rather than having to jump into strict syntax rules, Python reads like English and is simple to understand for someone new to programming. This allows you to obtain a basic knowledge of coding practices without havi

Hands-On Bitcoin programming with Python
✍ Harish Kumar Garg πŸ“‚ Library πŸ“… 2018 πŸ› Packt Publishing 🌐 English

Bitcoin is a cryptocurrency that's changing the face of online payments. This book will help you understand everything related to Bitcoin architecture. By the end, you'll be able to mine Bitcoins, accept Bitcoin payments, and work with the basics of Blockchain technology to create simple distributed

Hands-On Bitcoin Programming with Python
✍ Harish Kumar Garg πŸ“‚ Library πŸ“… 2018 πŸ› Packt Publishing 🌐 English

<p><b>Simplified Python programming for Bitcoin and blockchain</b></p><h4>Key Features</h4><ul><li>Build Bitcoin applications in Python with the help of simple examples</li><li>Mine Bitcoins, program Bitcoin-enabled APIs and transaction graphs, and build trading bots</li><li>Analyze Bitcoin transact