Skip to content

Latest commit

 

History

History
81 lines (69 loc) · 2.53 KB

README.md

File metadata and controls

81 lines (69 loc) · 2.53 KB

python-modules-talk

A talk to be given at the Django and Python meetup on 1 Sep 2016

Blurb

Python is inherently modular, i.e. even basic data types can be considered as objects. Modules extend this idea to allow a program to be thought of as a hierarchy of objects. From a software design point of view, entire Python programs can be turned into modules and be used as such, in whole or in part.

This talk will cover some basics about Python modules as well as the lessons learned from developing Shepherd, a modular tool for controlling a stable of hosts listed in an Ansible inventory file.

A basic knowledge of Python programming would be helpful in understanding this talk, but is not essential.

After viewing this talk, people should expect to be able to design (or rewrite!) their programs and libraries in a highly modular fashion, thereby making documentation, debugging and maintenance easier.

Outline

  1. Introduction
  2. Background
  3. Python version disclaimer
  4. Overview
  5. Features
  6. import blah
  7. from fun import Ren, Stimpy
  8. Module Semantics
  9. Implicit namespaces
  10. sys.path
  11. $PYTHONPATH
  12. name
  13. from __future__ import absolute_import 1. from . import helper 1. from .xyz import helper as xyz_helper
  14. Packages
  15. Submodules
  16. init.py
  17. main.py
  18. Module contents
  19. all
  20. path
  21. The dir() Function
  22. Packaging
  23. Handles Dependencies and Versioning
  24. https://packaging.python.org/
  25. Projects 1. Create with help of setuptools 1. Install locally using pip
  26. PyPI is the online archive, formerly known as cheeseshop
  27. Source Distributions 1. Create using setuptools 1. Install locally or elsewhere using pip 1. Publish to PyPI using twine (not setuptools)
  28. Package files -- .whl 1. Create using bdist_wheel 1. Publish to PyPI using twine
  29. Implications
  30. Microservices
  31. Gotchas
  32. Error in import doesn't stop namespace creation

Presenter bio

Alastair is a Software Engineer and system administrator by trade. He has a BSc in Computer Science from Curtin University.

His computer-related interests lie in various areas within his trade; suffice to say that he is a "geek of many colours". :) Alastair is a die-hard FOSS user and Linux fan.

He is also a freelancer with his own business. Warpspace IT is a consultancy with a fairly broad focus on the technical side of IT.

Slides

TBA