PyCon TW 2023
NoGIL is most impressive!
- Fomal discussion starts from OCT.7 2021
- NOGIL Python targeting 3.11
- JAN 9 2023
- PEP 703 - tentatively accepted for Python 3.13
Challenges of NoGIL
- maintanance: increase the Python team’s maintenance bourden
- compatibility: issues for C extensions
- performance: NoGIL Python may be imcompatible with servral faster Python optimisations
- packaging: for a while packages might need to be released in two versions (as GIL and NoGIL), which complicates releases and testing, too
Types of programs
- I/O bounded code: doesn’t quite benefit from NoGIL
- CPU bounded code: does benefit from NoGIL if there’s parallelism mixed workload
Challengs for c extensions
- global state
- debugging is harder
- implicit gil as lock
- interoperabitpality
- looking infrastructure
- validation
Slide: https://slides.p3ac0ck.net/pycontw2023/index.html
- PEPs: 517, 621, and 660
pyproject.toml
format was defined
pyproject.toml https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/
Note: Pipfile: the replacement for requirements.txt
asyncio.TaskGroup
is a new feature since Python 3.11.
Example:
The async with
statement will wait for all tasks in the group to finish. While waiting, new tasks may still be added to the group (for example, by passing tg into one of the coroutines and calling tg.create_task()
in that coroutine). Once the last task has finished and the async with
block is exited, no new tasks may be added to the group.
Slide: https://www.slideshare.net/YungYuChen/simplearray-between-python-and-cpdf
Goal: Speed up computation!
- Key: Buffer Management
- SimpleArray is a class template
- Holds a contiguous memory buffer
- Provides multi-dimensional accessors to its elements
Slide: https://drive.google.com/file/d/1cejbP-QVDtUphQ292FOB1RgyonDVmcYP/view?usp=sharing
I think this is more like a coverage issue. Introduce Hypothesis, which implements a kind of proof by exhaustion for test cases' inputs.
Examples:
Note: It lists as more inputs / property values for test cases as possible. However, that makes tests take more execution time, too.
Slide: https://drive.google.com/file/d/1BEZzb6NDBXYwu4_pYDHFmk6sEnEHT2UC/view
Professor Tsai introduced Generative AI in general science way.
Text example:
- Input one word (memory (in brain)), guess next word
- The possible next words are probability distribution
- Calcualte probability distribution according to the before gathered data/sentence/words
Picture example:
- Neural network can calculate/extract the characteristics of a person's picture. => Get the representing vector of the person's picture.
- Check two pictures by comparing the distance between the vectors from two pictures.
Slide: https://docs.google.com/presentation/d/1OK_G9lLmiYelaii3hq35xomRYOiVGJW_SZNuI6DuRx4/edit#slide=id.g267e08f8fe1_0_366
Another AI thing, and used to guess stocks' price.
If f() = f() + , then = f() - f() => has no relationship with
- MSS: An ultra fast cross-platform multiple screenshots module in pure python using ctypes.
- PyAutoGUI: A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
May be they are good tools to do the automation GUI tests.
Slide: https://slides.com/whitphx/streamlit-meets-webassembly-stlite
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
stlite: Client-side execution only
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- Web assembly runs CPython -> runs Pyodide runtime -> Streamlit runs Python script as the ** web server** on the web browser
- Normal JS runtime as the web client
- No extra asyncio's event loops. In the browser/Node environment, the async features rely on the JS runtime. There is only single running event loop.
- Does not have some blocking methods, like
time.sleep()
, but await asyncio.sleep()
- Unavailable Python packages supports: check Packages built in Pyodide