pynd-large-codebases-using-libraries-glossary
pynd-large-codebases-using-libraries-glossary
1. Foundations
Exception PEPs (Python Enhancement Proposals) Type Hints
A special Python object that is raised A set of community driven guidelines that A simple way to add types to variables
when the program fails help Python developers understand key and methods.
language decisions and implement
Instantiation uniform code. Unified Modeling Language (UML)
Creating a new object in memory. A visual language for expressing
PEP-8 software structure, including objects,
Linter The Python style guide. class relationships, and sequences of
A tool that checks the quality of your tasks.
source code. Linters can check for a Raise an Exception
variety of errors, ranging from Disrupting the program by “throwing a
programmatic mistakes to stylistic issues. wrench in” the execution flow.
2. Building Modules
__init__.py Decorators Partial Import
Special file that declares that a directory Extends a function’s behavior without Pythonic concept to import only a
is a Python module. The code in needing to rewrite the entire function. specific method, class, or variable from
__init__.py is executed when the Written as @
decorator a module, instead of importing the
module is imported. entire module. (e.g., from src.module
Object-Oriented Programming (OOP) import utility).
Absolute Import A programming design pattern that
Pythonic concept to import a module by groups data attributes (instance Relative Import
searching for the module in the project’s variables) and related methods or Pythonic concept to import a module by
root folder (e.g. i
mport functions (instance methods) into o
bjects. searching for the module based on the
src.module.utility). location of the executed code—for
Overrides example, by searching in a file located in
Abstract Class During object inheritance, if a method the current directory, as in:
A partially defined class that defines a body is rewritten by a child object, it is module import utility
from .
common interface for other, concrete, considered an override. Common
classes. overrides include _
_eq__, __str__, and Static Method
__len__. A special instance method that does not
Class Method depend on any other instance methods
A special instance method that is used to or variables. It does not have a
generate new object instances of the reference to s elf. Decorated with
class. Decorated with @
classmethod. @static.
3. Using Libraries
Encapsulation requirements.txt Virtual Environment
Bundling of methods or features into a Commonly used filename for a list of all A Python module that creates a
new interface. python library dependencies. Generated segmented directory where Python
in the CLI with: modules can be installed without
Pip Installs Python (pip) pip freeze > requirements.txt interfering with system modules.
Python utility to install python packages Created in CLI with:
from PyPI and other repositories. (Note: Strategy Object python3 -m venv venv
The acronym "pip" is recursive, since it is Design pattern that provides a common
itself one of the words in the acronym!) interface for methods that have different
execution algorithms (For example,
Python Package Index (PyPI) methods for converting multiple types of
A repository of software for the Python units.)
programming language.
4. Python in Systems
Argparser Legacy Code Subprocess
Python module that simplifies the Software that exists within a system that Python module used to spawn system
creation of command-line tools with is not necessarily written in a desirable processes (e.g., legacy code).
input arguments. language, but cannot be replaced.
Command-Line Tool
A utility that can be executed from the
terminal window (shell or BASH).