Feeds

Python GUIs: Packaging PyQt5 applications for Windows, with PyInstaller & InstallForge — Turn your PyQt5 application into a distributable installer for Windows (updated for 2022)

Planet Python - Sat, 2022-01-29 03:00

There is not much fun in creating your own desktop applications if you can't share them with other people — whether than means publishing it commercially, sharing it online or just giving it to someone you know. Sharing your apps allows other people to benefit from your hard work!

The good news is there are tools available to help you do just that with your Python applications which work well with apps built using PyQt5. In this tutorial we'll look at the most popular tool for packaging Python applications: PyInstaller.

This tutorial is broken down into a series of steps, using PyInstaller to build first simple, and then increasingly complex PyQt5 applications into distributable EXE files on Windows. You can choose to follow it through completely, or skip ahead to the examples that are most relevant to your own project.

We finish off by using InstallForge to create a distributable Windows installer.

You always need to compile your app on your target system. So, if you want to create a Mac .app you need to do this on a Mac, for an EXE you need to use Windows.

Example Installer for Windows

If you're impatient, you can download the Example Installer for Windows first.

Requirements

PyInstaller works out of the box with PyQt5 and as of writing, PyInstaller is compatible up to 3.7. Whatever project you're working on, you should be able to package your apps.

You can install PyInstaller using pip.

bash pip3 install PyInstaller

If you experience problems packaging your apps, your first step should always be to update your PyInstaller and hooks package the latest versions using

bash pip3 install --upgrade PyInstaller pip3 install --upgrade pyinstaller-hooks-contrib

The hooks module contains package-specific packaging instructions for PyInstaller which is updated regularly.

Install in virtual environment (optional)

You can also opt to install PyQt5 and PyInstaller in a virtual environment (or your applications virtual environment) to keep your environment clean.

bash python3 -m venv packenv

Once created, activate the virtual environment by running from the command line —

bash call packenv\scripts\activate.bat

Finally, install the required libraries. For PyQt5 you would use —

python pip3 install PyQt5 PyInstaller Getting Started

It's a good idea to start packaging your application from the very beginning so you can confirm that packaging is still working as you develop it. This is particularly important if you add additional dependencies. If you only think about packaging at the end, it can be difficult to debug exactly where the problems are.

T> If you've already got an application you've created and want to know how to package that you may want to skip ahead to the advanced examples.

For this example we're going to start with a simple skeleton app, which doesn't do anything interesting. Once we've got the basic packaging process working, we'll extend the application to include icons and data files. We'll confirm the build as we go along.

To start with, create a new folder for your application and then add the following skeleton app in a file named app.py. You can also download the source code and associated files

python from PyQt5 import QtWidgets import sys class MainWindow(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Hello World") l = QtWidgets.QLabel("My simple app.") l.setMargin(10) self.setCentralWidget(l) self.show() if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) w = MainWindow() app.exec()

This is a basic bare-bones application which creates a custom QMainWindow and adds a simple widget QLabel to it. You can run this app as follows.

bash python app.py

This should produce the following window (on Windows 11).

Simple skeleton app in PyQt5

Building a basic app

Now we have our simple application skeleton in place, we can run our first build test to make sure everything is working.

Open your terminal (command prompt) and navigate to the folder containing your project. You can now run the following command to run the PyInstaller build.

python pyinstaller app.py

You'll see a number of messages output, giving debug information about what PyInstaller is doing. These are useful for debugging issues in your build, but can otherwise be ignored. The output that I get for running the command on Windows 10 is shown below.

bash U:\home\martin\helloworld>pyinstaller app.py INFO: PyInstaller: 3.6 INFO: Python: 3.7.6 INFO: Platform: Windows-10-10.0.18362-SP0 INFO: wrote U:\home\martin\helloworld\app.spec INFO: UPX is not available. INFO: Extending PYTHONPATH with paths ['U:\\home\\martin\\helloworld', 'U:\\home\\martin\\helloworld'] INFO: checking Analysis INFO: Building Analysis because Analysis-00.toc is non existent INFO: Initializing module dependency graph... INFO: Caching module graph hooks... INFO: Analyzing base_library.zip ... INFO: Caching module dependency graph... INFO: running Analysis Analysis-00.toc INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by c:\users\gebruiker\appdata\local\programs\python\python37\python.exe INFO: Analyzing U:\home\martin\helloworld\app.py INFO: Processing module hooks... INFO: Loading module hook "hook-encodings.py"... INFO: Loading module hook "hook-pydoc.py"... INFO: Loading module hook "hook-PyQt5.py"... WARNING: Hidden import "sip" not found! INFO: Loading module hook "hook-PyQt5.QtWidgets.py"... INFO: Loading module hook "hook-xml.py"... INFO: Loading module hook "hook-PyQt5.QtCore.py"... INFO: Loading module hook "hook-PyQt5.QtGui.py"... INFO: Looking for ctypes DLLs INFO: Analyzing run-time hooks ... INFO: Including run-time hook 'pyi_rth_pyqt5.py' INFO: Looking for dynamic libraries INFO: Looking for eggs INFO: Using Python library c:\users\gebruiker\appdata\local\programs\python\python37\python37.dll INFO: Found binding redirects: [] INFO: Warnings written to U:\home\martin\helloworld\build\app\warn-app.txt INFO: Graph cross-reference written to U:\home\martin\helloworld\build\app\xref-app.html INFO: checking PYZ INFO: Building PYZ because PYZ-00.toc is non existent INFO: Building PYZ (ZlibArchive) U:\home\martin\helloworld\build\app\PYZ-00.pyz INFO: Building PYZ (ZlibArchive) U:\home\martin\helloworld\build\app\PYZ-00.pyz completed successfully. INFO: checking PKG INFO: Building PKG because PKG-00.toc is non existent INFO: Building PKG (CArchive) PKG-00.pkg INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. INFO: Bootloader c:\users\gebruiker\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe INFO: checking EXE INFO: Building EXE because EXE-00.toc is non existent INFO: Building EXE from EXE-00.toc INFO: Appending archive to EXE U:\home\martin\helloworld\build\app\app.exe INFO: Building EXE from EXE-00.toc completed successfully. INFO: checking COLLECT INFO: Building COLLECT because COLLECT-00.toc is non existent INFO: Building COLLECT COLLECT-00.toc INFO: Building COLLECT COLLECT-00.toc completed successfully.

If you look in your folder you'll notice you now have two new folders dist and build.

build & dist folders created by PyInstaller

Below is a truncated listing of the folder content, showing the build and dist folders.

bash . &boxvr&boxh&boxh app.py &boxvr&boxh&boxh app.spec &boxvr&boxh&boxh build &boxv   &boxur&boxh&boxh app &boxv   &boxvr&boxh&boxh Analysis-00.toc &boxv   &boxvr&boxh&boxh COLLECT-00.toc &boxv   &boxvr&boxh&boxh EXE-00.toc &boxv   &boxvr&boxh&boxh PKG-00.pkg &boxv   &boxvr&boxh&boxh PKG-00.toc &boxv   &boxvr&boxh&boxh PYZ-00.pyz &boxv   &boxvr&boxh&boxh PYZ-00.toc &boxv   &boxvr&boxh&boxh app.exe &boxv   &boxvr&boxh&boxh app.exe.manifest &boxv   &boxvr&boxh&boxh base_library.zip &boxv   &boxvr&boxh&boxh warn-app.txt &boxv   &boxur&boxh&boxh xref-app.html &boxur&boxh&boxh dist &boxur&boxh&boxh app &boxvr&boxh&boxh MSVCP140.dll &boxvr&boxh&boxh PyQt5 &boxvr&boxh&boxh app.exe &boxvr&boxh&boxh app.exe.manifest &boxvr&boxh&boxh Qt5Core.dll ...

The build folder is used by PyInstaller to collect and prepare the files for bundling, it contains the results of analysis and some additional logs. For the most part, you can ignore the contents of this folder, unless you're trying to debug issues.

The dist (for "distribution") folder contains the files to be distributed. This includes your application, bundled as an executable file, together with any associated libraries (for example PyQt5) and binary .dll files.

Everything necessary to run your application will be in this folder, meaning you can take this folder and "distribute" it to someone else to run your app.

You can try running your app yourself now, by running the executable file, named app.exe from the dist folder. After a short delay you'll see the familiar window of your application pop up as shown below.

Simple app, running after being packaged

You may also notice a console/terminal window pop up as your application runs. We'll cover how to stop that happening shortly.

In the same folder as your Python file, alongside the build and dist folders PyInstaller will have also created a .spec file. In the next section we'll take a look at this file, what it is and what it does.

The Spec file

The .spec file contains the build configuration and instructions that PyInstaller uses to package up your application. Every PyInstaller project has a .spec file, which is generated based on the command line options you pass when running pyinstaller.

When we ran pyinstaller with our script, we didn't pass in anything other than the name of our Python application file. This means our spec file currently contains only the default configuration. If you open it, you'll see something similar to what we have below.

python # -*- mode: python ; coding: utf-8 -*- block_cipher = None a = Analysis(['app.py'], pathex=[], binaries=[], datas=[], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='app', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=True ) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, upx_exclude=[], name='app')

The first thing to notice is that this is a Python file, meaning you can edit it and use Python code to calculate values for the settings. This is mostly useful for complex builds, for example when you are targeting different platforms and want to conditionally define additional libraries or dependencies to bundle.

If you generate a .spec file on Windows the path separator will be \\. To use this same .spec file on macOS you'll need to switch the separators to /. Thankfully / also works on Windows.

Once a .spec file has been generated, you can pass this to pyinstaller instead of your script to repeat the previous build process. Run this now to rebuild your executable.

bash pyinstaller app.spec

The resulting build will be identical to the build used to generate the .spec file (assuming you have made no changes). For many PyInstaller configuration changes you have the option of passing command-line arguments, or modifying your existing .spec file. Which you choose is up to you.

Tweaking the build

So far we've created a simple first build of a very basic application. Now we'll look at a few of the most useful options that PyInstaller provides to tweak our build. Then we'll go on to look at building more complex applications.

Naming your app

One of the simplest changes you can make is to provide a proper "name" for your application. By default the app takes the name of your source file (minus the extension), for example main or app. This isn't usually what you want.

You can provide a nicer name for PyInstaller to use for the executable (and dist folder) either by editing the .spec file to add a name= under the app block.

python exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='Hello World', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=False # False = do not show console. )

Alternatively, you can re-run the pyinstaller command and pass the -n or --name configuration flag along with your app.py script.

bash pyinstaller -n "Hello World" app.py # or pyinstaller --name "Hello World" app.py

The resulting EXE file will is given the name Hello World.exe and placed in the folder dist\Hello World\.

Application with custom name "Hello World"

The name of the .spec file is taken from the name passed in on the command line, so this will also create a new spec file for you, called Hello World.spec in your root folder.

Hiding the console window

When you run your packaged application you will notice that a console window runs in the background. If you try and close this console window your application will also close. You almost never want this window in a GUI application and PyInstaller provides a simple way to turn this off.

Application running with terminal in background

You can fix this in one of two ways. Firstly, you can edit the previously created .spec file setting console=False under the EXE block as shown below.

python exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='app', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=False # False = do not show console. )

Alternatively, you can re-run the pyinstaller command and pass the -w, --noconsole or --windowed configuration flag along with your app.py script.

bash pyinstaller -w app.py # or pyinstaller --windowed app.py # or pyinstaller --noconsole app.py

There is no difference between any of the options.

Re-running pyinstaller will re-generate the .spec file. If you've made any other changes to this file these will be lost.

One File Build

On Windows PyInstaller has the ability to create a one-file build, that is, a single EXE file which contains all your code, libraries and data files in one. This can be a convenient way to share simple applications, as you don't need to provide an installer or zip up a folder of files.

To specify a one-file build provide the --onefile flag at the command line.

bash pyinstaller --onefile app.py

Result of a one-file build

Note that while the one-file build is easier to distribute, it is slower to execute than a normally built application. This is because every time the application is run it must create a temporary folder to unpack the contents of the executable. Whether this trade-off is worth the convenience for your app is up to you!

Using the --onefile option makes quite a few changes to the .spec file. You can make these changes manually, but it's much simpler to use the command line switch when first creating your .spec

Since debugging a one file app is much harder, you should make sure everything is working with a normal build before you create a one-file package.

Setting an application Icon

By default PyInstaller EXE files come with the following icon in place.

Default PyInstaller application icon, on app.exe

You will probably want to customize this to make your application more recognisable. This can be done easily using the --icon=<filename> command-line switch to PyInstaller. On Windows the icon should be provided as an .ico file.

bash pyinstaller --windowed --icon=hand.ico app.py

The portable version of IcoFx is a good free tool to create icons on Windows.

Or, by adding the icon= parameter to your .spec file.

python exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='blarh', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=False, icon='hand.ico')

If you now re-run the build (by using the command line arguments, or running with your modified .spec file) you'll see the specified icon file is now set on your application's EXE file.

Custom application icon (a hand) on app.exe

However, if you run your application, you're going to be disappointed.

The custom EXE icon is not applied to the window

The specified icon is not showing up on the window, and it will also not appear on your taskbar.

Why not? Because the icon used for the window isn't determined by the icons in the executable file, but by the application itself. To show an icon on our window we need to modify our simple application a little bit, to add a call to .setWindowIcon().

python from PyQt5 import QtWidgets, QtGui import sys class MainWindow(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Hello World") l = QtWidgets.QLabel("My simple app.") l.setMargin(10) self.setCentralWidget(l) self.show() if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) app.setWindowIcon(QtGui.QIcon('hand.ico')) w = MainWindow() app.exec()

Here we've added the .setWindowIcon call to the app instance. This defines a default icon to be used for all windows of our application. You can override this on a per-window basis if you like, by calling .setWindowIcon on the window itself.

If you run the above application you should now see the icon appears on the window.

Window showing the custom hand icon

But, unfortunately, it may still not show on the taskbar.

If it does for you, great! But it may not work when you distribute your application, so it's probably a good idea to follow the next steps anyway.

Custom icon is not shown on the toolbar

The final tweak we need to make to get the icon showing on the taskbar is to add some cryptic incantations to the top of our Python file.

When you run your application, Windows looks at the executable and tries to guess what "application group" it belongs to. By default, any Python scripts (including your application) are grouped under the same "Python" group, and so will show the Python icon. To stop this happening, we need to provide Windows with a different application identifier.

The code below does this, by calling ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID() with a custom application id.

python from PyQt5 import QtWidgets, QtGui import sys try: from ctypes import windll # Only exists on Windows. myappid = 'mycompany.myproduct.subproduct.version' windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) except ImportError: pass class MainWindow(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Hello World") l = QtWidgets.QLabel("My simple app.") l.setMargin(10) self.setCentralWidget(l) self.show() if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) app.setWindowIcon(QtGui.QIcon('hand.ico')) w = MainWindow() app.exec()

The listing above shows a generic mycompany.myproduct.subproduct.version string, but you should change this to reflect your actual application. It doesn't really matter what you put for this purpose, but the convention is to use reverse-domain notation, com.mycompany for the company identifier.

With this added to your script, running it should now show the icon on your window and taskbar. The final step is to ensure that this icon is correctly packaged with your application and continues to be shown when run from the dist folder.

Try it, it wont.

The issue is that our application now has a dependency on a external data file (the icon file) that's not part of our source. For our application to work, we now need to distribute this data file along with it. PyInstaller can do this for us, but we need to tell it what we want to include, and where to put it in the output.

In the next section we'll look at the options available to you for managing data files associated with your app.

Data files and Resources

So far we successfully built a simple app which had no external dependencies. However, once we needed to load an external file (in this case an icon) we hit upon a problem. The file wasn't copied into our dist folder and so could not be loaded.

In this section we'll look at the options we have to be able to bundle external resources, such as icons or Qt Designer .ui files, with our applications.

Bundling data files with PyInstaller

The simplest way to get these data files into the dist folder is to just tell PyInstaller to copy them over. PyInstaller accepts a list of individual file paths to copy over, together with a folder path relative to the dist folder where it should to copy them to.

As with other options, this can be specified by command line arguments, --add-data

bash pyinstaller --windowed --icon=hand.ico --add-data="hand.ico;." app.py

You can provide `--add-data` multiple times. Note that the path separator is platform-specific, on Windows use `;` while on Linux or Mac use `:`

Or via the datas list in the Analysis section of the spec file, shown below.

python a = Analysis(['app.py'], pathex=[], binaries=[], datas=[('hand.ico', '.')], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False)

And then execute the .spec file with

bash pyinstaller app.spec

In both cases we are telling PyInstaller to copy the specified file hand.ico to the location . which means the output folder dist. We could specify other locations here if we wanted. On the command line the source and destination are separated by the path separator ;, whereas in the .spec file, the values are provided as a 2-tuple of strings.

If you run the build, you should see your .ico file now in the output folder dist ready to be distributed with your application.

The icon file copied to the dist folder

If you run your app from dist you should now see the icon on the window, and on the taskbar as expected.

The hand icon showing on the toolbar

The file must be loaded in Qt using a relative path, and be in the same relative location to the EXE as it was to the .py file for this to work.

If your icon looks blurry it means you don't have large-enough icon variations in your .ico file. An .ico file can contain multiple different sized icons in the same file. Ideally you want to have 16x16, 32x32, 48x48 and 256x256 pixel sizes included, although fewer will still work.

Bundling data folders

Usually you will have more than one data file you want to include with your packaged file. The latest PyInstaller versions let you bundle folders just like you would files, keeping the sub-folder structure. For example, lets extend our app to add some additional icons, and put them under a folder.

python from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QVBoxLayout, QPushButton, QWidget from PyQt5.QtGui import QIcon try: from ctypes import windll # Only exists on Windows. myappid = 'mycompany.myproduct.subproduct.version' windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) except ImportError: pass import sys class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Hello World") layout = QVBoxLayout() label = QLabel("My simple app.") label.setMargin(10) layout.addWidget(label) button = QPushButton("Push") button.setIcon(QIcon("icons/lightning.png")) button.pressed.connect(self.close) layout.addWidget(button) container = QWidget() container.setLayout(layout) self.setCentralWidget(container) self.show() if __name__ == '__main__': app = QApplication(sys.argv) app.setWindowIcon(QIcon('icons/hand.ico')) w = MainWindow() app.exec()

The icons (PNG files and an ICO file for the Windows file icon) are stored under a subfolder named 'icons'.

bash . &boxvr&boxh&boxh app.py &boxur&boxh&boxh icons &boxur&boxh&boxh lightning.png &boxur&boxh&boxh hand.png &boxur&boxh&boxh hand.ico

If you run this you'll see the following window, with a Window icon and a button icon.

Window with two icons, and a button.

The paths are using the Unix forward-slash / convention, so they are cross-platform for macOS. If you're only developing for Windows, you can use \\

To copy the icons folder across to our build application, we just need to add the folder to our .spec file Analysis block. As for the single file, we add it as a tuple with the source path (from our project folder) and the destination folder under the resulting dist folder.

python # -*- mode: python ; coding: utf-8 -*- block_cipher = None a = Analysis(['app.py'], pathex=[], binaries=[], datas=[('icons', 'icons')], # tuple is (source_folder, destination_folder) hiddenimports=[], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='app2', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=False, disable_windowed_traceback=False, target_arch=None, codesign_identity=None, entitlements_file=None ) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, upx_exclude=[], name='app2')

If you run the build using this spec file you'll see the icons folder copied across to the dist folder. If you run the application from the folder, the icons will display as expected -- the relative paths remain correct in the new location.

Alternatively, you can bundle your data files using Qt's QResource architecture. See our tutorial for more information.

Building a Windows Installer with InstallForge

So far we've used PyInstaller to bundle applications for distribution, along with the associated data files. The output of this bundling process is a folder, named dist which contains all the files our application needs to run.

While you could share this folder with your users as a ZIP file it's not the best user experience. Desktop applications are normally distributed with installers which handle the process of putting the executable (and any other files) in the correct place, adding Start Menu shortcuts and the like.

Now we've successfully bundled our application, we'll next look at how we can take our dist folder and use it to create a Windows installer.

Making sure the build is ready.

If you've followed the tutorial so far, you'll already have your app ready in the /dist folder. If not, or yours isn't working you can also download the source code files for this tutorial which includes a sample .spec file. As above, you can run the same build using the provided app.spec file.

bash pyinstaller app.spec

This packages everything up ready to distribute in the dist/app folder. Run the executable app.exe to ensure everything is bundled correctly, and you should the same window as before with icons visible.

Window with two icons, and a button.

The EXE section in the .spec has a name parameter where you can specify the name of the resulting EXE file. You may want to change this to the name of your application.

Creating an installer

Now we've successfully bundled our application, we'll next look at how we can take our dist folder and use it to create a functioning Windows installer.

To create our installer we'll be using a tool called InstallForge. InstallForge is free and you can download the installer from this page.

We'll now walk through the basic steps of creating an installer with InstallForge. If you're impatient, you can download the finished Installforge Installer here.

General

When you first run InstallForge you'll be presented with this General tab. Here you can enter the basic information about your application, including the name, program version, company and website.

InstallForge initial view, showing General settings

You can also select the target platforms for the installer, from various versions of Windows that are available. For desktop applications you currently probably only want to target Windows 7, 8 and 10.

Setup

Click on the left sidebar to open the "Files" page under "Setup". Here you can specify the files to be bundled in the installer.

Use "Add Files…" and select all the files in the dist/app folder produced by PyInstaller. The file browser that pops up allows multiple file selections, so you can add them all in a single go, however you need to add folders separately. Click "Add Folder…" and add any folders under dist/app such as the PyQt5 folder and icons

InstallForge Files view, add all files & folders to be packaged

Once you're finished scroll through the list to the bottom and ensure that the folders are listed to be included. You want all files and folders under dist/app to be present. But the folder dist/app itself should not be listed.

The default install path can be left as-is. The values between angled brackets, e.g. <company> , are variables and will be filled automatically.

Next, it's nice to allow your users to uninstall your application. Even though it's undoubtedly awesome, they may want to remove it at some time in the future. You can do this under the "Uninstall" tab, simply by ticking the box. This will also make the application appear in "Add or Remove Programs".

InstallForge add Uninstaller for your app

Dialogs

The "Dialogs" section can be used to show custom messages, splash screens or license information to the user. The "Finish" tab lets you control what happens once the installer is complete, and it's helpful here to give the user the option to run your program.

To do this you need to tick the box next to "Run program" and add your own application EXE into the box. Since <installpath>\ is already specified, we can just add app.exe.

InstallForge configure optional run program on finish install

System

Under "System" select "Shortcuts" to open the shortcut editor. Here you can specify shortcuts for both the Start Menu and Desktop if you like.

InstallForge configure Shortcuts, for Start Menu and Desktop

Click "Add…" to add new shortcuts for your application. Choose between Start menu and Desktop shortcuts, and fill in the name and target file. This is the path your application EXE will end up at once installed. Since <installpath>\ is already specified, you simply need to add your application's EXE name onto the end, here app.exe

InstallForge, adding a Shortcut

Build

With the basic settings in place, you can now build your installer.

At this point you can save your InstallForge project so you can re-build the installer from the same settings in future.

Click on the "Build" section at the bottom to open the build panel.

InstallForge, ready to build

Click on the large icon button to start the build process. If you haven't already specified a setup file location you will be prompted for one. This is the location where you want the completed installer to be saved.

Don't save it in your dist folder.

The build process will began, collecting and compressing the files into the installer.

InstallForge, build complete

Once complete you will be prompted to run the installer. This is entirely optional, but a handy way to find out if it works.

Running the installer

The installer itself shouldn't have any surprises, working as expected. Depending on the options selected in InstallForge you may have extra panels or options.

InstallForge, running the resulting installer

Step through the installer until it is complete. You can optionally run the application from the last page of the installer, or you can find it in your start menu.

Our demo app in the Start Menu in the Start Menu on Windows 11

Wrapping up

In this tutorial we've covered how to build your PyQt5 applications into a distributable EXE using PyInstaller, including adding data files along with your code. Then we walked through the process of building the application into a Windows Installer using InstallForge. Following these steps you should be able to package up your own applications and make them available to other people.

For a complete view of all PyInstaller bundling options take a look at the PyInstaller usage documentation.

For more, see the complete PyQt5 tutorial.

Categories: FLOSS Project Planets

This week in KDE: Getting Plasma 5.24 ready for release

Planet KDE - Fri, 2022-01-28 23:34

Plasma 5.24 is almost ready!

I mentioned last week that I haven’t been posting about fixes for regressions in 5.24 that never got released, because there would be too many. Nonetheless people have been working very hard on this, and and we’re down to only 7, with two of them having open merge requests! Working on those is appreciated, as it helps improve the stability of the final release in a week and a half.

15-Minute Bugs Resolved

Current number of bugs: 83, down from 87. Current list of bugs

After waking up the system, the desktop is no longer sometimes shown for a moment before the lock screen appears (David Edmundson, Plasma 5.25)

New Features

Konsole now lets you automatically switch to a different profile when you connect to a specific remote server using SSH (Tomaz Canabrava, Konsole 22.04):

https://i.imgur.com/1NbAIaA.mp4

Dolphin now optionally lets you see image’s dimensions below their icons in icon view (Kai Uwe Broulik, Dolphin 22.04):

Bugfixes & Performance Improvements

Fixed a wide variety of issues with the metadata and lyrics in Elisa’s Now Playing view failing to appear or update properly (Yerrey Dev, Elisa 22.04)

Gwenview now launches a bit faster, particularly when there are a lot of remote mounts (Nicolas Fella, Gwenview 22.04)

Plasma no longer sometimes crashes on login when certain apps that display System Tray items launch automatically (Konrad Materka, Plasma 5.24)

In the Plasma Wayland session, KWin no longer sometimes crashes when dragging screenshots from Spectacle to XWayland apps (David Edmundson, Plasma 5.24)

In the Plasma Wayland session, KWin no longer crashes when you unplug an external monitor that was in “only use external monitor” mode (Xaver Hugl, Plasma 5.24)

In the Plasma Wayland session, when an app is started in fullscreen mode and then made windowed, it will now be placed in a location that respects the current window placement mode, rather than always appearing in the top-left corner of the screen (Vlad Zahorodnii, Plasma 5.24)

In the Plasma Wayland session, screencasting no longer causes the cursor to be visually clipped (Vlad Zahorodnii, Plasma 5.24)

In the Plasma Wayland session, when you unplug and re-plug an external screen, XWayland apps that want to launch on the primary screen (such as many games) no longer to get confused and open on the wrong screen (Aleix Pol Gonzalez, Plasma 5.24)

In the Plasma Wayland session, cursor app launch feedback effects now respect the global timeout value for it that you can set in the System Settings Launch Feedback page (David Redondo, Plasma 5.24)

Keyboard navigation between widgets in the Widget Explorer sidebar now works that way you would expect it to (Noah Davis, Plasma 5.24)

Disk read/write sensors in System Monitor widgets and the app of the same name no longer report bogus values the first time they update (Arjen Hiemstra, Plasma 5.24)

Shrinking System Monitor’s window to a very small size now causes text to properly elide instead of overflow (Arjen Hiemstra, Plasma 5.24)

System Monitor widgets can now be dragged using touch while in Edit Mode (Marco Martin, Plasma 5.24)

Custom icons that use SVG images referred to by their path rather than their name once again appear correctly on folders and apps on the desktop (Fushan Wen, Frameworks 5.91)

Changing any of the standard shortcuts (e.g. for Copy or Paste) on System Settings’ Shortcuts page now takes effect instantly, rather than making you restart first (David Redondo, Frameworks 5.91)

KDE apps like Dolphin that scan for network mounts and disks when launched now launch more quickly when you have a lot of Snap apps installed (Kai Uwe Broulik, Frameworks 5.91)

This isn’t KDE software, but it affected a lot of our users, so I’m listing it here anyway: Firefox no longer constantly asks to be made the default browser on launch when it’s being run with the GTK_USE_PORTAL=1 environment variable (as some distros do by default) to make it use KDE file dialogs instead of GNOME file dialogs (Emilio Cobos Álvarez and Robert Mader, Firefox 98)

User Interface Improvements

The Properties dialog no longer shows the Details tab when everything it contains is already visible on the General tab (Kai Uwe Broulik, Dolphin 22.04)

Dolphin’s shortcuts configuration window now includes shortcuts from Konsole that will be used in the embedded terminal view, so you can re-assign them if you’d like (Stephan Sahm, Dolphin 22.04)

Filelight can now be found by searching for a variety of common keywords like “usage” and “disk space” (Nikolai Weitkemper, Filelight 22.04)

KRunner now returns better search results for very short search strings of only one or two letters (Alexander Lohnau, Plasma 5.24)

You can now find KMenuEdit in app launchers, KRunner, and Discover (me: Nate Graham, Plasma 5.25):

Menu items in QtWidgets-based apps now also become taller when in Tablet Mode, just like menu items in QtQuick apps! However Unlike those, QtWidgets apps will have to be restarted first due to technical limitations (Jan Blackquill, Plasma 5.25)

Task Manager tooltip window thumbnails now smoothly fade in instead of appearing abruptly (Fushan Wen, Plasma 5.25)

Discover now provides an indication of the number of search results and the number of items in the currently viewed category (Aleix Pol Gonzalez, Plasma 5.25):

Spacing between System Tray icons is now configurable, and automatically switches to its widest setting when in Tablet Mode (me: Nate Graham, Plasma 5.25)

System Settings’ Display Configuration page now calls your device’s built-in screen a “Built-in Screen”, rather than assuming it is a laptop and calling it a “Laptop Screen” (David Edmundson, Plasma 5.25)

…And everything else

Keep in mind that this blog only covers the tip of the iceberg! Tons of KDE apps whose development I don’t have time to follow aren’t represented here, and I also don’t mention backend refactoring, improved test coverage, and other changes that are generally not user-facing. If you’re hungry for more, check out https://planet.kde.org/, where you can find blog posts by other KDE contributors detailing the work they’re doing.

How You Can Help

If you’re a developer, check out the list of remaining Plasma 5.24 regressions, or our 15-Minute Bug Initiative. Working on these issues makes a big difference quickly!

Otherwise, have a look at https://community.kde.org/Get_Involved to discover ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite!

Finally, consider making a tax-deductible donation to the KDE e.V. foundation.

Categories: FLOSS Project Planets

Undocumented feature = bug

Planet KDE - Fri, 2022-01-28 18:00

undocumented feature = surprise

surprise = unexpected functionality

unexpected functionality = bug

QED ;)

hook out → packing …

Categories: FLOSS Project Planets

PyCon: Startup Row Applications Are Open, But Not For Long!

Planet Python - Fri, 2022-01-28 14:03

It’s official: PyCon 2022 in Salt Lake City will mark more than a decade of support for early-stage startups, and applications are now open! 

For the “do first and read later” folks reading this, applying for a spot on Startup Row is as easy as creating an account or logging into your existing account on the PyCon 2022 site and submitting an application. Chances are, you’ve already answered very similar questions about your startup before, so the application is quick and straightforward. 

Please submit your application before midnight on February 24, 2022!

About Startup Row

As the name may suggest, Startup Row is a row of booths at PyCon US specially reserved for early-stage companies that use the Python programming language in new and interesting ways.

Since 2011, well over 100 companies have been given the opportunity to share what they’re building (and how they’re building it) with thousands of engineers, scientists, students, tinkerers, and all-around enthusiasts who come to PyCon each year. And after the challenges of 2020 and 2021, the Python Software Foundation and PyCon organizers are thrilled to bring back the in-person experience for all who can attend.

Below are some FAQs.

Does my startup qualify? 

Here are the criteria:

  • You use Python somewhere in your tech or business stack (open source, proprietary, data science, machine learning, orchestration, marketing automation… it all counts).
  • Your startup is roughly 2.5 years old, or less, at time of applying (if you had a major pivot or delayed product launch, measure from there).
  • You have 15 or fewer full-time employees at the time of applying.
  • You or your company will fund travel and accommodation to PyCon US in Salt Lake City, Utah. (More info about the venue and nearby hotels can be found on the Venue and Hotels page of the PyCon website.)
  • Your company has not previously presented on Startup Row at PyCon (if you applied before but didn’t make it, you’re encouraged to apply again!)
We understand the past couple of years have been weird, so if you're just outside of these criteria you're welcome to apply anyways.What’s in it for me and my company?If selected, Startup Row companies are granted:
  • Two conference passes (you’re welcome to stay for the post-conference sprints, too!)
  • Booth space on Startup Row in the Expo Hall on April 29th and April 30th
  • An (optional) table at the PyCon Jobs Fair on May 1st (After all, there’s no better place to recruit great engineers and data science folks than PyCon)
  • Placement on the PyCon 2022 website and a featured mention on the PyCon blog
  • Eternal glory
How do I apply with my startup?Applying for a spot on Startup Row is easy! Here’s how to do it:
  1. First, either create an account or log into your existing account (if you created an account for a previous PyCon, you’ll have to create and confirm a new one)
  2. Fill out the Startup Row application (a link to which can also be found at the bottom of the Startup Row page on the PyCon site) by February 24, 2022
  3. Wait to hear back from the selection committee! If selected, you’ll be notified in early March, giving you plenty of time to complete registration and arrange travel.
Again, the deadline to apply is February 24, 2022 by 11:59 PM Pacific Time.
Where can I learn more about Startup Row?More information (including founder testimonials) can be found on the Startup Row page on the PyCon website. You’ll also find the application link at the bottom of that page.
Who do I contact with questions about Startup Row?

First off, you’re always welcome to send an email to the PyCon organizing team at pycon-reg@python.org if you have questions about the conference itself. 

For questions specifically about Startup Row, please reach out to co-chair Jason Rowley via email at jasondonaldrowley [at] gmail [dot] com or on twitter [at] jason_rowley.

Lastly, what is PyCon doing to keep attendees safe?

Following public health guidelines, PyCon 2022 will require proof of vaccination in order to attend PyCon in person. Masks will also be required indoors, with exceptions for specific circumstances such as eating.

More up-to-date information can be found on the Health and Safety Guidelines page.

Since Startup Row is an in-person feature of PyCon US 2022, people who are not vaccinated or are unwilling to adhere to mask requirements cannot be accommodated. Your understanding is appreciated.

Wait, what’s the deadline again?

The deadline to apply is February 24, 2022 by 11:59 PM Pacific Time. 

We look forward to reviewing your application. See you at PyCon!

Categories: FLOSS Project Planets

Real Python: The Real Python Podcast – Episode #95: What Is a JIT and How Can Pyjion Speed Up Your Python?

Planet Python - Fri, 2022-01-28 07:00

How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10.

[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]

Categories: FLOSS Project Planets

Stack Abuse: Split Train, Test and Validation Sets with Tensorflow Datasets - tfds

Planet Python - Fri, 2022-01-28 06:30
Introduction

Tensorflow Datasets, also known as tfds is is a library that serves as a wrapper to a wide selection of datasets, with proprietary functions to load, split and prepare datasets for Machine and Deep Learning, primarily with Tensorflow.

Note: While the Tensorflow Datasets library is used to get data, it's not used to preprocess data. That job is delegated to the Tensorflow Data (tf.data) library.

All of the datasets acquired through Tensorflow Datasets are wrapped into tf.data.Dataset objects - so you can programmatically obtain and prepare a wide variety of datasets easily! One of the first steps you'll be taking after loading and getting to know a dataset is a train/test/validation split.

In this guide, we'll take a look at what training, testing and validation sets are before learning how to load in and perform a train/test/validation split with Tensorflow Datasets.

Training and Testing Sets

When working on supervised learning tasks - you'll want to obtain a set of features and a set of labels for those features, either as separate entities or within a single Dataset. Just training the network on all of the data is fine and dandy - but you can't test its accuracy on that same data, since evaluating the model like that would be rewarding memorization instead of generalization.

Instead - we train the models on one part of the data, holding off a part of it to test the model once it's done training. The ratio between these two is commonly 80/20, and that's a fairly sensible default. Depending on the size of the dataset, you might opt for different ratios, such as 60/40 or even 90/10. If there are many samples in the testing set, there's no need to have a large percentage of samples dedicated to it. For instance, if 1% of the dataset represents 1.000.000 samples - you probably don't need more than that for testing!

For some models and architectures - you won't have any test set at all! For instance, when training Generative Adversarial Networks (GANs) that generate images - testing the model isn't as easy as comparing the real and predicted labels! In most generative models (music, text, video), at least as of now, a human is typically required to judge the outputs, in which cases, a test set is totally redundant.

The test set should be held out from the model until the testing stage, and it should only ever be used for inference - not training. It's common practice to define a test set and "forget it" until the end stages where you validate the model's accuracy.

Validation Sets

A validation set is an extremely important, and sometimes overlooked set. Validation sets are oftentimes described as taken "out of" test sets, since it's convenient to imagine, but really - they're separate sets. There's no set rule for split ratios, but it's common to have a validation set of similar size to the test set, or slightly smaller - anything along the lines of 75/15/10, 70/15/15, and 70/20/10.

A validation set is used during training, to approximately validate the model on each epoch. This helps to update the model by giving "hints" as to whether it's performing well or not. Additionally, you don't have to wait for an entire set of epochs to finish to get a more accurate glimpse at the model's actual performance.

Note: The validation set isn't used for training, and the model doesn't train on the validation set at any given point. It's used to validate the performance in a given epoch. Since it does affect the training process, the model indirectly trains on the validation set and thus, it can't be fully trusted for testing, but is a good approximation/proxy for updating beliefs during training.

This is analogous to knowing when you're wrong, but not knowing what the right answer is. Eventually, by updating your beliefs after realizing you're not right, you'll get closer to the truth without explicitly being told what it is. A validation set indirectly trains your knowledge.

Using a validation set - you can easily interpret when a model has begun to overfit significantly in real-time, and based on the disparity between the validation and training accuracies, you could opt to trigger responses - such as automatically stopping training, updating the learning rate, etc.

Split Train, Test and Validation Sets using Tensorflow Datasets

The load() function of the tfds module loads in a dataset, given its name. If it's not already downloaded on the local machine - it'll automatically download the dataset with a progress bar:

import tensorflow_datasets as tfds # Load dataset dataset, info = tfds.load("cifar10", as_supervised=True, with_info=True) # Extract informative features class_names = info.features["label"].names n_classes = info.features["label"].num_classes print(class_names) # ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] print(n_classes) # 10

One of the optional arguments you can pass into the load() function is the split argument.

The new Split API allows you to define which splits of the dataset you want to split out. By default, it only supports a 'train' and 'test' split - these are the "official" splits. There's no valid split!

They correspond to the tfds.Split.TRAIN and tfds.Split.TEST enums, which used to be exposed through the API in an earlier version. It's curious to note that tfds.Split.VALIDATION does exist, but doesn't have a string represented alias in the new API.

It's worth noting that the strings used to name these aren't really relevant, as long as you achieve the right proportions.

You can really slice a Dataset into any arbitrary number of sets, though, we typically do three - train_set, test_set, valid_set:

test_set, valid_set, train_set = tfds.load("cifar10", split=["train[:10%]", "train[10%:25%]", "train[25%:]"], as_supervised=True) print("Train set size: ", len(train_set)) # Train set size: 37500 print("Test set size: ", len(test_set)) # Test set size: 5000 print("Valid set size: ", len(valid_set)) # Valid set size: 7500

We've taken out the first 10% of the dataset, and extracted it into the test_set. The slice between 10% and 25% is assigned to the valid_set and everything beyond 25% is the train_set. This is validated through the sizes of the sets themselves as well.

Note: It's worth noting that we've used the train split, even though we split the dataset into other sets as well. Again, the only two accepted strings are train and test, but these don't really mean anything other than to let you know which parts are which.

Instead of percentages, you can use absolute values or a mix of percentage and absolute values:

# Absolute value split test_set, valid_set, train_set = tfds.load("cifar10", split=["train[:2500]", "train[2500:5000]", "train[5000:]"], as_supervised=True) print("Train set size: ", len(train_set)) # Train set size: 45000 print("Test set size: ", len(test_set)) # Test set size: 2500 print("Valid set size: ", len(valid_set)) # Valid set size: 2500 # Mixed notation split # 5000 - 50% (25000) left unassigned test_set, valid_set, train_set = tfds.load("cifar10", split=["train[:2500]", # First 2500 are assigned to `test_set` "train[2500:5000]", # 2500-5000 are assigned to `valid_set` "train[50%:]"], # 50% - 100% (25000) assigned to `train_set` as_supervised=True)

You can additionally do a union of sets, which is less commonly used, as sets are interleaved then:

train_and_test, half_of_train_and_test = tfds.load("cifar10", split=['train+test', 'train[:50%]+test'], as_supervised=True) print("Train+test: ", len(train_and_test)) # Train+test: 60000 print("Train[:50%]+test: ", len(half_of_train_and_test)) # Train[:50%]+test: 35000

These two sets are now heavily interleaved.

Even Splits for N Sets

Again, you can create any arbitrary number of splits, just by adding more splits to the split list:

split=["train[:10%]", "train[10%:20%]", "train[20%:30%]", "train[30%:40%]", ...]

However, if you're creating many splits, especially if they're even - the strings you'll be passing in are very predictable. This can be automated by creating a list of strings, with a given equal interval (such as 10%) instead. For exactly this purpose, the tfds.even_splits() function generates a list of strings, given a prefix string and the desired number of splits:

import tensorflow_datasets as tfds s1, s2, s3, s4, s5 = tfds.even_splits('train', n=5) # Each of these elements is just a string split_list = [s1, s2, s3, s4, s5] print(f"Type: {type(s1)}, contents: '{s1}'") # Type: <class 'str'>, contents: 'train[0%:20%]' for split in split_list: test_set = tfds.load("cifar10", split=split, as_supervised=True) print(f"Test set length for Split {split}: ", len(test_set))

This results in:

Test set length for Split train[0%:20%]: 10000 Test set length for Split train[20%:40%]: 10000 Test set length for Split train[40%:60%]: 10000 Test set length for Split train[60%:80%]: 10000 Test set length for Split train[80%:100%]: 10000

Alternatively, you can pass in the entire split_list as the split argument itself, to construct several split datasets outside of a loop:

ts1, ts2, ts3, ts4, ts5 = tfds.load("cifar10", split=split_list, as_supervised=True) Conclusion

In this guide, we've taken a look at what the training and testing sets are as well as the importance of validation sets. Finally, we've explored the new Splits API of the Tensorflow Datasets library, and performed a train/test/validation split.

Categories: FLOSS Project Planets

OpenSense Labs: The ideal Drupal 9 developer

Planet Drupal - Fri, 2022-01-28 06:06
The ideal Drupal 9 developer Maitreayee Bora Fri, 01/28/2022 - 16:36

Drupal can be seen emerging as one of the leading CMS for organizations today. Therefore, organizations are presently migrating to the latest released version of Drupal 9. Are you also planning to do the same? But for that, you’ll need the help of Drupal 9 experts. So, do you know exactly what is the expertise of a Drupal 9 developer based on which you can trust them to assist you with the migration process? This article helps you with all the required information and knowledge that can further enable you to choose the right Drupal 9 developer.  

Who can be your ideal Drupal 9 developer? 

This is when the real challenge begins. You’ll have to choose the best Drupal 9 developer for the migration process which is the need of the hour. So, how will you make the right choice? It’s something to ponder about. Well, without taking much of your time, let me just help you catch on to the expertise that a Drupal 9 developer should possess.  

Knowing the basics is a must 

If you want to experience a successful migration then you must find a Drupal 9 developer who is well versed with the very Drupal basics. To be more precise, he or she should be fully aware of the recent Drupal developments, latest and upcoming Drupal releases such as Drupal 9.1, Drupal 9.2, and Drupal 9.3 which were released recently and about the upcoming release of Drupal 9.4 and Drupal 10 in  2022. Keeping in mind about the new Olivero frontend theme which was added in Drupal 9.1.0 can be of great benefit for the Drupal 9 developers. Improvements in installer performance and frontend performance, enhanced security provisions, various additions to Claro administration theme, support for WebP image format, and support for CKEditor 5 are some of the recent developments that have happened in Drupal 9 minor releases and that every Drupal 9 developer should know about when building and maintaining a Drupal 9 site.

Moving forward let me now talk about the upgrade tools. So, it is essentially important for a Drupal 9 developer to be well equipped with knowledge on the right tools that are required in the Drupal 9 upgrade process. You can read more about Drupal 9 upgrade tools here.

And finally, how can we forget about the significant new Drupal 9 features? The new capabilities added to Drupal 9 such as replacing Symfony 3 with Symfony 4, removing the support for deprecated codes in D8, and replacing Panelizer with the Layout Builder and others should be in the know-how of the Drupal 9 developers at the time of migration. 

Well certified professional

It’s quite obvious that Acquia-certified professionals are mostly preferred. So, you’ll have to prioritize Drupal 9 developers who are awarded Acquia’s Drupal development, site building, front-end development, and backend development certifications for their great work efficiency.

Let me also tell you that we at OpenSense Labs have our own proficient Acquia-certified Drupal developers. And most proudly, we have an Acquia Certified Drupal 9 developer, Pritish Kumar, who is a Technical Lead at OpenSense Labs. 


Good knowledge of PHP, & PHP Frameworks

As we are familiar with the fact that Drupal 7 was built using PHP, and Drupal 8 was built using Symfony, (a PHP framework), therefore, it’s important for a Drupal 9 developer to be well aware of PHP and PHP frameworks. Also, to set up a Drupal database, it is essential to have a proper understanding of MySQL. So, these are some of the expertise which a Drupal 9 developer cannot afford to miss on. Check out this guide on updating PHP to get the download of PHP and its frameworks and why you need to be updated.

Hands-on experience in installing and creating Drupal modules

Since Drupal modules allow you to integrate many third-party services and tools with your website. In such a manner, your website can possibly become a hub for acquiring most of your routinely used tools from one place, additionally a much more highly customized tool for your website visitors to use. Well, there isn’t any particular set of lists for specific modules that your Drupal 9 developer should include in your website, but he or she should usually be familiar with installing the views module, panels module, and cTools module. Additionally, your Drupal 9 developer needs to know how to develop modules by himself. Learn more about the key modules to start your Drupal 9 site here.

Proper understanding of Drupal theme development

Your Drupal 9 developer should have a proper understanding of the Drupal theme development. Do you want to know why? It’s because the theme of your website plays a significant role in influencing the appearance of your site (or user interface) and also the user experience you offer. Therefore, having a good understanding of UI/UX design is highly recommended. The Drupal community facilitates with a thousand themes to choose from (over 2,000+ at the moment), you will find that most of the themes will meet your design requirements but not all of them. So, if you want a unique theme for your website then your Drupal 9 developer should be able to build a custom theme matching your expectations. 

Good hold on version control with Git

You must be knowing that Git and GitHub are used by developers to attain version control over project sizes and types. So, utilizing Git and GitHub have commonly become standard practice, and you will feel relief in knowing that your Drupal 9 developer uses these tools as well. It is seen that Git on its own helps developers to work more efficiently by making it simpler for them to manage their project files. Furthermore, by storing code in a GitHub repository, for instance, your developer is able to store the code for every version of your Drupal project he or she builds. In that particular way, even if in the future something goes wrong with the code, your Drupal 9 developer will be able to revert it back to a prior version. 

Proficient in debugging and updating a Drupal site

Along with utilizing Git version control, another significant skill that Drupal 9 developers must have is the capability to recognize bugs in their code while they write it. Even if no Drupal 9 developer is able to identify every potential error or issue during the coding procedure, but if he or she is able to at least address errors during the coding procedure, it can save a lot of time and prevent further issues from occurring in the future. Although debugging during the developing process is beneficial, addressing bugs that arise after the site goes live is even more essential. But again, not all the Drupal 9 developers provide post-launch maintenance, if they do then they can certainly ensure that your website is bug-free, up-to-date, and offering the perfect user experience for your users.

A strong grip on the frontend languages

Are you familiar with the fact that a Drupal 9 developer must be essentially well-versed with JavaScript? Well, there is a need to specifically know jQuery - a JavaScript library that helps in carrying out standard DOM (Document Object Model) and AJAX functions. Moreover, working experience with Angular, React, or Vue can be an added advantage for a Drupal 9 developer as one of these JavaScript frameworks can be used as a frontend of a headless Drupal solution. 

An active participant in the Drupal community 

Last but not the least, a Drupal 9 developer need to actively contribute to the Drupal community so that if ever an issue is being identified, he or she should be able to fix it and share the patch or even report the issue to the community where other people can help him/her to resolve it.

Learn more:

Conclusion

Well, you will find many Drupal 9 developers but the biggest challenge is to find the right one who can offer you the best quality services. I am still hoping that after understanding the above-mentioned skills, you will be able to choose the perfect Drupal 9 developer, or team of developers, who can make your Drupal project a huge success.

I think you can finish up your search here with us since, in OSL, you will find Drupal 9 experts who can successfully build your Drupal projects in accordance with your expectations and within the stipulated time period. So, what are you waiting for? Let’s talk.

Articles Off
Categories: FLOSS Project Planets

Web Review, Week 2022-04

Planet KDE - Fri, 2022-01-28 05:43

Let’s go for my web review for the week 2022-04.

Nvidia (NVDA) Quietly Prepares to Abandon $40 Billion Arm Bid - Bloomberg

Tags: tech, business, arm, nvidia

This is likely for the best.

https://www.bloomberg.com/news/articles/2022-01-25/nvidia-is-said-to-quietly-prepare-to-abandon-takeover-of-arm


How E Ink Developed Full-Color e-Paper

Tags: tech, display, e-ink

Very interesting story (even though it feels a bit like advertisements at times) about the quest to get color into e-ink displays. Goes on to explain a bit of the technology behind those.

https://spectrum.ieee.org/how-e-ink-developed-full-color-epaper


LogJ4 Security Inquiry – Response Required | daniel.haxx.se

Tags: tech, security, foss

This is… whoa… such a level of incompetency is incredible.

https://daniel.haxx.se/blog/2022/01/24/logj4-security-inquiry-response-required/


Over 90 WordPress themes, plugins backdoored in supply chain attack

Tags: tech, security, supply-chain, wordpress

Now this is a really bad supply-chain attack for the WordPress ecosystem.

https://www.bleepingcomputer.com/news/security/over-90-wordpress-themes-plugins-backdoored-in-supply-chain-attack/


Google Details Two Zero-Day Bugs Reported in Zoom Clients and MMR Servers

Tags: tech, zoom, security

Also a good reminder of why the fact that it’s proprietary makes things harder security wise.

https://thehackernews.com/2022/01/google-details-two-zero-day-bugs.html


Block Protocol - an open standard for data-driven blocks

Tags: tech, interoperability, api

That looks like an interesting way to share data between applications. Reminds a bit of the semantic web movement back in early 2000s (talking entities and aggregates), maybe less heavy on the schema side though. I’d need to look at the specification more.

https://blockprotocol.org/


Scrum Rant

Tags: tech, scrum, xp, craftsmanship

Or why I’m actually glad I’m not certified even though I could be. This is a good way to stay balanced about all this. At least I’m trying to do my part trying to help people also on the technical areas which are mostly ignored by the “Scrum Industrial Complex” (as Ron Jeffries puts it). Clearly the scrum organizations are not interested in taking up that mantle so it falls onto us.

https://ronjeffries.com/articles/-z022/01121/scrum-rant/


Pass-by-value, reference, and assignment | Pydon’t 🐍 | Mathspp

Tags: tech, programming, python

Good explanation of the Python object model and how parameters are passed to functions. This can look rather surprising or confusing if you come from another language. Always keep in mind: mutability and the fact that variable name are just labels play a big role in this. That means you might need to copy explicitly in the case of mutable objects… which makes the performance burden explicit as well (and this means you need to pick between shallow or deep copying).

PS: I really mean “label” here (like in the post), it’s a bit different from “pointer” since you don’t get the pointer geometry (you can only reassign). From the C++ perspective I’d say it behaves as if all variables were “reassignable non-const references” only, something like that.

https://mathspp.com/blog/pydonts/pass-by-value-reference-and-assignment


Don’t Wrap Instance Methods with ‘functools.lru_cache’ Decorator in Python · Redowan’s Reflections

Tags: tech, programming, python

Interesting caveat on how lru_cache is used in Python.

https://rednafi.github.io/reflections/dont-wrap-instance-methods-with-functoolslru_cache-decorator-in-python.html


systemd by example - the systemd playground

Tags: tech, linux, systemd

Nice way to learn systemd uses.

https://systemd-by-example.com/


Five Easy to Miss PostgreSQL Query Performance Bottlenecks

Tags: tech, databases, performance, postgresql

Interesting tips for potential bottlenecks in your queries.

https://pawelurbanek.com/postgresql-query-bottleneck


Improving end to end tests reliability / frantic.im

Tags: tech, tests

Good guidelines to improve end to end tests. I especially relate to the first one, the test API is very important for those, otherwise they become a chore to maintain and understand.

https://frantic.im/e2e-tests/


API development with type-safety across the entire stack

Tags: tech, services, api

A bit on the fence with this still… but that sounds like an interesting path to explore in dealing with service APIs. A DSL with a code generator allows to neatly separate concerns if done properly. I wonder where the catches are (apart from the obvious strong coupling to Golang in that particular case).

https://blog.lawrencejones.dev/goa/


Type-Driven Development - IMAP parsing

Tags: tech, type-systems, rust, imap

Interesting example of using a strong type system to avoid mistakes in code using a parsing and serialization library. The fact that it’s about IMAP and I’m still traumatized by it has nothing to do with my interest in that article, really.

https://duesee.dev/p/type-driven-development/


Static Typing Python Decorators · Redowan’s Reflections

Tags: tech, programming, python, type-systems, mypy, pyright

Type annotations become quickly complex with Python. This is in part because it’s rolled out incrementally on top or existing practices. Here it collides a bit with decorators. Nice to see this hole is getting plugged though. Also nice to discover an alternative to mypy which seems a bit more precise (at least for the time being).

https://rednafi.github.io/reflections/static-typing-python-decorators.html


Why Static Languages Suffer From Complexity

Tags: tech, programming, type-systems

Lots of food for thought in that article. Shows very well some of the trade offs in complexity languages have to deal with when they bring a strong type system to the table. Hence some limitations being in place… and that’s why it can get into nasty metaprogramming territory quickly. This show a couple of interesting examples on how this can be mitigated although we don’t have any perfect solution yet.

https://hirrolot.github.io/posts/why-static-languages-suffer-from-complexity


Stop paying tech debts, start maintaining code

Tags: tech, technical-debt, maintenance, complexity

Good reminder of why “tech debt” is not a so bright metaphor. I find it useful sometimes but clearly it became overused in the industry (often a sign of something loosing its meaning whatever it was). That’s why lately I’m talking about complexity, some of it being legitimate so you need to keep the illegitimate one at bay. I like the focus on maintenance in that post. Also there are a couple of good ideas on how to schedule the maintenance tasks in your project.

https://blog.testdouble.com/posts/2022-01-20-stop-paying-debts-start-maintaining-code/


Bye for now!

Categories: FLOSS Project Planets

Test and Code: 177: Unit Test vs Integration Test and The Testing Trophy

Planet Python - Fri, 2022-01-28 00:15

A recent Twitter thread by Simon Willison reminded me that I've been meaning to do an episode on the testing trophy.
This discussion is about the distinction between unit and integration tests, what those terms mean, and where we should spend our testing time.

Sponsored By:

Support Test & Code in Python

Links:

<p>A recent Twitter thread by Simon Willison reminded me that I&#39;ve been meaning to do an episode on the testing trophy.<br> This discussion is about the distinction between unit and integration tests, what those terms mean, and where we should spend our testing time.</p><p>Sponsored By:</p><ul><li><a href="https://try.rollbar.com/testandcode/?utm_campaign=testandcode" rel="nofollow">Rollbar</a>: <a href="https://try.rollbar.com/testandcode/?utm_campaign=testandcode" rel="nofollow">Rollbar enables developers to proactively discover and resolve issues in their code, so they can work on continuous code improvement throughout the software development lifecycle. Learn more at [Rollbar.com](https://try.rollbar.com/testandcode/?utm_campaign=testandcode ) </a></li><li><a href="https://testandcode.com/pycharm" rel="nofollow">PyCharm Professional</a>: <a href="https://testandcode.com/pycharm" rel="nofollow">Try PyCharm Pro for 4 months and learn how PyCharm will save you time.</a> Promo Code: TESTANDCODE22</li></ul><p><a href="https://www.patreon.com/testpodcast" rel="payment">Support Test & Code in Python</a></p><p>Links:</p><ul><li><a href="https://twitter.com/simonw/status/1485700771031117824" title="Simon Willison's Twitter Thread" rel="nofollow">Simon Willison's Twitter Thread</a></li><li><a href="https://kentcdodds.com/blog/the-testing-trophy-and-testing-classifications" title="The Testing Trophy and Testing Classifications" rel="nofollow">The Testing Trophy and Testing Classifications</a> &mdash; Kent C Dodds</li><li><a href="https://kentcdodds.com/blog/write-tests" title="Write tests. Not too many. Mostly integration." rel="nofollow">Write tests. Not too many. Mostly integration.</a> &mdash; Kent C Dodds</li><li><a href="https://martinfowler.com/articles/2021-test-shapes.html" title="On the Diverse And Fantastical Shapes of Testing" rel="nofollow">On the Diverse And Fantastical Shapes of Testing</a> &mdash; Martin Fowler</li></ul>
Categories: FLOSS Project Planets

Reproducible Builds (diffoscope): diffoscope 202 released

Planet Debian - Thu, 2022-01-27 19:00

The diffoscope maintainers are pleased to announce the release of diffoscope version 202. This version includes the following changes:

[ Chris Lamb ] * Don't fail if comparing a nonexistent file with a .pyc file (and add test). (Closes: #1004312) * Drop a reference in the manual page which claims the ability to compare non-existent files on the command-line. This has not been possible since version 32 which was released in September 2015. (Closes: #1004182) * Add experimental support for incremental output support with a timeout. Passing, for example, --timeout=60 will mean that diffoscope will not recurse into any sub-archives after 60 seconds total execution time has elapsed and mark the diff as being incomplete. (Note that this is not a fixed/strict timeout due to implementation issues.) (Closes: reproducible-builds/diffoscope#301) * Don't return with an exit code of 0 if we encounter device file such as /dev/stdin with human-readable metadata that matches literal, non-device, file contents. (Closes: #1004198) * Correct a "recompile" typo. [ Sergei Trofimovich ] * Fix/update whitespace for Black 21.12.

You find out more by visiting the project homepage.

Categories: FLOSS Project Planets

Jonathan Dowland: Using an iPad for note-taking in talks

Planet Debian - Thu, 2022-01-27 16:39

I've found that using a laptop during conference talks means you either end up doing something else and missing important bits of the talk, or at least look like you're doing something else. But it's extremely helpful to be able to look up the person who is talking, or their project, or expand an acronym that's mentioned or read around the subject.

At December's uksystems21 conference, I experimented with using an iPad as a kind of compromise. Modern iOS versions let you split the display between two apps1, so I put the built-in Notes app on one side and a web browser on the other. I took notes using the Apple Pencil. I've got a "paper-like" rough surface display protector on the front which vastly improves the experience of using the Apple Pencil for writing2.

An example of note-taking and researching talks on an iPad.

I mostly took notes on the active talk, but I also tweaked my own slides3, looked up supplementary information about the topic and the talker, and things like that. It worked really well: much better than I expected.

Apple's split-screen implementation is clunky but essential to make this work. The textured surface protector is a serious improvement over the normal surface for writing. But most importantly I didn't lose focus over the talks, and I don't think I looked like I did either.

  1. Yes, this is something that some Android vendors have supported for years. I remember playing around with Samsung Galaxy Notes when I was still in IT and being pretty impressed. On the other hand, I'd bet not 1% of those tablets are still running Today. My iPad Mini from that time still is, albeit vastly diminished.
  2. It's still not as good as the Remarkable, but that's a topic for another blog post.
  3. A tiny bit. Not serious reworking. Just nervous last minute tweaks that I could probably have not bothered with at all. I'm one of those people who does that right up to the wire.
Categories: FLOSS Project Planets

DevCollaborative - Planet Drupal: Enhance Your Drupal Website's Authoring Experience Part 2 - Declutter the User Interface

Planet Drupal - Thu, 2022-01-27 14:01
In our first post, we saw the big difference that switching our Drupal website to the Gin admin theme can make for sighted users. Gin’s approach to spacing, its clean icons and soft color palette allows the elements on the page to breathe more freely (and we authors as well!). There are so many elements on this page, however, that the interface can still feel overwhelming. We have some tips to help make things better. 
Categories: FLOSS Project Planets

poke @ Savannah: GNU poke 2.0 released

GNU Planet! - Thu, 2022-01-27 13:25

I am happy to announce a new major release of GNU poke, version 2.0.

This release is the result of a full year of development.  A lot of things have changed and improved with respect to the 1.x series; we have fixed many bugs and added quite a lot of new exciting and useful features.

See the complete release notes at https://jemarch.net/poke-2.0-relnotes.html for a detailed description of what is new in this release.

We have had lots of fun and learned quite a lot in the process; we really wish you will have at least half of that fun using this tool!

The tarball poke-2.0.tar.gz is now available at https://ftp.gnu.org/gnu/poke/poke-2.0.tar.gz.

> GNU poke (http://www.jemarch.net/poke) is an interactive, extensible editor for binary data.  Not limited to editing basic entities such as bits and bytes, it provides a full-fledged procedural, interactive programming language designed to describe data structures and to operate on them.


Thanks to the people who contributed with code and/or documentation to this release.  In certain but no significant order they are:

  • Mohammad-Reza Nabipoor
  • Luca Saiu
  • Bruno Haible
  • Egeyar Bagcioglu
  • David Faust
  • Guillermo E. Martinez
  • Konstantinos Chasialis
  • Matt Ihlenfield
  • Thomas Weißschuh
  • Sergei Trofimovich
  • Fangrui Song
  • Indu Bhagat
  • Jordan Yelloz
  • Morten Linderud
  • Sergio Durigan Junior

As always, thank you all!

Happy poking!

--
Jose E. Marchesi
Frankfurt am Main
28 February 2022

Categories: FLOSS Project Planets

KDE Gear 22.04 release schedule finalized

Planet KDE - Thu, 2022-01-27 13:09

It is available at the usual place https://community.kde.org/Schedules/KDE_Gear_22.04_Schedule

 
Dependency freeze is in six weeks (March 10) and Feature Freeze a week after that, make sure you start finishing your stuff!

Categories: FLOSS Project Planets

Spotlight on Libre Space Foundation, OSI Associate Member

Open Source Initiative - Thu, 2022-01-27 11:32

Did you know that one of OSI’s members is leading the effort to take open source to infinity and beyond?! Libre Space Foundation (LSF) is a non-profit foundation registered in Greece whose vision is “an Open and Accessible Outer Space for all.” The organization works to promote, advance and develop free and open source technologies and knowledge for space.

Recently, Libre Space Foundation, on behalf of the OpenSatCom.org activity of the European Space Agency, partnered with Inno3 to investigate open source development models in the satellite communications industry and share their findings in a report. As the authors explain, “..the SATCOM industry has been traditionally multiple vertical ecosystems and moved towards some standardization (through efforts like CCSDS, ECSS, DVB, etc.) on various of its parts. Yet it is far from an Open Ecosystem and specific actions should be taken to explore this direction for the benefit of the SATCOM industry.”

The publicly available report first offers a general overview of open source business models and then explores open source development methods in the context of specific industries/ecosystems:

  • The Linux kernel
  • GIS
  • Automotive
  • Terrestrial communications, including Virtual Radio Access Networks
  • Telecom

The report suggests most relevant open source models for each of seven different domains of the SATCOM industry (see figure at right).

In addition, the report links to an inventory of 78 existing open source software, hardware and specification projects relevant to the satellite communications.

Space is yet another domain where open source software, hardware and standards are very relevant and where the collaboration allowed by open source licenses will allow for faster progress of science. We applaud and support LSF’s efforts to expand the benefits of open source to those exploring the final frontier.

if(window.strchfSettings === undefined) window.strchfSettings = {};window.strchfSettings.stats = {url: "https://open-source-initiative.storychief.io/spotlight-on-libre-foundation-osi-associate-member?id=1984417625&type=3",title: "Spotlight on Libre Space Foundation, OSI Associate Member",id: "d41e8c3e-e034-48f3-84d1-20372c1b1028"};(function(d, s, id) {var js, sjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {window.strchf.update(); return;}js = d.createElement(s); js.id = id;js.src = "https://d37oebn0w9ir6a.cloudfront.net/scripts/v0/strchf.js";js.async = true;sjs.parentNode.insertBefore(js, sjs);}(document, 'script', 'storychief-jssdk'))
Categories: FLOSS Research

EuroPython: EuroPython January 2022 Newsletter

Planet Python - Thu, 2022-01-27 11:30

Welcome to the first EuroPython Newsletter! We hope to regularly share with you news about the EuroPython Society, updates on the upcoming EuroPython conference and cool Python things happening around us!

&#x1F4DD; EuroPython Society UpdateEPS 2021-2022 Board

The last General Assembly (GA) took place on 10 Oct 2021, when our members elected a new board. You can learn more about each of them here or catch up with the GA recording.

Greetings from the EPS 2021-2022 Board

The entire board are very excited to continue serving the community! Drop an email any time for any improvement ideas, fun projects they should know about or just say hi!

2021 Q4 Fellows

We are overjoyed to announce the Q4 EuroPython Fellows: Giovanni Bajo, John Pinner (posthumously), Rob Collins (posthumously), Valeria Pettorino, Harald Armin Massa, Marc-André Lemburg, Artur Czepiel and Patrick Guido Arminio.

You can read about their contributions to the Society and the conferences, and join us in raising a toast to them!

&#x1F48C;Know someone who should be a EuroPython Fellow? Learn how to send in a nomination for the next quarter!&#x1F340; EuroPython 2022 Conference Update

We have resumed discussions with the team at The CCD in Dublin. Reacquainting ourselves with The CCD’s beautiful rooms, food & beverages offerings, we have our fingers firmly crossed for EuroPython 2022 to finally take place in Dublin on 11-17 July!

&#x1F4A1;We are also investigating hybrid options to cater to the Pythonistas that cannot join us in Dublin. If you come across any hybrid solutions that impressed you, hit the reply button and share them with us! &#x1F496;

We have also been making some changes to the internal volunteer team structure. We hope to share more details in February and start working with you to build EuroPython 2022!

&#x1F397;️ Upcoming Python Events&#x1F5D3;️If you have a cool Python event and want to be featured, hit the reply button and write to us!FOSDEM 2022 (5-6 February 2022)

February is always made brighter because of FOSDEM! EuroPython 2021 learned much of how to do online from FOSDEM. "e are sure to be meeting, learning, and sharing online again this year! See you in the Python Track and beyond!

Python Ireland Meetup (9 February 2022 - Looking for Speakers)

If you are like us who cannot wait any longer to meet more Pythonistas in Ireland, then join them in their February Meetup on Wednesday, 9 February 18:30- 20:30 online! You can submit a talk proposal here: http://python.ie/meetups

PyLadies Dublin Meetup (15 February 2022 - Looking for Speakers)

In this Valentine’s special event, PyLadies Dublin teamed up with PyLadies Munich to share extra love with you! Submit your talk to speak at the special event here: https://share-eu1.hsforms.com/1JaDd_XRCQFKb3cp0akbz8Af1bg5

Python Web Conference (21-26 March 2022)

Early bird tickets for the 4th annual Python Web Conference are available until 1 February! You can use our community sponsor code — EuroPython@PWC2022 — to get an EXTRA 15% off: https://t.co/BQsi9NOeXp

PyCon DE and PyData Berlin (11-13 April 2022)

The wait is over and PyCon DE and PyData Berlin are returning in person! We hear the tickets are selling fast, so grab yours now: https://ti.to/pysv/pyconde-pydata-berlin-2022

The EPS cannot be more proud to be one of their Diversity & Financial Aid Sponsors this year!

PyCon Italia (2-5 June 2022)

If Python + Florence in June sounds appealing, then good news, everyone: PyCon Italy tickets are available for sale: http://pycon.it/en/tickets

As a long-term sponsor of Python Italia, it brings us joy that our grant has made it easier for our friends in the community to get together again.

GeoPython 2022 (13-15 June 2022 - CFP Open)

The EPS are sponsoring GeoPython for the 4th year and we are very excited to learn they are going hybrid this year! Their CFP is now open, so be sure to submit your talk: https://submit.geopython.net/geopython-2022/cfp

&#x1F49F;The EPS want to share our love for the community by giving out even more grants! If you need support for your local event or conference, get in touch with us: grants@europython.eu. Read more about our grants program here: https://www.europython-society.org/grants&#x1F4FA; Rewatch Past EventsPyjamas Conference

The Pyjamas conference took place on 4-5 Dec 2021. It was a great event featuring many interesting Python talks. You can rewatch the laziest Python conference on https://pyjamas.live/.

Python Pizza Hamburg

Despite having to switch to a remote event, Python Pizza Hamburg made 11 Dec a superbly energising Saturday with a full day of lovely Python talks. We are so proud to have sponsored them a second time. If you missed it live, you can catch up now!

&#x1F40D; Cool Python Projects&#x1F4E2;Know a cool Python project? Hit the reply button and write to us!

We will be regularly asking you to share cool python projects you’ve come across through our Friday Recommendations tweets, so do look out for those! In the meantime, here are a few our EuroPython team have liked:

Subscribe to This Newsletter

As an organisation going strong in our 21st year, we also accumulated LOTS of mailing lists. We want to try something new in the new year: a cleaner and leaner way of delivering the news to you - this newsletter!

Subscribe to the EuroPython Newsletter

This replaces our previous EuroPython Announcements Mailing List. Apart from the monthly newsletter updates, we will send out a few more conference related emails closer to the conference. So subscribe and stay tuned! &#x1F64C;

Unsubscribe: If you no longer wish to receive our newsletters, simply click the Unsubscribe Button any time, at the end of the email:

Categories: FLOSS Project Planets

Python for Beginners: Sum Of Elements In A List In Python

Planet Python - Thu, 2022-01-27 09:00

Python lists are one of the most used data structures. We often need to perform different operations on lists. In this article, we will discuss different ways to find the sum of elements in a list in python.

Find Sum Of Elements In A List Using For Loop

The first way to find the sum of elements in a list is to iterate through the list and add each element using a for loop. For this, we will first calculate the length of the list using the len() method. After that, we will declare a variable sumOfElements to 0. After that, we will use the range() function to create a sequence of numbers from 0 to (length of the list-1). Using the numbers in this sequence, we can access the elements of the given list and add them to sumOfElements as follows.

myList = [1, 2, 3, 4, 5, 6, 7, 8, 9] print("The given list is:") print(myList) list_length=len(myList) sumOfElements=0 for i in range(list_length): sumOfElements=sumOfElements+myList[i] print("Sum of all the elements in the list is:", sumOfElements)

Output:

The given list is: [1, 2, 3, 4, 5, 6, 7, 8, 9] Sum of all the elements in the list is: 45

Alternatively, we can directly iterate through the list using a for loop. Here, we will access each element in the list directly and add them to sumOfElements as follows.

myList = [1, 2, 3, 4, 5, 6, 7, 8, 9] print("The given list is:") print(myList) sumOfElements = 0 for element in myList: sumOfElements = sumOfElements + element print("Sum of all the elements in the list is:", sumOfElements)

Output:

The given list is: [1, 2, 3, 4, 5, 6, 7, 8, 9] Sum of all the elements in the list is: 45 Find Sum Of Elements In A List Using While Loop

We can also use a while loop to find the sum of the elements in the list. For that, we will first calculate the length of the list using the len() method. After that, we will initialize variables named count and sumOfElements. We will initialize both the elements to 0. 

In the while loop, we will access each element in the list using the count variable and add them to sumOfElements. After that, we will increment the value of the count by 1. We will continue this process until the count becomes equal to the length of the list.

You can write a program to find the sum of elements in a list in python as follows.

myList = [1, 2, 3, 4, 5, 6, 7, 8, 9] print("The given list is:") print(myList) list_length = len(myList) sumOfElements = 0 count = 0 while count < list_length: sumOfElements = sumOfElements + myList[count] count = count + 1 print("Sum of all the elements in the list is:", sumOfElements)

Output:

The given list is: [1, 2, 3, 4, 5, 6, 7, 8, 9] Sum of all the elements in the list is: 45 Sum Of Elements In A List Using The sum() Function

Python also provides us with an inbuilt sum() function to calculate the sum of the elements in any collection object. The sum() function accepts an iterable object such as list, tuple, or set and returns the sum of the elements in the object.

You can find the sum of the elements of a list using the sum() function as follows.

myList = [1, 2, 3, 4, 5, 6, 7, 8, 9] print("The given list is:") print(myList) sumOfElements = sum(myList) print("Sum of all the elements in the list is:", sumOfElements)

Output:

The given list is: [1, 2, 3, 4, 5, 6, 7, 8, 9] Sum of all the elements in the list is: 45 Conclusion

In this article, we have discussed different ways to find the sum of elements in a list in python. To read more about lists in python, you can read this article on how to compare two lists in python. You might also like this article on list comprehension.   

The post Sum Of Elements In A List In Python appeared first on PythonForBeginners.com.

Categories: FLOSS Project Planets

Gábor Hojtsy: Drupal 9 and Drupal 10 readiness at Drupal Global Contribution Weekend 2022

Planet Drupal - Thu, 2022-01-27 08:29

This weekend (Friday to Sunday) is Drupal Global Contribution Weekend 2022! While there are some in person events such as in Ukraine, there are various online events that allow anyone to join. I'll highlight three opportunities to work on your Drupal 9 or Drupal 10 readiness.

  1. Wim Leers just announced an opportunity to try CKEditor 5 with step by step instructions. He will be available for some office hours on all three days to consult with.
  2. Joel Pittet with the UBC Computer Science department is hosting a Zoom event to work on Drupal 9 and 10 readiness from 9am to 5pm on all three days Vancouver time (UTC-8). Folks working on other tasks are also welcome.
  3. I'll be available on Friday 9am to 5pm as well CET (UTC+1) in both the #d9readiness and #d10readiness channels on Drupal slack (https://drupal.org/slack).

Some common tasks that I think are good to take now:

  • If your contributed project is not Drupal 9 compatible yet, it is a good time to do that now. You can use Upgrade Status on Drupal 8 and Drupal Rector to find problems and automate fixes.
  • While your project cannot be surely Drupal 10 compatible yet, most deprecated APIs for Drupal 10 were marked in Drupal 8. You can use Upgrade Status on Drupal 9 to identify problems and use Drupal Rector again to fix most of them.
  • Drupal 10 will require PHP 8 at least, so setting up testing for your project on PHP 8 and/or manually testing on PHP 8 are good ways to make sure this part of compatibility is taken care of. All Drupal 9 core releases support PHP 8, so this does not pose a risk for your existing users on supported Drupal versions.

With my and Joel's events, there will be 2*8 hours of Drupal 9/10 readiness contribution on Friday with an hour of break inbetween. That is followed by 8 hours each on the weekend days as well. Join either to get help on your journey and contribute to Drupal!

Categories: FLOSS Project Planets

Pages