Course on how to write code and programme in Python ( London )
9:30am - 5pm
Lets talk about the Python LanguageIn this lesson, we will do a quick review of the Python language. While many students will have experience with the Python language, ensuring that everyone has a solid understanding of all the language features will serve the class well as we delve into deeper topics. We review basic Python programs, collections, functions, classes, and iteration among other topics.
File I/OWorking with files is fundamental to any programming language. Python has rich support for working with files including simple utility methods to load all data as well as more efficient streaming APIs. Beyond reading and writing text or bytes, we will explore intrinsic support for common file formats (JSON and XML) as well as object serialization via pickle. Finally, we look at two classes which provide access to files, directories, and more: os and sys.
Pythonic / Idiomatic PythonTo say that code is Pythonic is to say that it uses Python idioms well, that it is natural or shows fluency in the language, that it conforms with Python's minimalist philosophy and emphasis on readability. There are both tools and techniques which help you write more Pythonic code and we will cover them in this lesson. We start by looking at the recommended code styles and conventions. We will also cover the code analysis tool PyLint.
Database access (Relational)Almost all applications depend on data in databases (either RDBMSes or NoSQL DBs). This lesson on accessing relational databases from Python will introduce database programming in Python. You will learn about working with the Python DB-API. We discuss connecting to databases, querying data, iterating over cursors, as well as updating data. Finally you will see how to handle the various database errors that arise when working with the API.Database access via SQLAlchemy (Core model)SQLAlchemy is the Python SQL toolkit and Object Relational Mapper (ORM) that gives application developers the full power and flexibility of SQL. It provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language. In this module we will explore SQLAlchemy and learn to leverage its Core data model (sitting between raw SQL and the ORM) to build data-driven applications.Database access via SQLAlchemy (ORM model)SQLAlchemy provides a world-class ORM (Object-Relational Mapper) which builds upon its general Core programming model. In this session we will see how to map objects and classes to tables. How to customize the tables with things like uniqueness constrains, default values, and relationships between classes. You will see how to express queries in terms of Python objects and classes as well as map classes to and from tables with ease using SQLAlchemy’s ORM.
Database access (NoSQL / MongoDB)Almost all applications depend on data in databases (either RDBMSes or NoSQL DBs). This lesson on accessing NoSQL databases from Python will show you not only how but why you want to work with NoSQL databases in Python. Because we want to have hands-on demonstrations of all techniques in this course, we will choose a specific NoSQL database to work with: MongoDB, the most popular NoSQL database. We start by giving you a brief introduction to NoSQL and MongoDB before quickly moving on to the MongoDB Python API: PyMongo. We will discuss object serialization, reading existing data, writing and updating data among other topics you will need to be successful with MongoDB from Python.Real world MongoDB with MongoEnginePython and PyMongo allow direct programming against MongoDB from Python. This is most appropriately compared to programming at the level of raw SQL for RDBMSes. That level is a necessary building block, but for most applications working at a higher level and building upon custom classes is more appropriate. This module explores one of the most popular ODMs (object-data mappers) for Python and MongoDB: MongoEngine. You will learn to build out your data model in rich classes and map them to and from MongoDB with ease and incredible performance.Building redistributables (modules and packages)Python has several mechanisms of redistributing reusable libraries and classes and building and working with these is what this lesson is all about. You will learn the difference between modules and packages. We will be creating packages and export types from them using __init__.py. We will discuss when and how you can convert large modules into packages for maintainability. There are some simple steps to take to make your script both directly executable and usable via a module. Finally, we will cover deploying applications including topics such as py2exe, pre-compiled python .pyc files, and pyinstaller