Feeds

Guido Günther: Free Software Activities July 2024

Planet Debian - Thu, 2024-08-01 05:58

A short status update on what happened on my side last month. Looking at unified push support for Chatty prompted some libcmatrix fixes and Chatty improvements (benefiting other protocols like SMS/MMS as well).

The Bluetooth status page in Phosh was a slightly larger change code wise as we also enhanced our common widgets for building status pages, simplifying the Wi-Fi status page and making future status pages simpler. But as usual investigating bugs, reviewing patches (thanks!) and keeping up with the changing world around us is what ate most of the time.

Phosh

A Wayland Shell for mobile devices

  • Update to latest gvc (MR)
  • Mark more strings as translatable (MR)
  • Improve Bluetooth support by adding a StatusPage (MR)
  • Improve vertical space usage for status pages (MR)
  • Fix build with newer GObject introspection, we can now finally enable --fatal-warnings (MR)
  • Fix empty system modal dialog on keyring lookups: (MR)
  • Send logind locked hint: (MR)
  • Small cleanups (MR, MR)
Phoc

A Wayland compositor for mobile devices

  • Update to wlroots 0.17.4 (MR)
  • Fix inhibitors crash (can affect video playback) (MR)
libphosh-rs

Phosh Rust bindings

phosh-osk-stub

A on screen keyboard for Phosh

  • Allow for up to five key rows and add more keyboard layouts: (MR)
phosh-mobile-settings
  • Allow to set prefer flash (MR)
  • Allow to set quick-silent: (MR)
  • Make DBus activatable (MR)
phosh-wallpapers

Wallpapers, Sounds and other artwork

  • Add Phone hangup event: (MR)
git-buildpackage

Suite to help with Debian packages in Git repositories

  • Fix tests with Python 3.12 and upload 0.9.34
Whatmaps

Tool to find processes mapping shared objects

  • Fix build with python 3.12 and release 0.0.14
Debian

The universal operating system

  • Upload whatmaps 0.0.14
  • Package libssc (MR) for upcoming sensor support on some Qualcomm based phones
  • Fix iio-sensor-proxy RC bug and cleanup a bit: (MR)
  • Update wlroots to 0.17.4 (MR)
  • Update calls to 46.3 (MR)
  • Prepare 0.18.0 (MR
  • meta-phosh: Switch default font and recommend iio-sensor-proxy: (MR)
Mobian

A Debian derivative for mobile devices

  • Fix non booting kernels when built on Trixie (MR)
  • Make cross building a bit nicer: (MR, MR)
Calls

PSTN and SIP calls for GNOME

  • Emit phone-hangup event when a call ended (MR). Together with the sound theme changes this gives a audible sound when the other side hung up.
  • Debug and document Freeswitch sofia-sip failure (it's TLS validation).
Livi

Minimalistic video player targeting mobile devices

  • Export stream position and duration via MPRIS (MR)
  • Slightly improve duration display (MR)
  • Improve docs a bit: (MR)
libcall-ui

Common user interface parts for call handling in GNOME and Phosh.

  • Release 0.1.2 (Build system cleanups only)
  • Add consistency checks: (MR)
feedbackd

DBus service for haptic/visual/audio feedback

  • Fix test failures on recent Fedora due to more strict json-glib: (MR)
Chatty

Messaging application for mobile and desktop

  • Continue work on push notifications: (MR)
    • Allow to delete push server
    • Hook into DBus connector class
    • Parse push notifications
  • Avoid duplicate lib build and fix warnings (MR)
  • Let F10 enable the primary menu: (MR)
  • Focus search when activating it (MR)
  • Fix search keybinding: (MR)
  • Fix keybinding to open help overlay (MR)
  • Don't hit assertions in libsoup by iterating the wrong context: (MR)
  • Matrix: Fix unread count getting out of sync: (MR)
  • Allow to disable purple via build profile (MR)
  • Fix critical during key verification (MR)
  • ChatInfo: Use AdwDialog and show Matrix room topic (MR)
  • Fix crash on account creation: (MR)
libcmatrix

A matrix client client library

  • Fix gir annotations, make gir and doc warnings fatal: (MR)
  • Cleanup README: (MR)
  • Some more minor cleanups and docs: (MR, (MR, (MR)
  • Generate enum types to make them usable by library consumers (MR)
  • Don't blindly iterate the default context (MR)
  • Allow to fetch a single event (useful for handling push notifications) (MR)
  • Make CmCallback behave like other callbacks (MR)
  • Allow to add/remove/fetch pushers sync (MR)
  • Add sync variant for fetching past events (MR)
  • Make a self contained library, test that in CI and make all public classes show up in the docs (MR)
  • Track unread count (MR)
  • Release libcmatrix 0.0.1
  • Add support for querying room topics (MR)
  • Allow to disable running the tests so superprojects have some choice (MR)
  • Fix crashes, use after free, … (MR, MR, MR)
Eigenvalue

A libcmatrix test client

Help Development

If you want to support my work see donations. This includes list of hardware we want to improve support for.

Categories: FLOSS Project Planets

mark.ie: How to use the LocalGov Drupal KeyNav Module

Planet Drupal - Thu, 2024-08-01 04:21

Here's a short video outlining the features of the LocalGov Drupal KeyNav module.

Categories: FLOSS Project Planets

More Ways to Rust

Planet KDE - Thu, 2024-08-01 03:35

In our earlier blog, The Smarter Way to Rust, we discuss why a blend of C++ and Rust is sometimes the best solution to building robust applications. But when you’re merging these two languages, it’s critical to keep in mind that the transition from C++ to Rust isn’t about syntax, it’s about philosophy.

Adapting to Rust’s world view

If you’re an experienced C++ developer who is new to Rust, it’s only natural to use the same patterns and approaches that have served you well before. But problem-solving in Rust requires a solid understanding of strict ownership rules, a new concurrency model, and differences in the meaning of “undefined” code. To prevent errors arising from an overconfident application of instinctual C++ solutions that don’t align with Rust’s idioms, it’s a good idea to start by tackling non-critical areas of code. This can give you room to explore Rust’s features without the pressure of potentially bringing critical systems crashing down.

Maximizing performance in a hybrid application

Performance is often a concern when adopting a new language. Luckily, Rust holds its own against C++ in terms of runtime efficiency. Both languages compile to machine code, have comparable runtime checks, don’t use run-time garbage collection, and share similar back-ends like GCC and LLVM. That means that in most real-world applications, the performance differences are negligible.

However, when Rust is interfaced with C++ via a foreign function interface (FFI), there may be a noticeable overhead. The FFI disrupts the optimizer’s ability to streamline code execution on both sides of the interface. Keep this in mind when structuring your hybrid applications, particularly in performance-critical sections. You could use link-time optimization (LTO) in LLVM to help with this, but the additional complexity of maintaining this solution makes it a consideration only if profiling/benchmarking points to FFI being a main source of overhead.

Embracing ‘unsafe’ Rust

The normal approach for Rust is to eliminate code marked as ‘unsafe’ as much as possible. While both C++ and ‘unsafe’ Rust allow for pointer dereferencing that can potentially crash, the advantage in Rust is that this keyword makes issues easier to spot. ‘Unsafe’ Rust pinpoints where safety compromises are made, highlighting manageable risk areas. This in turn streamlines code reviews and simplifies the hunt for elusive bugs.

Bridging Rust with C/C++

Connecting Rust and C/C++ is clearly required when building hybrid applications. Thankfully, there’s a rich ecosystem of tools to support this:

  • Rust’s built-in extern “C” for straightforward C FFI needs
  • bindgen and cbindgen for generating bindings between Rust and C/C++
  • CXX and AutoCXX for robust, safe interoperability between the two environments
  • CXX-Qt for mixing Rust and Qt C++

Each tool serves a distinct purpose and choosing the right one can make the difference between a seamless integration and a complicated ball of compromises. (We provide more detailed guidance on this topic in our Hybrid Rust and C++ best practice guide, and my colleague Loren has a three part blog series that talks about this topic too: part 1, part 2, part 3.)

Adopting the microservice model

In complex applications with interwoven parts, it’s probably best to keep Rust and C++ worlds distinct. Taking a cue from the microservices design pattern, you can isolate functionalities into separate service loops on each side, passing data between them through well-defined FFI calls. This approach circumvents issues of thread blocking and data ownership, shifting focus from direct code calls to service requests.

Navigating Rust ABI dynamics

Rust does not guarantee a stable ABI between releases, which influences how you must design and compile your applications. To prevent breaking the build, create statically linked executables or use C FFIs for shared libraries and plugins, ensure that your entire project sticks to a consistent Rust version, and encapsulate all dependencies behind a C FFI.

Choosing the right build system

Building hybrid applications requires a thoughtful approach to choose a build system that will work well for the code you have and adapt easily as your program evolves.

  • Start with Cargo (provided by the Rust environment) for Rust-centric projects with minimal C++ code.
  • Switch to CMake if C++ takes on a more significant role.
  • Consider Bazel or Buck2 build systems for handling complex, language-agnostic build processes.

If you’re considering a custom build system, closely examine the available options first. With the breadth of today’s build tool landscape, it’s usually overkill to invent your own solution.

Summary

By understanding the challenges and employing the right strategies, C++ developers can smoothly transition to Rust, leveraging the strengths of both languages to build robust and efficient applications. For more information on this trending topic, you’ll want to consult our Hybrid Rust and C++ best practice guide, which was created in collaboration with Ferrous Systems co-founder Florian Gilcher.

About KDAB

If you like this article and want to read similar material, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

The post More Ways to Rust appeared first on KDAB.

Categories: FLOSS Project Planets

Tryton News: Newsletter July 2024

Planet Python - Thu, 2024-08-01 02:00

During the last month we focused on fixing bugs, improving the behaviour of things, speeding-up performance issues - building on the changes from our last release. We also added some new features which we would like to introduce to you in this newsletter.

For an in depth overview of the Tryton issues please take a look at our issue tracker or see the issues and merge requests filtered by label.

Changes for the User Sales, Purchases and Projects

We’ve now added optional reference and warehouse fields to the purchase_request_quotation list view.

Accounting, Invoicing and Payments

We now allow users in the account admin group to update the invoice line descriptions in a revised invoice.

Until now a direct debit was created for each unpaid line. However, this may not be wanted when there are many payable lines. In these cases the company may want to have a single direct debit for the total amount of the payable lines. So, we’ve now introduced an option to define if a recept of a direct debit should be based on the lines or the balance.

Stock, Production and Shipments

Now we’ve extend the lot trace information by moves generated from an inventory. This way we are able to show the origin of a lot.

We removed the default planned date on supplier shipments.

User Interface

It is now possible for the users to resize the preview panel of attachments.

Now users are able to type search filters immediately after opening a screen with a search entry.

System Data and Configuration

We’ve added the following party identifiers:

  • Taiwanese Tax Number
  • Turkish tax identification number
  • El Salvador Tax Number
  • Singapore’s Unique Entity Number
  • Montenegro Tax Number
  • Kenya Tax Number
New Documentation

The documentations for the following modules has been improved:

We’ve added a warning that because the database is modified in place it is important to make a backup before running an update.

We’ve migrated what were previously links to the configuration section to config-anchors like this :ref:trytond:topics-configuration.

New Releases

We released bug fixes for the currently maintained long term support series
7.0 and 6.0, and for the current series 7.2.

Changes for the System Administrator

Now when running trytond-admin with the --indexes argument but without any modules to update, the indexes of all models are updated.

Changes for Implementers and Developers

We are now able to run tests with PYTHONWARNINGS="error" to catch future issues earlier. Warnings from third-party-libraries can be ignored by the filters defined in the TEST_PYTHONWARNINGS environment variable.

Authors: @dave @pokoli @udono

1 post - 1 participant

Read full topic

Categories: FLOSS Project Planets

Python Insider: Python 3.13.0 release candidate 1 released

Planet Python - Thu, 2024-08-01 01:30

 I'm pleased to announce the release of Python 3.13 release candidate 1.

https://www.python.org/downloads/release/python-3130rc1/

 

This is the first release candidate of Python 3.13.0

This release, 3.13.0rc1, is the penultimate release preview. Entering the release candidate phase, only reviewed code changes which are clear bug fixes are allowed between this release candidate and the final release. The second candidate (and the last planned release preview) is scheduled for Tuesday, 2024-09-03, while the official release of 3.13.0 is scheduled for Tuesday, 2024-10-01.

There will be no ABI changes from this point forward in the 3.13 series, and the goal is that there will be as few code changes as possible.

Call to action

We strongly encourage maintainers of third-party Python projects to prepare their projects for 3.13 compatibilities during this phase, and where necessary publish Python 3.13 wheels on PyPI to be ready for the final release of 3.13.0. Any binary wheels built against Python 3.13.0rc1 will work with future versions of Python 3.13. As always, report any issues to the Python bug tracker.

Please keep in mind that this is a preview release and while it’s as close to the final release as we can get it, its use is not recommended for production environments.

Core developers: time to work on documentation now
  • Are all your changes properly documented?
  • Are they mentioned in What’s New?
  • Did you notice other changes you know of to have insufficient documentation?
 Major new features of the 3.13 series, compared to 3.12

Some of the new major new features and changes in Python 3.13 are:

New features Typing Removals and new deprecations
  • PEP 594 (Removing dead batteries from the standard library) scheduled removals of many deprecated modules: aifc, audioop, chunk, cgi, cgitb, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib, lib2to3.
  • Many other removals of deprecated classes, functions and methods in various standard library modules.
  • C API removals and deprecations. (Some removals present in alpha 1 were reverted in alpha 2, as the removals were deemed too disruptive at this time.)
  • New deprecations, most of which are scheduled for removal from Python 3.15 or 3.16.

(Hey, fellow core developer, if a feature you find important is missing from this list, let Thomas know.)

For more details on the changes to Python 3.13, see What’s new in Python 3.13. The next pre-release of Python 3.13 will be 3.13.0rc2, the final release candidate, currently scheduled for 2024-09-03.

 More resources  Enjoy the new releases

Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation.

Whatevs,

Your release team,
Thomas Wouters
Łukasz Langa
Ned Deily
Steve Dower

Categories: FLOSS Project Planets

Sitback Solutions: Good Design for Housing – NSW Gov digital map case study

Planet Drupal - Wed, 2024-07-31 22:01
Enhancing urban understanding through interactive mapping for NSW Government Project background In NSW, where the architectural landscape boasts a vibrant mix of low density single detached dwellings and high-rise apartment buildings, low- and mid-rise housing have become underrepresented  in new development planning. Recognising this gap, Government Architect NSW (GANSW), a part of NSW Department of Planning, Housing ... Good Design for Housing – NSW Gov digital map case study
Categories: FLOSS Project Planets

Dirk Eddelbuettel: RQuantLib 0.4.24 on CRAN: Robustification

Planet Debian - Wed, 2024-07-31 21:04

A new minor release 0.4.24 of RQuantLib arrived on CRAN this afternoon (just before the CRAN summer break starting tomorrow), and has been uploaded to Debian too.

QuantLib is a rather comprehensice free/open-source library for quantitative finance. RQuantLib connects (some parts of) it to the R environment and language, and has been part of CRAN for more than twenty-one years (!!) as it was one of the first packages I uploaded.

This release of RQuantLib follows the recent release from last week which updated to QuantLib version 1.35 released that week, and solidifies conditional code for older QuantLib versions in one source file. We also updated and extended the configure source file, and increased the mininum version of QuantLib to 1.25.

Changes in RQuantLib version 0.4.24 (2024-07-31)
  • Updated detection of QuantLib libraries in configure

  • The minimum version has been increased to QuantLib 1.25, and DESCRIPTION has been updated to state it too

  • The dividend case for vanilla options still accommodates deprecated older QuantLib versions if needed (up to QuantLib 1.25)

  • The configure script now uses PKG_CXXFLAGS and PKG_LIBS internally, and shows the values it sets

Courtesy of my CRANberries, there is also a diffstat report for the this release. As always, more detailed information is on the RQuantLib page. Questions, comments etc should go to the rquantlib-devel mailing list. Issue tickets can be filed at the GitHub repo.

If you like this or other open-source work I do, you can now sponsor me at GitHub.

This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.

Categories: FLOSS Project Planets

Junichi Uekawa: I've tried Android Element app for matrix first time during Debconf.

Planet Debian - Wed, 2024-07-31 18:58
I've tried Android Element app for matrix first time during Debconf. It feels good. For me it's a better IRC. I've been using it on my Chromebook and one annoyance is that I haven't found a keyboard shortcut for sending messages. I would have expected shift or ctrl with Enter would send the current message, but so far I have been touching the display to send messages. Can I fix this? Where is the code?

Categories: FLOSS Project Planets

Junichi Uekawa: Joining Debconf, it's been 16 years.

Planet Debian - Wed, 2024-07-31 18:46
Joining Debconf, it's been 16 years. I feel very different. Back then I didn't understand the need for people who were not directly doing Debian work, now I think I appreciate things more. I don't remember what motivated me to do everything back then. Now I am doing what is necessary for me. Maybe it was back then too.

Categories: FLOSS Project Planets

Balint Pekker: Drupal 11 is at the doorstep

Planet Drupal - Wed, 2024-07-31 17:48
The release of Drupal 11 is on the horizon, yet comprehensive information on its features, deprecated modules, and system requirements is scattered. While you can piece together details from documentation and community forums, it would be much more convenient to have everything in one place, hence this post. Since the release of Drupal 10.2, we've known about the deprecations and experimental modules, allowing us to prepare for the transition. With Drupal 10 receiving long-term support (LTS) until Drupal 12, possibly arriving in mid-late 2026, there's no immediate rush to upgrade. However, the benefits of the new features in Drupal 11 make the upgrade highly worthwhile.
Categories: FLOSS Project Planets

Ned Batchelder: Pushing back on sys.monitoring

Planet Python - Wed, 2024-07-31 17:32

I’ve been continuing to work on adapting coverage.py to the new sys.monitoring facility. Getting efficient branch coverage has been difficult even with the new API. The latest idea was to compile the code under measurement to insert phantom lines that could trigger line monitoring events that would track branch execution. But I’ve come to the opinion that this is not the right approach. It’s a complex work-around for a gap in the sys.monitoring API.

Update: Mark Shannon is working on new events: Add BRANCH_TAKEN and BRANCH_NOT_TAKEN events to sys.monitoring.

To re-cap: sys.monitoring let you subscribe to events for code execution. A line event lets you know when lines are executed. You can disable a line event, and you will never again be notified about that particular line being executed.

The gap is in the branch events: when one is fired, it tells you the bytecode offset of the source and destination. The problem is that disabling a branch event disables the source offset. You never hear about that source offset again, even when the destination offset is different. The central idea of a branch is that one source has two different destinations, so this disabling behavior is awkward.

If we leave the branch event enabled, then we might be repeatedly told about the same source/destination pair, slowing down execution. We could disable the event once we saw both possible destinations, but that means implementing our own bookkeeping, and we still have the overhead of repeated first-destination events. If we disable the branch event immediately, we’ll never hear about the other possible destination and the coverage data will be incomplete.

The clever idea from SlipCover is to insert do-nothing lines at each branch destination, then only subscribe to line events. This works in theory, but adds complexity to coverage.py. It also limits how it can be used: you can’t start coverage measurement in a process after code has already been imported because the line insertion happens during compilation via an import hook. To make matters worse, there’s a tricky interaction between the coverage.py import hook and the pytest import hook that rewrites assertions.

Over the years I’ve done plenty of clever work-arounds for limitations in systems I build on top of. They can be interesting puzzles and proud achievements. They can also be maintenance headaches and fragile sources of bugs.

My progress on adapting coverage.py to sys.monitoring has be slow, even glacial. I think it will be faster overall to work on improving sys.monitoring instead, even though it means the improvements wouldn’t be available until 3.14. It will keep coverage.py simpler and more flexible, and will make the improved branch events available to everyone. I can’t see how the current behavior is useful, so let’s change it.

I’ve proposed that we fix the sys.monitoring API. Of course other participation is welcome in that discussion.

I remember years ago working at Lotus, using the Lotus Notes API. I accepted it as a finished thing. Later I joined the organization that built Lotus Notes. We had a discussion about something we were building and a difficulty we were encountering. One of the longer-tenured engineers said, “Let’s extend the API.” It was a revelation that we didn’t have to limit ourselves to the current capabilities of our foundation, we could change the foundation.

The same is true of Python, especially because it is open source. But it can be hard to remember that and to advocate for it where necessary.

BTW, I still believe that coverage.py’s internal focus on “arcs” is misguided, and will be working to remove that idea in favor of true branches.

As I mentioned last time, there’s now a dedicated #coverage-py channel in the Python Discord if you are interested in discussing any of this.

Categories: FLOSS Project Planets

Python Engineering at Microsoft: Python in Visual Studio Code – August 2024 Release

Planet Python - Wed, 2024-07-31 16:44

We’re excited to announce the August 2024 release of the Python and Jupyter extensions for Visual Studio Code!

This release includes the following announcements:

  • Improved Python discovery using python-environment-tools
  • Inline variable values shown in source code
  • Improvements to the VS Code Native REPL for Python

If you’re interested, you can check the full list of improvements in our changelogs for the Python, Jupyter and Pylance extensions.

Improved Python discovery using python-environment-tools

In the last release, we announced the Python environment tools, which redesigned the Python discovery infrastructure focused on performance. This new approach reduces the need for executing python binaries to probe for information and thus improving performance.

Starting in this release, we are rolling out this enhancement as part of an experiment. If you are interested in trying this out, you can set "python.locator" to "native" in your User settings.json and reload your VS Code window. Visit the python-environment-tools repo to learn more about this feature, ongoing work, and provide feedback.

Inline variable values shown in source code

The Python Debugger extension introduced an Inline Values feature to enhance your Python debugging experience making it easier to track variable values during a debug session. This feature enables the display of variable values directly in the editor, next to the corresponding line of code during a debugging session. This helps you to quickly understand the state of your program without needing to hover over variables or check the variables pane. To enable this feature, set the configuration value debugpy.showPythonInlineValues to true in your User settings.

Note: This feature is currently in exploration state and improvements are actively being made. Please try out this feature and provide feedback in the vscode-python-debugger repo!

Improvements to the VS Code Native REPL for Python

The experimental native REPL ("python.REPL.sendToNativeREPL": true) will now display success/failure UI, similar to that in a Jupyter cell, depending on the outcome of execution. Furthermore, we have made improvements so that we no longer display an empty line on cells that generate no output.

Other Changes and Enhancements

We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python and Jupyter Notebooks in Visual Studio Code. Some notable changes include:

  • Pylance now provides a way to disable unreachability hints in @pylance-release#6106
  • The Debug Welcome view now includes a button for quick access to automatic Python configurations when a Python file is open in the editor
Call for Community Feedback

As we are planning and prioritizing future work, we value your feedback! Below are a few issues we would love feedback on:

  • In a joint effort from various parts of the Python community, we are collecting responses about usage of type annotations in Python. Please take a few minutes to share your experience in the Type Annotation in Python survey! The survey will close at the end of August 2024.
  • Design proposal for test coverage in (@vscode-python#22827)

Try out these new improvements by downloading the Python extension and the Jupyter extension from the Marketplace, or install them directly from the extensions view in Visual Studio Code (Ctrl + Shift + X or ⌘ + ⇧ + X). You can learn more about Python support in Visual Studio Code in the documentation. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.

The post Python in Visual Studio Code – August 2024 Release appeared first on Python.

Categories: FLOSS Project Planets

Jonathan McDowell: Using QEmu for UEFI/TPM testing

Planet Debian - Wed, 2024-07-31 16:29

This is one of those posts that’s more for my own reference than likely to be helpful for others. If you’re unlucky it’ll have some useful tips for you. If I’m lucky then I’ll get a bunch of folk pointing out some optimisations.

First, what I’m trying to achieve. I want a virtual machine environment where I can manually do tests on random kernels, and also various TPM related experiments. So I don’t want something as fixed as a libvirt setup. I’d like the following:

  • It to be fairly lightweight, so I can run it on a laptop while usefully doing other things
  • I need a TPM 2.0 device to appear to the guest OS, but it doesn’t need to be a real TPM
  • Block device discard should work, so I can back it with a qcow2 image and use fstrim to keep the actual on disk size small, without constraining my potential for file system expansion should I need it
  • I’ve no need for graphics, in fact a serial console would be better as it eases copy & paste, especially when I screw up kernel changes

That turns out to be possible, but it took a bunch of trial and error to get there. So I’m writing it down. I generally do this on a Fedora based host system (FC40 at present, but this all worked with FC38 + FC39 too), and I run Debian 12 (bookworm) as the guest. At present I’m using qemu 8.2.2 and swtpm 0.9.0, both from the FC40 packages.

One other issue I spent too long tracking down is that the version of grub 2.06 in bookworm does not manage to pass the TPMEventLog through to the guest kernel properly. The events get measured and the PCRs updated just fine, but /sys/kernel/security/tpm0/binary_bios_measurements doesn’t even get created. Using either grub 2.06 from FC40, or the 2.12 backport in bookworm-backports, makes this work just fine.

Anyway, for reference, the following is the script I use to start the swtpm, and then qemu. The debugcon line can be dropped if you’re not interested in OVMF debug logging. This needs the guest OS to be configured up for a serial console, but avoids the overhead of graphics emulation.

As I said at the start, I’m open to any hints about other options I should be passing; as long as I get acceptable performance in the guest I care more about reducing host load than optimising for the guest.

#!/bin/sh BASEDIR=/home/noodles/debian-qemu if [ ! -S ${BASEDIR}/swtpm/swtpm-sock ]; then echo Starting swtpm: swtpm socket --tpmstate dir=${BASEDIR}/swtpm \ --tpm2 \ --ctrl type=unixio,path=${BASEDIR}/swtpm/swtpm-sock & fi echo Starting QEMU: qemu-system-x86_64 -enable-kvm -m 2048 \ -machine type=q35 \ -smbios type=1,serial=N00DL35,uuid=fd225315-f72a-4d66-9b16-55363c6c938b \ -drive if=pflash,format=qcow2,readonly=on,file=/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2 \ -drive if=pflash,format=raw,file=${BASEDIR}/OVMF_VARS.fd \ -global isa-debugcon.iobase=0x402 -debugcon file:${BASEDIR}/debian.ovmf.log \ -device virtio-blk-pci,drive=drive0,id=virblk0 \ -drive file=${BASEDIR}/debian-12-efi.qcow2,if=none,id=drive0,discard=on \ -net nic,model=virtio -net user \ -chardev socket,id=chrtpm,path=${BASEDIR}/swtpm/swtpm-sock \ -tpmdev emulator,id=tpm0,chardev=chrtpm \ -device tpm-tis,tpmdev=tpm0 \ -display none \ -nographic \ -boot menu=on
Categories: FLOSS Project Planets

Ruslan Spivak: Up Your Game: Fundamental Skills for Software Engineers

Planet Python - Wed, 2024-07-31 13:04

“Fundamentals are the foundation of excellence. Without a strong base, you cannot reach your full potential.” – John Wooden

Hey there!

Let’s talk fundamentals today. Why are they important? John Wooden’s quote sums it up nicely, but let’s unpack it a bit more:

  1. Strong foundation:

    • A solid grasp of fundamental concepts provides a strong foundation for building advanced skills. Just like a house needs a sturdy base, your knowledge in software engineering needs a solid groundwork. It may sound cliché, but it’s still true.

    • Continuous learning: fundamentals serve as a launchpad for continuous learning. Once you have a solid base, you can explore more advanced topics and specializations, keeping your skills sharp and relevant.

  2. Confidence: mastering the fundamentals boosts your confidence.  Remember, competence breeds confidence.

  3. Shelf-life: technology evolves at a breakneck pace. Remember when new JavaScript frameworks seemed to pop up before your morning coffee? Or just look at how quickly the AI space is advancing these days. While frameworks come and go, fundamentals like data structures, algorithms, math, software design, OS internals, and soft skills have enduring value. Investing in these fundamentals offers a much better return on investment compared to the often fleeting value of the latest frameworks.

Understanding the fundamentals is essential for software engineers at all levels; they’re not just for beginners.

Which specific fundamentals are important for software engineers?

Well, everyone loves a good list, so here you go - an opinionated list of essential fundamentals for software engineers at all levels, from entry-level to senior IC, staff, and beyond:

  1. Programming languages: this one’s super obvious. The main question is which languages? Python, JavaScript, Go, and some C are the usual suspects. Bonus points if you dive into how interpreters and compilers work.

  2. Software design and architecture

  3. Data structures and algorithms (DSA)

  4. Operating systems: this also includes basic computer architecture and networking.

  5. Databases: design and internals

  6. Distributed systems: nowadays, systems run on multiple machines and instances, so understanding the basics of distributed systems is important.

  7. Math: this might be controversial, but it can also be the secret sauce, especially statistics and math for AI.

  8. Soft skills: fundamental to any engineer’s career unless you’re living in a cave alone. The truth is, soft skills are actually hard to master.

Consider this a teaser! I’ll be doing deep dives into these fundamentals in upcoming posts, along with other key essentials for software engineers.

Spotlight

In today’s spotlight: “The Pragmatic Programmer: Your Journey to Mastery

Andy Hunt and Dave Thomas offer a wealth of practical advice, timeless tips, and real-world examples. Every software engineer needs “The Pragmatic Programmer” on their shelf. Now in its second (20th anniversary) edition, this book is a must-read. I fondly remember the original edition titled “From Journeyman to Master.” My copy is well-worn from many reads - truly good books are worth revisiting.

Sneak Peak

In the next post, I’ll talk about essential fundamentals for engineering managers.

Stay curious,

Ruslan

Categories: FLOSS Project Planets

Real Python: How to Write an Installable Django App

Planet Python - Wed, 2024-07-31 10:00

In the Django framework, a project refers to the collection of configuration files and code for a particular website. Django groups business logic into what it calls apps, which are the modules of the Django framework. There’s plenty of documentation on how to structure your projects and the apps within them, but when it comes time to package an installable Django app, information is harder to find.

In this tutorial, you’ll learn how to take an app out of a Django project and package it so that it’s installable. Once you’ve packaged your app, you can share it on PyPI so that others can fetch it through pip.

In this tutorial, you’ll learn:

  • What the differences are between writing stand-alone apps and writing apps inside of projects
  • How to create a pyproject.toml file for publishing your Django app
  • How to bootstrap Django outside of a Django project so you can test your app
  • How to test across multiple versions of Python and Django using nox
  • How to publish your installable Django app to PyPI using Twine

This tutorial includes a working package to help guide you through the process of making an installable Django app. You can download the source code by clicking the link below:

Get Your Code: Click here to download the free sample code that shows you how to write an installable Django app.

Prerequisites

This tutorial requires some familiarity with Django, pip, PyPI, pyenv—or an equivalent virtual environment tool—and nox. To learn more about these, you can check out the following resources:

Starting a Sample Django App in a Project

Even if you set out to make your Django app available as a package, you’ll likely start inside a project. In the sample code, you’ll find a 000_before directory that shows the code before the app is moved onto its own, demonstrating the process of transitioning from a Django project to an installable Django app.

You can also download the finished app at the PyPI realpython-django-receipts package page, or install the package by running python -m pip install realpython-django-receipts.

The sample app is a short representation of the line items on a receipt. In the 000_before folder, you’ll find a directory named sample_project that contains a working Django project:

sample_project/ │ ├── receipts/ │ ├── fixtures/ │ │ └── receipts.json │ │ │ ├── migrations/ │ │ ├── 0001_initial.py │ │ └── __init__.py │ │ │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py │ ├── sample_project/ │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py │ ├── db.sqlite3 ├── manage.py ├── resetdb.sh └── runserver.sh

This tutorial was written using Django 5.0.7 and it was tested with Python 3.8 through 3.12. All of the steps outlined in this tutorial should be compatible with earlier versions of Django going back to Django 1.8. However, some modifications will be necessary if you’re using Python 2. For simplicity, the examples in this tutorial assume at least Python 3.8 across the code base.

Creating the Django Project From Scratch

The sample project and receipts app were created using the Django admin command and some small edits. To start, run the following code inside of a clean virtual environment:

Shell $ python -m pip install Django $ django-admin startproject sample_project $ cd sample_project $ python manage.py startapp receipts Copied!

This creates the sample_project project directory structure and a receipts app subdirectory with template files that you’ll use to create your installable Django app.

Next, the sample_project/settings.py file needs a few modifications:

  • Add "127.0.0.1" to the ALLOWED_HOSTS setting so you can test locally.
  • Add "receipts" to the INSTALLED_APPS list.

You’ll also need to register the receipts app’s URLs in the sample_project/urls.py file. To do so, add path("receipts/", include("receipts.urls")) to the url_patterns list. Note that you’ll need to add the include function as an import from django.urls.

Exploring the Receipts Sample App

The app consists of two ORM model classes: Item and Receipt. The Item class contains database field declarations for a description and a cost. The cost is contained in a DecimalField. It’s never a good idea to use floating-point numbers to represent money. Instead, you should always use fixed-point numbers when dealing with currencies.

The Receipt class is a collection point for Item objects. This is achieved with a ForeignKey on Item that points to Receipt. Receipt also includes total() for getting the total cost of Item objects contained in the Receipt:

Read the full article at https://realpython.com/installable-django-app/ »

[ 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

Zero to Mastery: Python Monthly Newsletter 💻🐍

Planet Python - Wed, 2024-07-31 09:44
56th issue of Andrei Neagoie's must-read monthly Python Newsletter: Python Web Apps, Python Oopsie with Apple, Some Advice From a 15+ Vet, and much more. Read the full newsletter to get up-to-date with everything you need to know from last month.
Categories: FLOSS Project Planets

FSF Events: Free Software Directory meeting on IRC: Friday, August 2, starting at 12:00 EDT (16:00 UTC)

GNU Planet! - Wed, 2024-07-31 08:49
Join the FSF and friends on Friday, August 2 from 12:00 to 15:00 EDT (16:00 to 19:00 UTC) to help improve the Free Software Directory.
Categories: FLOSS Project Planets

Pages