Learning Python Application Development
eBook - ePub

Learning Python Application Development

Ninad Sathaye

Condividi libro
  1. 454 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Learning Python Application Development

Ninad Sathaye

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Take Python beyond scripting to build robust, reusable, and efficient applications

About This Book

  • Get to grips with Python techniques that address commonly encountered problems in general application development.
  • Develop, package, and deploy efficient applications in a fun way.
  • All-practical coverage of the major areas of application development, including best practices, exception handling, testing, refactoring, design patterns, performance, and GUI application development.

Who This Book Is For

Do you know the basics of Python and object oriented programming? Do you want to go an extra mile and learn techniques to make your Python application robust, extensible, and efficient? Then this book is for you.

What You Will Learn

  • Build a robust application by handling exceptions.
  • Modularize, package, and release the source distribution.
  • Document the code and implement coding standards.
  • Create automated tests to catch bugs in the early development stage.
  • Identify and re-factor badly written code to improve application life.
  • Detect recurring problems in the code and apply design patterns.
  • Improve code efficiency by identifying performance bottlenecks and fixing them.
  • Develop simple GUI applications using Python.

In Detail

Python is one of the most widely used dynamic programming languages, supported by a rich set of libraries and frameworks that enable rapid development. But fast paced development often comes with its own baggage that could bring down the quality, performance, and extensibility of an application. This book will show you ways to handle such problems and write better Python applications.

From the basics of simple command-line applications, develop your skills all the way to designing efficient and advanced Python apps. Guided by a light-hearted fantasy learning theme, overcome the real-world problems of complex Python development with practical solutions. Beginning with a focus on robustness, packaging, and releasing application code, you'll move on to focus on improving application lifetime by making code extensible, reusable, and readable. Get to grips with Python refactoring, design patterns and best practices. Techniques to identify the bottlenecks and improve performance are covered in a series of chapters devoted to performance, before closing with a look at developing Python GUIs.

Style and approach

The book uses a fantasy game theme as a medium to explain various topics. Specific aspects of application development are explained in different chapters. In each chapter the reader is presented with an interesting problem which is then tackled using hands-on examples with easy-to-follow instructions.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Learning Python Application Development è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Learning Python Application Development di Ninad Sathaye in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Sviluppo di applicazioni. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2016
ISBN
9781785889196
Edizione
1
Argomento
Informatica

Learning Python Application Development


Table of Contents

Learning Python Application Development
Credits
Disclaimers
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
Important things to note
Very important note for e-book readers
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Developing Simple Applications
Important housekeeping notes
Installation prerequisites
Installing Python
Option 1 – official distribution
Option 2 – bundled distribution
Python install location
Unix-like operating systems
Windows OS
Verifying Python installation
Installing pip
Installing IPython
Choosing an IDE
The theme of the book
Meet the characters
Simple script – Attack of the Orcs v0.0.1
The game – Attack of the Orcs v0.0.1
Problem statement
Pseudo code – version 0.0.1
Reviewing the code
Running Attack of the Orcs v0.0.1
Using functions – Attack of the Orcs v0.0.5
Revisiting the previous version
Pseudo code with attack feature – Version 0.0.5
Reviewing the code
Running Attack of the Orcs v0.0.5
Using OOP – Attack of the Orcs v1.0.0
Prioritize the feature requests
Problem statement
Redesigning the code
Painting the big picture
Pseudo UML representation
Understanding the pseudo UML diagram
Reviewing the code
Running Attack of the Orcs v1.0.0
Abstract base classes in Python
Exercise
Summary
Very important note for e-book readers
2. Dealing with Exceptions
Revisiting Attack of the Orcs v1.0.0
Debugging the problem
Fixing the bugs…
Exceptions
What is an exception?
Most common exceptions
Exception handling
Raising and re-raising an exception
The else block of try…except
finally...clean it up!
Back to the game – Attack of the Orcs v1.1.0
Preparatory work
Adding the exception handling code
Running Attack of the Orcs v1.1.0
Defining custom exceptions
Preparatory work
Custom exception – The problem
Writing a new exception class
Expanding the exception class
Inheriting from the exception class
Exercise
Summary
3. Modularize, Package, Deploy!
Selecting a versioning convention
Serial increments
Using a date format
Semantic versioning scheme
Modularizing the code
Attack of the Orcs v2.0.0
Creating a package
Importing from the package
Releasing the package on PyPI
Prepare the distribution
Step 1 – Setting up the package directory
Step 2 – Writing the setup.py file
Step 3 – Updating the README and LICENSE.txt files
Step 4 – Updating the MANIFEST.in file
Step 5 – Build a deployment-ready distribution
Uploading the distribution
Step 1 – Creating an account on PyPI test website
Step 2 – Creating a .pypirc file
Step 3 – Register your project
Step 4 – Uploading the package
A single command to do it all
Installing your own distribution
Using a private PyPI repository
Step 1 – Installing pypiserver
Step 2 – Building a new source distribution
Step 3 – Starting a local server
Step 4 – Installing the private distribution
Making an incremental release
Packaging and uploading the new version
Upgrading the installed version
Version controlling the code
Git resources
Installing Git
Configuring your identity
Basic Git terminology
Creating and using a Git repository
Creating a bare remote repository
Clone the repository
Copying the code to the cloned repository
Staging the code and committing
Pushing the changes to the central repository
Using GUI clients for Git
Exercise
Summary
4. Documentation and Best Practices
Documenting the code
Docstrings
Introduction to reStructuredText
Section headings
Paragraphs
Text styles
Code snippets
Mathematical equations
Bullets and numbering
Dosctrings using RST
Docstring formatting styles
Automatically creating docstring stubs
Generating documentation with Sphinx
Step 1 – Installing Sphinx using pip
Step 2 – cd to the source directory
Step 3 – Running sphinx-quickstart
Step 4 – Updating conf.py
Step 5 – Running sphinx-apidoc
Step 6 – Building the documentation
Using sphinx-build
Using Makefile
Python coding standards
Code analysis – How well are we doing?
Code analysis using IDE
Pylint
Pylint in action
PEP8 and AutoPEP8
Exercise
Summary
5. Unit Testing and Refactoring
This is how the chapter is organized
Important housekeeping notes
Why test?
A new feature was requested
You implemented this feature
But something wasn't right...
It required thorough testing
Unit testing
Python unittest framework
Basic terminology
Creating tests with unittest.TestCase
Controlling test execution
Using unittest.TestSuite
Writing unit tests for the application
Set...

Indice dei contenuti