| title | Pragmatic Python: Welcome to the Jungle |
|---|---|
| marp | true |
| html | true |
| theme | gaia |
November 2, 2021 Joe Riddle
of or relating to a practical point of view or practical considerations.
- dictionary.com
relating to matters of fact or practical affairs often to the exclusion of intellectual or artistic matters : practical as opposed to idealistic.
- merriam-webster.com
dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations.
- Oxford Languages
Teach user group members practical skills to create, manage, and host their own Python project.
- 5-6 meetups
- Later topics may include:
- Managing Python dependencies
- Publishing Python packages
- Running Python projects in "prod"
- Testing and linting
- Intro to machine learning
- Django
- Talk / live code for ~60 minutes
- Pair programming for ~20 minutes
- Lightning presentations for ~15-20 minutes
- What is Python?
- Installing Python
- Running Python
- Anatomy of a module
- Anatomy of a package
- Using the standard library
- Using common packages
Craigslist CLI tool
- Search cars for sale
- Find lowest priced cars
- Save car images
- Search multiple Craigslist regions at once
- Interpreted
- Dynamic
- Strong
- Indented
- Beginner-friendly
- Object-oriented
Python 2 has been sunset.
In 2021, this is a non-issue.
https://www.python.org/downloads/windows/ or
>choco install python$ sudo apt-get update
$ sudo apt-get install pythonhttps://opensource.com/article/19/5/python-3-default-mac
tl;dr: use pyenv or Homebrew. Don't use the built-in Python.
Read-Eval-Print-Loop
Integrated Development and Learning Environment Python-specific
Integrated Development Environment VS Code, PyCharm
A module is a file containing Python definitions and statements.
https://docs.python.org/3/tutorial/modules.html
script.py
import sys # <-- importing a package
def main(): # <-- function declaration
car = sys.argv[1]
print(f"Your favorite car is a {car}!") # <-- an "f-string"
if __name__ == "__main__": # <-- only execute if run as the entry point
main() # <-- calling a function$ python script.py "Mitsubishi Montero Sport" # <-- running a python module
Your favorite car is a Mitsubishi Montero Sport!Packages are a way of structuring Python’s module namespace by using “dotted module names”.
https://docs.python.org/3/tutorial/modules.html#packages
app/
├── __init__.py
├── __main__.py
└── app.py
__init__.py
# marks directory as a python package__main__.py
# executed when the package itself is invoked using -m
from .app import run
if __name__ == "__main__":
run()app.py
import sys
def main():
car = sys.argv[1]
print(f"Your least favorite car is a {car}!")$ python -m app "Chrysler PT Cruiser"
Your least favorite car is a Chrysler PT Cruiser!- Search cars for sale
- Find lowest priced cars
- Save car images
- Search multiple Craigslist regions at once
Search cars for sale
$ python -m app \
"https://spokane.craigslist.org/d/cars-trucks-by-owner/search/cto?query=montero"
mitsubishi montero XlS 2002
Montero/Pajero SR Safari roof 1998
2002 Mitsubishi Montero Sport 2002Find lowest priced cars
$ python -m app --lowest \
"https://spokane.craigslist.org/d/cars-trucks-by-owner/search/cto?query=montero"
2002 Mitsubishi Montero Sport is the lowest priced vehicle at $650Save car images
$ python -m app --images --output ./out \
"https://spokane.craigslist.org/d/cars-trucks-by-owner/search/cto?query=montero"
$ ls ./out
mitsubishi-montero-XlS-2002.jpg
Montero-Pajero-SR-Safari-roof-1998.jpg
2002-Mitsubishi-Montero-Sport-2002.jpgSearch multiple Craigslist regions at once
$ python -m app --query "montero" --locations "spokane" "seattle"mitsubishi montero XlS 2002
Montero/Pajero SR Safari roof 1998
2002 Mitsubishi Montero Sport 2002
2 rare Mitsubishi Monteros Gen 1
2003 Mitsu Montero Sport XLS
2002 Mitsubishi Montero Sport Mechanics Special
...
- Filter posts from within the last week
- Scrape data from item details page
- Calculate average price for vehicle
- Create UI using
tkinter - Read and parse
robots.txt - ...
Find a fellow Pythonista and tackle an improvement for the next 20 minutes.
https://code.visualstudio.com/learn/collaboration/live-share
Showcase the improvement you and your buddy made!
<style scoped> ul { columns: 2; } ul ul { columns: 1; } </style>
- Blogs
- Books
- Conferences (watch previous years!)
Thank you for coming! Join us next time for