Giter Club home page Giter Club logo

async-techniques-python-course's Introduction

Course Summary

Python's async and parallel programming support is highly underrated. In this course, you will learn the entire spectrum of Python's parallel APIs. We will start with covering the new and powerful async and await keywords along with the underpinning module: asyncio. Then we'll move on to Python's threads for parallelizing older operations and multiprocessing for CPU bound operations. We'll close out the course with a host of additional async topics such as async Flask, task coordination, thread safety, and C-based parallelism with Cython.

What's this course about and how is it different?

This is the definitive course on parallel programming in Python. It covers the tried and true foundational concepts such as threads and multiprocessing as well as the most modern async features based on Python 3.7+ with async and await.

In addition to the core concepts and APIs for concurrent programming, you will learn best practices and how to choose between the various APIs as well as how to use them together for the biggest advantage.

In this course, you will:

  • See how concurrency allows improved performance and scalability
  • Build async-capable code with the new async and await keywords
  • Add asynchrony to your app without additional threads or processes
  • Work with multiple threads to run I/O bound work in Python
  • Use locks and thread safety mechanisms to protect shared data
  • Recognize a dead-lock and see how to prevent them in Python threads
  • Take full advantage of multicore CPUs with multiprocessing
  • Unify the thread and process APIs with execution pools
  • Add massive speedups with Cython and Python threads
  • Create async view methods in Flask web apps
  • And lots more

Who is this course for?

Anyone who would like to write Python code that does more, scales better, and takes better advantage of modern, multicore CPUs. Whether you're a web developer or data scientists, you will find a host of techniques to do more faster.

The course is not a beginner Python course, so students with little to no Python language experience should take a foundational course first. We recommend our Python Jumpstart by Building 10 Apps as a prerequisite if needed.

Take the course today

Visit the course page and get started today.

async-techniques-python-course's People

Contributors

brendonmackenzie avatar mikeckennedy avatar vindard avatar willsalmanj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

async-techniques-python-course's Issues

SSL: Certificate Failure Episode Async web scraping

For the web scraping component against https://talkpython.fm I was successful using the sync libraries and code with a 3.6 interpreter, however when moving on to the async version I get:

aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host talkpython.fm:443 ssl:None [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)]

Code for setting up venv

There is a use of an alias in chapter 04-asyncio to set up a virtual environment but it is not very clear what command is exactly used.
Could we have this included somewhere in the code or course materials. I am assuming it is something along the lines of:
alias venv='python3 -m venv venv && . venv/bin/activate && pip install --upgrade pip > /dev/null && pip install --upgrade setuptools > /dev/null'

This seemed to produce a similar product shown in the video.

04 web_scraping asyncio.create_task don't exist

Hi

Don't understand how it works for you in the demo but when i run it crases straight away. I have tried multiple times and when i try to start 04-asyncio/web_scraping/async_scrape/program.py i get the following error.

python program.py
Traceback (most recent call last):
File "program.py", line 58, in
main()
File "program.py", line 32, in main
loop.run_until_complete(get_title_range())
File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "program.py", line 49, in get_title_range
tasks.append((n, asyncio.create_task(get_html(n))))
AttributeError: module 'asyncio' has no attribute 'create_task'

Using pipenv:
aiodns==1.1.1
aiohttp==3.4.4
async-timeout==3.0.0
attrs==18.2.0
beautifulsoup4==4.6.3
bs4==0.0.1
cchardet==2.1.4
chardet==3.0.4
colorama==0.3.9
idna-ssl==1.1.0; python_version < '3.7'
idna==2.7
multidict==4.4.2
pycares==2.3.0
yarl==1.2.6

python --version
Python 3.6.6

Use of f-strings is not compatible with python 3.5

Bumped in to the use of f-strings relatively early on. I am using Ubuntu 16.04 which has python 3.5 by default, which does not support f-strings.
I raised a couple of pull requests for chapter 04-asyncio but haven't yet gone further.

Using grep, I located additional files that may have issues:
grep -rnw . -e "f[\'\"]"

./src/09-built-on-asyncio/the_trio/prod_sync.py:24: print(colorama.Fore.YELLOW + f" -- generated item {idx}", flush=True)
./src/09-built-on-asyncio/the_trio/prod_asyncio.py:32: print(colorama.Fore.YELLOW + f" -- generated item {idx}", flush=True)
./src/09-built-on-asyncio/the_trio/prod_trio.py:29: print(colorama.Fore.YELLOW + f" -- generated item {idx}", flush=True)
./src/10-async-web/acityscape_api/config/settings.py:6: file = os.path.join(os.path.dirname(file), f"{mode}.json")
./src/10-async-web/acityscape_api/services/location_service.py:16: key = f'{zip_code}, {country}'
./src/10-async-web/acityscape_api/services/location_service.py:29: city_data = data.get(f'{zip_code}, {country}', dict())
./src/10-async-web/cityscape_api/config/settings.py:6: file = os.path.join(os.path.dirname(file), f"{mode}.json")
./src/10-async-web/cityscape_api/services/location_service.py:14: key = f'{zip_code}, {country}'
./src/10-async-web/cityscape_api/services/location_service.py:26: city_data = data.get(f'{zip_code}, {country}', dict())
./src/04-asyncio/producer_consumer/prod_async/async_program.py:32: #print(colorama.Fore.YELLOW + f" -- generated item {idx}", flush=True)
./src/04-asyncio/producer_consumer/prod_sync/sync_program.py:23: #print(colorama.Fore.YELLOW + f" -- generated item {idx}", flush=True)
./src/05-threads/basic_threads/threaded_prod.py:44: print(colorama.Fore.YELLOW + f" -- generated item {idx}", flush=True)
./src/05-threads/basic_threads/sync_prod.py:25: print(colorama.Fore.YELLOW + f" -- generated item {idx}", flush=True)

Why threads were faster than not threads in threads calculation example

This might be a wired way of reaching out but, I have checked why the threaded example for 05-threads/cpu_attempt/compute_threaded.py is ~15% faster than non threaded one.
Basically the threaded version does computation on floats because of the devisions you make, whereas synchronous example uses ints. So apparently the floats computations are a bit faster than integer ones.

aiohttp SSLCertVerificationError on Macbook

Hi Michael,

Getting aiohttp errors when executing the async version of the web scraper for your site. Running OSX Catalina and (official) Python 3.8.1.

 File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/aiohttp/connector.py", line 938, in _wrap_create_connection
    raise ClientConnectorCertificateError(
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host talkpython.fm:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.