The PyCon US conference will be held in Salt Lake City in April 2022. Python developers gathered for the annual Language Summit at the conference, and Anaconda unveiled PyScript, a means to write Python right within HTML. The Python Software Foundation (PSF) welcomed its new executive director earlier this month.
Continue reading to learn about the most important Python news from the last month!
Python in Your Browser with PyScript
Anaconda CEO Peter Wang announced the PyScript project during his keynote at PyCon US. PyScript enables you to create Python code right inside HTML and execute it in your browser. Imagine the following scenario:
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body>
<py-script> print('Hello, World!') </py-script>
</body>
</html>
Take note of the py-script> element, which may include any acceptable Python code. This is the conventional Hello, World! greeting in this circumstance.
This is functional code. You may save the preceding code block to your computer by pasting it into a file called hello.html. Then open it in your browser by pressing Ctrl+O or Cmd+O and choosing hello.html. You may also run a similar example directly from the PyScript demonstrations website.
PyScript has special HTML tags, such as py-script>, as seen above. There are various additional tags, many of which are currently in the works. Nonetheless, here are a few that will come in handy right away:
<py-env>
lists packages that should be made available in the environment.<py-repl>
creates a working Python REPL to interact with the environment.
The significantly more complicated example below demonstrates how to utilise these features:
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-env>
- numpy
</py-env>
</head>
<body>
<h1 id="title">Magic Squares - Loading ...</h1>
<py-script>
import numpy as np
# Initialize a magic square
magic = np.array([[6, 7, 2], [1, 5, 9], [8, 3, 4]])
# Update title to indicate that the page has finished loading
pyscript.write("title", "Magic Squares")
</py-script>
<py-repl id="magic-repl" auto-generate="true">
magic.sum(axis=0)
</py-repl>
</body>
</html>
You indicate in this example that you wish to utilise numpy in your environment. Next you import numpy, build an array representing a magic square, and change the page’s title to show that it has finished loading. The REPL will be filled with code that you may execute interactively on the web page given by the HTML. A typical sessi on may look like this:
It should be noted that pyscript.write() has the ability to interact with the Document Object Model (DOM) and alter the contents of designated HTML elements. Moreover, code written in the REPL may utilise variables that were previously initialised.
All of this is made possible via PyScript, which is built on top of Pyodide. Pyodide offers CPython compiled to WebAssembly for use in the browser or with Node.js. Moreover, Pyodide makes it simple to invoke JavaScript from Python, and PyScript takes use of this to encapsulate JavaScript libraries such as D3.
Note: Get a head start on the competition by diving into PyScript while it’s still brand new! PyScript: A First Look: This investigation will be guided by Python in the Web Browser.
PyScript is still in its early stages, but the possibilities of this new framework are fascinating. We’re looking forward to tracking PyScript’s progress in the future.
PyCon 2022 in the United States
The PyCon US conference is the Python community’s biggest yearly meeting. It has taken place every year since 2003, however the prior two years were virtual owing to the COVID-19 epidemic.
Almost 1800 individuals attended PyCon in Salt Lake City from April 27 to May 3. Although the conference returned to being in-person, the consequences of the pandemic were noticeable: attendance was reduced compared to 2019, rigorous health and safety measures were in place, and an online alternative was available.
The lectures, like with each PyCon conference, covered a wide variety of subjects and were of high quality. All lectures were videotaped and will be available on the PyCon YouTube channel after post-processing. There were five keynotes this year:
- Ćukasz Langa on typing and complexity
- Sara Issaoun about the imaging of black holes
- Peter Wang announcing PyScript
- Thomas Wouters and Pablo Galindo Salgado about Python 3.11 and the work of the steering council
- Naomi Ceder on building a great community
Georgi Ker, Reuven Lerner, Anthony Shaw, and Lorena Mesa also spoke on a panel addressing diversity and inclusion in Pyth on: image@@@1
The Salt Palace Conference Center hosted the conference. The venue’s wide area and lengthy halls allowed several chances to connect with sponsors and other guests. This year, Real Python had our own booth, and it was lovely to meet so many of our readers and members.
While this year’s PyCon US has concluded, preparations for the future edition have already begun. From April 19 to April 27, 2023, it will also be held in Salt Lake City.
2022 Python Language Summit
The Python Language Summit is an annual gathering where Python developers may exchange ideas and debate CPython and other implementation difficulties. This crucial event for the language is usually held at the PyCon conference.
The future of the global interpreter lock (GIL), optimizations from the faster-cpython and Cinder projects, and a potential change in how f-strings are processed were all addressed during this year’s language summit.
We’re interested in knowing more about the subjects discussed during the language conference. The PSF will, as in previous years, summarise the conversations on their blog. This year, Alex Waygood will chronicle the summit talks in a series of future blog entries.
PSF has a new Executive Director.
After almost 10 years of service, Ewa Jodlowska stepped down as executive director of the Python Software Foundation (PSF) at the end of last year.
The PSF announced on April 7 that Deb Nicholson will take over as executive director. Nicholson has extensive experience with open-source and nonprofit groups such as the Open Source Initiative, OpenHatch, and the local Boston Python User Club.
Real Python welcomes Deb Nicholson and looks forward to the PSF’s continuing growth.
What Comes Next for Python?
The excitement of PyCon US and the satisfaction of being able to attend in-person conferences again has dominated Python news this month. When the world gradually returns to normal, more and more user groups, meetups, and conferences will resume in-person meetings. Are you looking forward to any upcoming conferences?
Which Python news article from April is your favourite? Tell us in the comments. Have fun Pythoning!
Mark as finished