❮ Index
❯
TOC: Python
- PyCharm
- Visual Studio Code
- PyPi - Python Package Index
- SQLAlchemy
- SQLAlchemy hierarchy
- SQLAlchemy engine
- SQLAlchemy autocommit
- SQLAlchemy engine CREATE TABLE
- SQLAlchemy engine INSERT
- SQLAlchemy engine SELECT
- SQLAlchemy engine SELECT all
- SQLAlchemy engine SELECT fetchall
- SQLAlchemy engine SELECT aggregate
- SQLAlchemy engine SELECT IN
- SQLAlchemy engine SELECT IN with placeholders
- SQLAlchemy engine connection
- SQLAlchemy engine transaction
- SQLAlchemy engine using context managers
- Exercise: Create table
- SQLAlchemy Metada
- SQLAlchemy types
- SQLAlchemy ORM - Object Relational Mapping
- SQLAlchemy ORM create
- SQLAlchemy ORM schema
- SQLAlchemy ORM reflection
- SQLAlchemy ORM INSERT after automap
- SQLAlchemy ORM INSERT
- SQLAlchemy ORM SELECT
- SQLAlchemy ORM SELECT cross tables
- SQLAlchemy ORM SELECT and INSERT
- SQLAlchemy ORM UPDATE
- SQLAlchemy ORM logging
- Solution: Create table
- Exercise: Inspector
- SQLAlchemy CREATE and DROP
- SQLAlchemy Notes
- SQLAlchemy Meta SQLite CREATE
- SQLAlchemy Meta Reflection
- SQLAlchemy Meta INSERT
- SQLAlchemy Meta SELECT
- MongoDB
- MongoDB CRUD
- Install MongoDB support
- MongoDB in Docker compose
- Python MongoDB drop database
- Python MongoDB insert
- MongoDB CLI
- Python MongoDB find
- Python MongoDB find refine
- Python MongoDB update
- Python MongoDB remove (delete)
- Python MongoDB replace
- Python MongoDB upsert
- Python Mongodb: TypeError: upsert must be True or False
- Python MongoDB Async with motor - connect
- Python MongoDB Async with motor - insert and find
- Redis
- Web client - web scraping
- get HTML page using urllib
- Download image using urllib
- get HTML page using requests
- Download image using requests
- Download image as a stream using requests
- Download zip file using requests
- Extract zip file
- Beautiful Soup to parse HTML
- requests - JSON - API
- httpbin.org
- requests get from httpbin - JSON
- requests get IP from httpbin - JSON
- requests get JSON User-Agent
- requests change User-Agent
- requests get header
- requests change header
- requests post
- Interactive Requests
- Download the weather - scraping
- Download the weather - API call with requests
- Download the weather - API call with requests
- Tweet
- bit.ly
- API config file
- Exercise: Combine web server and client
- Python Web server
- Networking
- Interactive shell
- Testing Demo
- Testing Flask
- How do you test your code?
- What is testing?
- What is testing really?
- Testing demo tools
- Testing demo methodology
- Testing demo - AUT - Application Under Test
- Testing demo - use the module
- Testing demo: doctest
- Testing demo: doctest with failure
- Testing demo: Unittest success
- Testing demo: Unittest failure
- Testing demo: pytest using classes
- Testing demo: pytest using classes - failure
- Testing demo: pytest without classes
- Testing demo: pytest without classes failure
- Testing demo: Failure in one sub
- Testing demo: pytest run doctests
- Testing demo: pytest run unittest
- Test demo: test coverage
- Exercise: Testing demo - anagrams
- Exercise: Test previous solutions
- Solution: Testing demo
- GitHub
- GitHub data
- GitHub API: REST vs GraphQL
- Where is it used
- GitHub get organization members
- Details about an orgarnization REST
- Details about an user REST
- REST - List of repositories by organization (pagination!)
- REST - List of reposistories by user (pagination!)
- GraphQL - List repositories by organization
- GitHub API KEY (PERSONAL TOKEN)
- GitHub REST API
- GitHub REST API execute query
- GitHub API GraphQL
- GitHub GraphQL explorer
- GitHub GraphQL execute query
- GitHub GraphQL execute query async
- GitHub GraphQL who am i
- GitHub GraphQL list my repositories
- GitHub GraphQL list of repositories by username
- GitHub GraphQL list issues by username
- GitHub GraphQL list issues using parameter
- GitHub GraphQL list issues using several parameters
- GitHub GraphQL contribution counts
- GitHub GraphQL list Pull-Requests
- GitHub GraphSQL paging using cursor
- GitHub GraphQL activities
- Types in Python
- Testing Intro
- Logging
- Closures
- Counter local - not working
- Counter with global
- Create incrementors
- Create internal function
- Create function by a function
- Create function with parameters
- Counter closure
- Make incrementor with def (closure)
- Make incrementor with lambda
- Exercise: closure bank
- Exercise: counter with parameter
- Solution: closure bank
- Solution: counter with parameter
- Decorators
- Decorators: simple example
- Decorators - Flask
- Decorators - Pytest
- Decorators caching - no cache
- Decorators caching - with cache
- LRU - Least recently used cache
- LRU - Least recently used cache
- OOP - classmethod - staticmethod
- Use cases for decorators in Python
- Function assignment
- Function assignment - alias print to say
- Function assignment - don't do this
- Passing functions as parameters
- Traversing directory tree
- Declaring Functions inside other function
- Returning a new function from a function
- Returning a closure
- Decorator
- Decorator Demo
- Decorator to register function
- A recursive Fibonacci
- trace fibo
- tron decorator
- Decorate with direct call
- Decorate with parameter
- Decorator accepting parameter
- Decorate function with any signature
- Decorate function with any signature - implementation
- Decorate function with any signature - skeleton
- Decorate function with any signature - skeleton with name
- Functool - partial
- Exercise: Logger decorator
- Exercise: decorators decorator
- Solution: Logger decorator
- Solution: Logger decorator (testing)
- Solution decorators decorator
- A list of functions
- Context managers (with statement)
- Why use context managers?
- Using Context Manager
- Context Manager examples
- cd in a function
- open in function
- open in for loop
- open in function using with
- Plain context manager
- Param context manager
- Context manager that returns a value
- Use my tempdir - return
- Use my tempdir - exception
- cwd context manager
- tempdir context manager
- Context manager with class
- Context managers with class
- Context manager: with for file
- With - context managers
- Exercise: Context manager
- Exercise: Tempdir on Windows
- Solution: Context manager
- Advanced lists
- Warnings
- CSV
- What is a CSV file?
- CSV file without title row
- CSV file with header
- Read CSV file into lists
- CSV with newlines missing closing quote
- CSV to dictionary
- CSV Attributes
- CSV dialects
- Reading CSV the naive way
- CSV with quotes and newlines
- Reading a CSV file
- Exercise: CSV as dictionary of dictionaries
- Exercise: CSV as dictionary of tuples of dictionaries
- Exercise: count row length in csv files
- Solution: CSV as dictionary of dictionaries
- Solution: CSV as dictionary of tuples of dictionaries
- Solution: count row length in csv files
- Excel
- XML
- Matplotlib
- Seaborn
- Jupyter notebooks
- What is Jupyter Notebook?
- Jupyter on Windows
- Jupyter on Linux and OSX
- Jupyter New notebook
- Jupyter Notebook file format
- Jupyter notebook edit and command mode
- Jupyter notebook Intellisense (TAB completition)
- Jupyter add
- Planets
- Jupyter input
- File chooser
- IPy Widgets
- Jupyter Notebook and Markdown
- Latex in Jupyter Notebook
- Jupyter StackOverflow
- Use SciPy image
- Create Random image
- Load image using OpenCV
- Genes using Jupyter
- More Jupyter examples
- Jupyter Notebook: run on other port
- Jupyter Notebook: public IP
- Other Jupyter Notebook Kernels
- Jupyter Notebook convert to other format (nbconvert)
- Jupyter Notebook extensions
- Jupyter notebook Checkpoints
- Jupyter notebook autoreload
- Tox
- Selenium
- Playwright
- Advancted functions
- Variable scopes
- Name resolution order (LEGB)
- Scoping: global seen from fuction
- Assignment creates local scope
- Local scope gone wrong
- Changing global variable from a function
- Global variables mutable in functions
- Scoping issues
- sub in sub
- Scoping sub in sub (enclosing scope)
- Function objects
- Functions are created at run time
- Mutable default
- Use None as default parameter
- Inner function created every time the outer function runs
- Static variable
- Static variable in generated function
- Inspect
- Variable number of function arguments
- Python function arguments - a reminder
- Functions with unknown number of argumerns
- Variable length argument list with * and **
- Passing arguments as they were received (but incorrectly)
- Unpacking args before passing them on
- Exercise: implement the my_sum function
- Solution: implement the my_sum function
- Exercise: implement the reduce function
- Soluton: implement the reduce function
- Exercise: sort pairs
- Solution: sort pairs
- Python Packages
- Why Create package
- Create package
- Internal usage
- use module in package - relative path
- use package (does not work)
- package importing (and exporting) module
- use package (module) with import
- use package with import
- Creating an installable Python package
- Create tar.gz file
- Install Package
- Dependencies
- Add README file
- Add README file (setup.py)
- Include executables
- Add tests
- Add tests calc
- Add tests all
- setup.py
- Run tests and create package
- Exercise: package
- Exercise: create executable
- Distribution of Python code
- Distribute Python application as an exe
- Ctypes
- 2to3
- Design Patterns
- Parallel
- Threads
- Python Threading docs
- Threaded counters
- Simple threaded counters
- Simple threaded counters (parameterized)
- Pass parameters to threads - Counter with attributes
- Create a central counter
- Lock - acquire - release
- Counter - plain
- GIL - Global Interpreter Lock
- Thread load
- Exercise: thread files
- Exercise: thread URL requests.
- Exercise: thread queue
- Solution: thread queue
- Solution: thread URL requests.
- Concurrency
- Forking
- Asynchronous programming with AsyncIO
- Use cases for Async
- Event loop
- Print sync
- Print async
- Sync sleep
- Async sleep
- Sync sleep in loop
- Async sleep in loop
- Async sleep in loop with gather
- coroutines
- Async Tasks
- Count Async
- Passing the baton while sleeping 0 sec
- Async sleep in a queue
- Async http
- Sync http requests
- Async http requests
- Async http requests with queue
- Sync chores
- Async chores
- Async more
- Asynchronus programming with Twisted
- Multiprocess
- Multiprocess CPU count
- Multiprocess N files: Pool
- Multiprocess load
- Multiprocess: Pool
- Multiprocess load async
- Multiprocess and logging
- Exercise: Process N files in parallel
- Exercise: Process N Excel files in parallel
- Exercise: Fetch URLs in parallel
- Exercise: Fetch URLs from one site.
- Solution: Process N files in parallel
- Solution: Fetch URLs in parallel
- Multitasking
- Improving Performance - Optimizing code
- Problems
- Optimization strategy
- Locate the source of the problem
- Optimizing tactics
- DSU: Decorate Sort Undecorate
- Profile code
- Slow example
- profile slow code
- cProfile slow code
- Benchmarking
- Benchmarking subs
- Counting words - which implementation is faster?
- for loop or reduce to add numbers?
- Levenshtein distance
- Generate words
- Levenshtein - pylev
- Levenshtein - editdistance
- Editdistance benchmark
- A Tool to Generate text files
- Count characters
- Memory leak
- Garbage collection
- Weak reference
- Exercise: benchmark list-comprehension, map, for
- Exercise: Benchmark Levenshtein
- Exercise: sort files
- Exercise: compare split words:
- Exercise: count words
- GUI with Python/Tk
- Sample Tk Demo app
- Simple file dialog
- GUI Toolkits
- Installation
- Python Tk Documentation
- Python Tk Button
- Python Tk Button with action
- Python Tk Label
- Python Tk Label - font size and color
- Python Tk echo - change text of label
- Python Tk Keybinding
- Python Tk Mouse clicks
- Python Tk Mouse movements (motions)
- Python Tk Entry (one-line text entry)
- Python Tk Entry for passwords and other secrets (hidden text)
- Python Tk Checkbox
- Python Tk Radiobutton
- Python Tk Listbox
- Python Tk Listbox Multiple
- Python Tk Menubar
- Python Tk Text
- Python Tk Dialogs
- Python Tk simple dialog to get a single string, int, or float
- Python Tk Filedialog
- Python Tk messagebox
- Python Tk - custom simple dialog with its own widgets and buttons
- Python Tk Combobox
- Python Tk OptionMenu
- Python Tk Scale
- Python Tk Progressbar
- Python Tk Frame
- Python Tk display images using Canvas
- Python Tk display Hebrew text (right to left)
- Python Tk Colorchooser
- Python Tk Timer event (after)
- Python Tk Class-based Label + Button
- Tk: Runner
- Tk: Runner with threads
- Tk: Old Simple Tk app with class
- Tk: Old Hello World
- Tk: Old Quit button
- Tk: Old File selector
- Tk: Old Checkbox
- Tk: Old Getting started with Tk
- Exercise: Tk - Calculator one line
- Exercise: Tk - Calculator with buttons
- Exercise: Tk - Convert between CSV and Excel files
- Exercise: Tk - Shopping list
- Exercise: Tk - TODO list
- Exercise: Tk - Notepad
- Exercise: Tk - Copy files
- Exercise: Tk - Implement Master Mind board
- Exercise: Tk - a GUI for a grep-like application
- Solution: Tk - Calculator one line
- Solution: Tk - Calculator with buttons
- Solution: Tk - Convert between CSV and Excel files
- Solution: Tk - Implement Master Mind board
- Solution: Tk - Notepad
- Python Pitfalls
- Linters
- Python .NET
- Python and Java
- Jython - Python running on the JVM
- Signals
- Data Science
- PIL - Pillow
- Install Pillow
- Create First Image
- Write Text on Image
- Select font for Text on Image
- Font directories
- Get size of an Image
- Get size of text
- Resize an existing Image
- Crop an existing Image
- Combine two images
- Rotated text
- Rotated text in top-right corner
- Embed image (put one image on another one)
- Draw a triangle
- Draw a triangle and write text in it
- Draw a triangle and write rotated text in it
- Draw a rectangle
- Draw circle
- Draw heart
- Rectangle with rounded corners
- TODO
- FAQ
- Appendix
- Algorithm
- Scapy
- Virtualenv for root
- Install Scapy
- Tcpdump
- Scapy ping an IP using ICMP
- Scapy ping ICMP
- Scapy display (show)
- Scapy ip
- Scapy Configuration
- Scapy List interfaces
- Scapy ping-pong
- Scapy sniffing - capturing packets
- Scapy ping between two IPs that do not belong to my server
- Scapy Traceroute
- Scapy TCP port 80
- Scapy Layers
- Scapy HTTP
- Turtle
- Refactor
- Machine Learning
- Machine Learning 2
- Number of features
- Linear regression
- Cost function
- Gradient descent
- Matrices
- Machine Learning - Multiple features
- Feature Scaling
- Gradient Descent - Learning Rate
- Features
- Polynomial Regression
- Normal Equation
- Multiple features
- Logistic regression (for classification)
- Multi-feature Classification (Iris)
- Kaggle - Melbourne housing listing
- Machine Learning Resources
- Regression Analyzis
- Classification Analysis
- Unbiased evaluation of a model
- Splitting data
- Model selection and validation
- K-fold valiadtion
- Learning Curves
- Hypermatameter tuning (optimization)
- The k-Nearest Neighbors (kNN)
- K-Means Clustering
- Boston housing prices
- Decision Tree
- Random Forrest
- Resnet 50
- Octave
- OpenCV
- OpenCV Installation
- Download images
- OpenCV Read image
- OpenCV - read image and fail
- OpenCV resize (rescale) images
- OpenCV cropping image
- OpenCV crop, resize and save image
- OpenCV - draw on new images
- OpenCV - draw rectangle
- OpenCV - draw circle
- OpenCV convert BGR to greyscale and back to BGR
- OpenCV blur image
- OpenCV Gaussian blur
- OpenCV Median blur
- OpenCV Bilateral blur
- OpenCV blur part of an image
- OpenCV - Thresholding
- OpenCV - Simple Thresholding
- OpenCV - Adaptive Thresholding
- OpenCV - Gradients and Edges
- OpenCV - finding edges using Canny
- OpenCV - Laplacian Gradients
- OpenCV - Sobel Gradients
- OpenCV - Canny Dilate Erode
- OpenCV Move of an Image
- OpenCV - Rotate Image
- OpenCV - Flip Image
- OpenCV - Contours
- OpenCV - Draw contours of an image on a blank image
- OpenCV - ColorSpaces
- OpenCV - BGR to RGB
- OpenCV - BGR to HSV
- OpenCV - BGR to LAB
- OpenCV - Split and merge color channels
- OpenCV - bitwise operations
- OpenCV - masking
- OpenCV - grayscale historgrams
- OpenCV - color historgrams
- OpenCV - Face detection
- OpenCV - Face recognition
- Jupyter notebook
- Download movies
- OpenCV Read video
- Show images - accept key presses
- OpenCV Resources
- Overview of Python syntax
- Serialization (Marshalling)
- MLOps
- The goal of MLOps
- Agile Manifesto
- DevOps
- Machine Learning Operations
- What is MLOps?
- MLOps community
- Silicon
- Off-line (batch) vs On-line (streaming) learning
- Security question of MLOps
- Data
- MLOps progress
- Reload modules in Jupyter Notebook
- Testing ML
- What to track?
- What are the inputs and what are the artifacts?
- Tooling for MLOps
- DVC
- Data Pipelines (Workflow management)
- MLFlow
- MLFLow Tracking server backends
- MLFlow Tracking
- MLFlow Projects
- MLFlow Models
- Resources
- Goals of SCM
- MLOps notes
- Python types at PyWeb 2025.01
- Python types at PyWeb 2025.01
- The Answer
- Add
- Add in function
- Shift-left (testing, programming)
- Function with type annotation
- Use mypy
- How add type annotation?
- Infer (deduct) the type
- Type in unannotated function
- Built-in types
- Complex types
- Either this or that type (Union)
- Optional type (variable can also be None)
- Define type alias
- Define complex type alias
- Define type for enum and complex dictionary
- mypy generics - plain
- mypy generics - cannot be any type
- mypy generics - limit the types by listing
- mypy generics - limit by functionality
- Two variables of the same and different types
- mypy suggestions
- The end
- Bloopers
- Define the type of variables
- Define the return type
- Complex types for Python 3.8 and before
- Either this or that type for Python before 3.10
- Python types at PyWeb 2025.05
- Python types at PyWeb 2025.05
- The Answer
- Add
- Add in function
- Shift-left (testing, programming)
- Function with type annotation
- Use mypy
- How add type annotation?
- Infer (deduct) the type
- Type in unannotated function
- Type in annotated function
- Built-in types
- Complex types
- Either this or that type (Union)
- Either this or that type for Python before 3.10
- Optional type (variable can also be None)
- Define type alias
- Define complex type alias
- Define type for enum and complex dictionary
- mypy generics - plain
- mypy generics - cannot be any type
- mypy generics - limit the types by listing
- mypy generics - limit by functionality
- Two variables of the same and different types
- mypy suggestions
- The end
- Bloopers
- Define the type of variables
- Define the return type
- Complex types for Python 3.8 and before
- Other slides
- Other slides
- Atom for Python
- IDLE - Integrated DeveLopment Environment
- sh-bang - executable on Linux/Apple
- pydoc
- Spyder Intro
- Interactive Debugging
- Parameter passing
- Command line arguments and main
- Name of the current function in Python
- Name of the caller function in Python
- Stack trace in Python using inspect
- SAX with coroutine
- Getting the class name of an object
- iterator - pairwise
- iterator - grouped
- itertools - groupby
- Circular references
- Context managers: with (file) experiments
- itertools - izip
- mixing iterators
- mixing iterators
- itertools - pairwise
- itertools - grouped
- range vs xrange in Python
- profile (with hotshot) slow code
- Create class with metaclass
- Python Descriptors
- alter iterator
- Create a counter queue
- A Queue of tasks
- Python from .NET
- Matplotlib subplot
- Jupyter StackOverflow - historgram
- Jupyter StackOverflow - OpenSourcer
- Jupyter StackOverflow - cross tabulation
- Jupyter StackOverflow - salaries
- Jupyter StackOverflow - replace values
- NameError
- UnboundLocalError
- Insert element in sorted list using bisect
- Insert element in sorted list using insort
- Classes
- Create a class inherit from object
- Gravatar in Python
- Debug with ptpython
- REPL - Interactive debugging with ptpython
- Print in color on the CLI
- Easy Install
- sorting with sorted using a key
- get and set locale
- Modify time anomality
- Some strange code
- is vs ==