Open-source News

AMD Ports Register Shadowing To The Mesa RADV Vulkan Driver

Phoronix - Sat, 01/28/2023 - 00:00
Most of the Mesa Radeon Vulkan "RADV" driver development has been done by the likes of Valve, Google, and Red Hat engineers with it being an "unofficial" driver while AMD supports AMDVLK as their official open-source Vulkan driver as well as supporting their closed-source AMDGPU-PRO Vulkan driver too that shares common code with their Windows Vulkan driver. It was pleasant to see AMD this week though submitting new feature code to RADV...

Linux Developers Evaluating New "DOITM" Security Mitigation For Latest Intel CPUs

Phoronix - Fri, 01/27/2023 - 20:00
Last summer Intel published guidance around the Data Operand Independent Timing (DOIT) instruction mode that can be enabled with recent generations of Intel processors to ensure constant time execution for a subset of the Intel instruction set, which can be particularly important for cryptographic algorithms. Linux kernel developer discussions fizzled out last year over handling this DOIT functionality for what is described as a CPU vulnerability with recent Intel CPUs. However, now a Linux kernel patch from a Google developer would enable this change unconditionally for newer Intel CPUs but raises performance concerns.

TornadoVM 0.15 Released - Now Supports Running Java On Intel Arc Graphics

Phoronix - Fri, 01/27/2023 - 19:13
TornadoVM is an open-source plugin for OpenJDK and GraalVM that allows for running Java programs on heterogeneous hardware like GPUs and FPGAs. With today's TornadoVM 0.15, it's the first release now supporting discrete Intel Arc Graphics hardware...

Intel Releases HAXM 7.8 As One Last Hurrah For The Open-Source Project

Phoronix - Fri, 01/27/2023 - 18:55
Earlier this month Intel announced they would be discontinuing development of HAXM as a hardware-accelerated execution manager that's been popular on Windows and macOS for Android emulation. While the original announcement discontinued its development immediately, they decided to go ahead and put out one final version: Intel HAXM 7.8 is available today for concluding this open-source project...

Microsoft's Dzn Mesa Driver Already Hits Vulkan 1.2

Phoronix - Fri, 01/27/2023 - 18:45
Microsoft engineers seem to be working on getting the Dozen "dzn" Mesa driver up to speed as quickly as possible. It was just earlier this month it began passing nearly all Vulkan 1.0 conformance tests, Vulkan 1.1 was then exposed just a few days ago, and now Dzn is ironing out Vulkan 1.2...

Linux Resource Control Monitoring Being Improved For Intel Sub-NUMA Cluster Configurations

Phoronix - Fri, 01/27/2023 - 16:00
For those making use of Intel's sub-NUMA cluster (SNC) configuration option available on their servers since Skylake, the Linux resource control "resctrl" kernel code is being improved upon to better handle this resource configuration...

A beginner's guide to Mastodon

opensource.com - Fri, 01/27/2023 - 16:00
A beginner's guide to Mastodon cherrybomb Fri, 01/27/2023 - 03:00

Since my previous article about Mastodon, I noticed a lot of people joined but absolutely no one understood the mechanics of getting their feeds together or why they couldn't see what they wanted. Now that you're on Mastodon, you need to know how to use Mastodon. I'm going to cover the mechanics of how to see what you want, and how to configure your feed.

Why is my Mastodon feed empty?

Well, that's a good question. Most social media platforms use algorithms to decide what to show you. You sign in, they might ask you what interests you have, and boom — you get a feed that you have to cherry-pick through to get what you want out of it. Once you're done filtering your way through everything, the fancy back-end code adds more, or shows less based on your interactions, watch time, and length of non-scrolling. Personally, that's kind of creepy to do. But hey, it works.

Mastodon doesn't use those algorithms. This is on purpose. So I'm going to cover a couple of ways to set your feed up.

Following people on Mastodon

The obvious way to fill up the feed you have is to start following people, so their posts appear. This, of course, allows you to find more people to follow.

You can always start by finding some friends or some well-known folks that happen to have their Mastodon IDs out in public. For example, my ID is directly attached to my Opensource.com profile. I started by following my fellow correspondent Don, then found more people on his follow list for more interesting people that have similar interests as myself. Below, I explain the search function box.

The search box is just above your user avatar on your home page.

Image by:

(Jess Cherry, CC BY-SA 4.0)

When you click on it, a nifty little pop-up shows up, providing you with some example searches.

Image by:

(Jess Cherry, CC BY-SA 4.0)

In my example, I entered "opensource" and it showed there are hashtags and people to follow. You can even click load more if you want to get a larger list.

Image by:

(Jess Cherry, CC BY-SA 4.0)

Now that you've gotten some people in your feed, you can start working on personalizing more by using hashtags.

Hashtags

Hashtags are keywords or phrases preceded by the # symbol. If you're used to databases this is a select statement, similar to this SQL:

select * from Subjects where hashtags='specific_thing_i_like';

You can use hashtags to discover and follow users who are interested in similar topics as you are. For example, if you are interested in fashion like I am (we all have our guilty pleasures), you could search for the hashtag #fashion. You can then follow users who frequently use that hashtag in their posts. You can also use the same search field to find other users to follow. Here's a snippet of what appeared in that hashtag list.

Image by:

(Jess Cherry, CC BY-SA 4.0)

As you can see the hashtag itself had 58 people using that tag in the last two days. On the right side, you can see that there are graphs demonstrating the trend those hashtags followed within the recent past.

When I click on the hashtag, I see a list of people using it, and then I click on the users I want to follow. (I'm not including a screenshot, because I don't want to include personal tags in this article without users' permission).

Mastodon lists

On the right side of the Mastodon web interface, there are really cool little buttons (Home, Notifications, Explore, Local, and so on).

Image by:

(Jess Cherry, CC BY-SA 4.0)

That button on the bottom is Lists. A list is an organizational tool. You can use lists to organize the accounts you follow into different categories. This means you can manage and adjust your feed to focus on specific people or topics. This functionality is very useful, and it's better than having someone else determine or track what you're into.The best thing is only you have the ability to add people to your lists.

To create a list, click the Lists button.

Image by:

(Jess Cherry, CC BY-SA 4.0)

Create a new list name and click Add List. Of course, I'm going to create a list called opensource.

Image by:

(Jess Cherry, CC BY-SA 4.0)

Next, click on the list name.

Click the Edit list button to open a window that allows you to search among the people you are following. You can add anyone to your list.

Image by:

(Jess Cherry, CC BY-SA 4.0)

Click the plus (+) button to the right of the person you want to add.

Then you hit enter, and poof you get a new stream! Now any time someone in a list publishes a post, that post is added to your list. I just added Linux and pulled up Linux Magazine and my list populated.

Finally, you must choose who gets to see responses you make to list posts. By default, all members of the list are able to view your response. But you can set it so that all of your followers are able to see your response, or that no one can see your response.

To set this, click the Settings icon in the top right of the list.

Image by:

(Jess Cherry, CC BY-SA 4.0)

A whole bunch of nope

Now I've reached what I call the "nope buttons." These buttons are the mute and block buttons. They allow you to remove content, people, or hashtags from your feed.

Why would you get bad stuff in your feed after doing all of the work you just went through to curate it? Lots of reasons. You could follow someone based on a few interesting posts they've made, only to find out later that they're not as interesting as you'd hoped. A hashtag could get appropriated to mean something different than what it meant when you followed it. It's the internet and things change quickly.

Muting allows you to hide a specific user's posts or a particular hashtag from your timeline. Blocking prevents a user from interacting with you or seeing your posts.

Here's an example of how to use these, but hopefully you won't have to.

Image by:

(Jess Cherry, CC BY-SA 4.0)

More great content Free online course: RHEL technical overview Learn advanced Linux commands Download cheat sheets Find an open source alternative Explore open source resources

There are several actions you can take against an account.

  • Mute: You don't see anything this user posts.
  • Block: You can't see them and they can't see you.
  • Report: They're breaking the rules, so you report them to their instance admin.
  • Block the domain: You can block the entire domain their account resides on.

Domain blocking is the most drastic action. There are some dark, scary, mean, rude, and just outright horrible domains out on the internet. Some of them may host a Mastodon instance. When you block an entire domain, nobody on that instance sees your posts, and you don't see posts from anyone using that server. This is useful when a group of people post stuff you're not interested in seeing. You don't have to block each person individually. You can just block their entire server. When lots of other Mastodon instances also block a domain, that instance is de-federated. This means that the domain is not connected to any other Mastodon instance, and is no longer part of a larger community. The users on that instance can still talk to one another, but that's all they can do.

This is a significant advantage to federated social media. And it's so appreciated by its users that there are a few groups of people maintaining a list of domains you can and should avoid. The listing also provides a reason that the domain is on the list.

You can find blocklists on GitLab and GitHub, and also on the Fediblock wiki page. It's always worth making sure to avoid malware, and generally horrible things, so the wiki page is useful.

Final notes

As with anything new, when you join Mastodon, there's a lot of exploring, reading instructions, and just trying to figure stuff out. In this case, there is a little work you have to do to curate your personalized feed. If you're up for doing the work, this little set of directions should be useful to you. Hope you enjoy your time floating in the Fediverse!

You made the switch to Mastodon. Congratulations! Here's what you should do next.

Image by:

Opensource.com

Alternatives Tools What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Packaging Python modules with wheels

opensource.com - Fri, 01/27/2023 - 16:00
Packaging Python modules with wheels hANSIc99 Fri, 01/27/2023 - 03:00

Everyone who has been working with Python for a while might already have come around packages. In Python terminology, packages (or distribution packages) are collections of one or more Python modules that provide specific functionality. The general concept is comparable to libraries in other languages. Some peculiarities with Python packages make dealing with them different.

Pip and PyPi

The most common way to install a third-party Python package is to use package installer pip, supplied by default. The Python Package Index (PyPi) is the central server for packages of all kinds and the default source for pip. Python packages contain files that specify the package name, version, and other meta information. Based on those files, PyPi knows how to classify and index a package. In addition, those files may include installation instructions that pip processes.

More Python resources What is an IDE? Cheat sheet: Python 3.7 for beginners Top Python GUI frameworks Download: 7 essential PyPI libraries Red Hat Developers Latest Python articles Source and binary distribution

Python modules are distributed in several formats, each with pros and cons. In general, the formats can be divided into two groups.

Source distribution (sdist)

Source distributions are defined in PEP 517 and are gzipped tar archives with the file ending *.tar.gz. The archive contains all package-related source files and installation instructions. A source distribution often has dependencies to a build system like distutils or setuptools which cause code execution during installation. The execution of (arbitrary) code upon installation may raise safety concerns.

In the case of a Python C/C++ extension, a source distribution contains plain C/C++ files. These must be compiled upon installation, so an appropriate C/C++ toolchain must be present.

Built distributions (bdist)

In contrast, you can often use a built distribution as is. The idea behind built distributions is to provide a package format without introducing additional dependencies. When it comes to Python C/C++ extension, a built distribution provides binaries ready for the user's platform.

The most widely used built distribution format is the Python wheel, specified in PEP 427.

Python wheels

Wheels are ZIP archives with the file ending .whl. A wheel may contain binaries, scripts, or plain Python files. If a wheel contains binaries of a C/C++ extension module, it indicates that by including its target platform in its filename. Pure Python files (.py) are compiled into Python byte code (.pyc) during the installation of the wheel.

If you attempt to install a package from PyPi using pip, it always chooses a Python wheel over a source distribution. However, when pip cannot find a compatible wheel, it attempts to fetch the source distribution instead. As a package maintainer, it's a good practice to provide both formats on pip. For a package user, using wheels over source distributions is advantageous because of the safer installation process, their smaller size, and, as a result, faster installation time.

To address a wide range of users, the package maintainer must offer wheels for various platforms and Python versions.

In one of my previous articles, Write a C++ extension module for Python, I demonstrated how to create a Python C++ extension for the CPython interpreter. You can re-use the article's example code to build your first wheel.

Defining the build configuration with setuptools

The demo repository contains the following files, which contain meta information and a description of the build process:

pyproject.toml [build-system] requires = [ "setuptools>=58" ] build-backend = "setuptools.build_meta"

This file is the successor of the setup.py since PEP 517 and PEP 518. This file is actually the entry point for the packaging process. The build-backend key tells pip to use setuptools as the build system.

setup.cfg

This file contains the static, never changing metadata of the package:

[metadata] name = MyModule version = 0.0.1 description = Example C/C++ extension module long_description = Does nothing except incremention a number license = GPLv3 classifiers = Operating System::Microsoft Operating System::POSIX::Linux Programming Language::C++setup.py

This file defines the generic build process for the Python module. Every action which must be performed at installation time goes here.

Due to security concerns, this file should only be present if absolutely necessary.

from setuptools import setup, Extension MyModule = Extension( 'MyModule', sources = ['my_py_module.cpp', 'my_class_py_type.cpp'], extra_compile_args=['-std=c++17'] ) setup(ext_modules = [MyModule])

This example package is actually a Python C/C++ extension, so it requires a C/C++ toolchain on the user's system to compile. In the previous article, I used CMake to generate the build configuration. This time, I'm using setuptools for the build process. I faced challenges when running CMake inside a build container (I'll come back to that point later). The setup.py file contains all the information required to build the extension module.

In this example, setup.py lists the involved source files and some (optional) compile arguments. You can find a reference to the setuptools build in the documentation.

Build process

To start the build process, open a terminal in the root folder of the repository and run:

$ python3 -m build --wheel

Afterward, find the subfolder dist containing a .whl file. For example:

MyModule-0.0.1-cp39-cp39-linux_x86_64

The file name carries a lot of information. After the module name and version, it specifies the Python interpreter (CPython 3.9) and the target architecture (x86_64).

At this point, you can install and test the newly created wheel:

$ python3 -m venv venv_test_wheel/ $ source venv_test_wheel/bin/activate $ python3 -m pip install dist/MyModule-0.0.1-cp39-cp39-linux_x86_64.whl Image by:

(Stephan Avenwedde, CC BY-SA 4.0)

Now you have one wheel, which you can forward to someone using the same interpreter on the same architecture. This is the bare minimum, so I'll go one step further and show you how to create wheels for other platforms.

Build configuration

As a package maintainer, you should provide a suitable wheel for as many platforms as possible. Luckily, there are tools to make this easy for you.

Maintaining Linux compatibility

When building Python C/C++ extensions, the resulting binaries are linked against the standard libraries of the build system. This could cause some incompatibilities on Linux, with its various versions of glibc. A Python C/C++ extension module built on one Linux system may not work on another comparable Linux system due to, for example, the lack of a certain shared library. To avert such scenarios, PEP 513 proposed a tag for wheels that work on many Linux platforms: manylinux.

Building for the manylinux platform causes linking against a defined kernel and userspace ABI. Modules that conform to this standard are expected to work on many Linux systems. The manylinux tag developed over time, and in its latest standard (PEP 600), it directly names the glibc versions the module was linked against (manylinux_2_17_x86_64, for example).

In addition to manylinux, there is the musllinux platform (PEP 656), which defines a build configuration for distributions utilizing musl libc like Alpine Linux.

CI build wheel

The cibuildwheel project provides CI build configurations for many platforms and the most widely used CI/CD systems.

Many Git hosting platforms have CI/CD features built in. The project is hosted on GitHub, so you can use GitHub Actions as a CI server. Just follow the instructions for GitHub Actions and provide a workflow file in your repository: .github/workflows/build_wheels.yml.

Image by:

(Stephan Avenwedde, CC BY-SA 4.0)

A push to GitHub triggers the workflow. After the workflow has finished (note that it took over 15 minutes to complete), you can download an archive containing a wheel for various platforms:

Image by:

(Stephan Avenwedde, CC BY-SA 4.0)

You still have to package those wheels manually if you want to publish them on PyPi. Using CI/CD, it's possible to automate the delivery process to PyPi. You can find further instructions in cibuildwheels documentation.

Wrap up

The various formats can make the packaging of Python modules an obtuse process for beginners. Knowledge about the different package formats, their purpose, and the tools involved in the packaging process is necessary for package maintainers. I hope this article sheds light on the world of Python packaging. In the end, by using a CI/CD build system, providing packages in the advantageous wheel format becomes a breeze.

By using a CI/CD build system, providing Python packages in the advantageous wheel format becomes a breeze.

Image by:

WOCinTech Chat. Modified by Opensource.com. CC BY-SA 4.0

Python CI/CD What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Pages