Feeds

TechBeamers Python: Concat DataFrames in Pandas: A Step-by-Step Tutorial

Planet Python - Tue, 2024-02-06 13:02

In this tutorial, we’ll explore and demonstrate how to concat DataFrames in Pandas with different Python examples and use cases. If you usually work with data, merge datasets, or handle lots of info, learning the DataFrame concatenation technique in Pandas will be helpful. It makes your data analysis tasks a lot easier. Prerequisites Before we […]

The post Concat DataFrames in Pandas: A Step-by-Step Tutorial appeared first on TechBeamers.

Categories: FLOSS Project Planets

ImageX: Drupal Calendar Creation Unleashed: Useful Modules And A Step-by-Step Walkthrough

Planet Drupal - Tue, 2024-02-06 12:31

Authored by: Nadiia Nykolaichuk.

One of the earliest known calendars was created by ancient Egyptians, who used hieroglyphics and carvings to represent the months, days, and important events. Today, visually appealing and user-friendly calendars are easily created on websites, all thanks to powerful CMSs like Drupal. We’ll share some modules in Drupal that are available for calendar creation and management, and carefully walk you through the key steps of building a calendar. 

Categories: FLOSS Project Planets

TechBeamers Python: How to Read Excel Files Using Pandas in Python

Planet Python - Tue, 2024-02-06 11:47

In this tutorial, we will explore how to read Excel files using the popular Python library, Pandas. Pandas is widely used for data manipulation and analysis, and it provides excellent support for handling Excel files. Whether you are working on a data analysis project, extracting data for machine learning, or simply need to read data […]

The post How to Read Excel Files Using Pandas in Python appeared first on TechBeamers.

Categories: FLOSS Project Planets

TechBeamers Python: How to Use Python To Generate Test Cases for Java Classes

Planet Python - Tue, 2024-02-06 10:49

In this HowTo tutorial, we’ll use Python to generate test cases for Java classes. For this purpose, Python provides an external module namely, javalang, so we’ll utilize it for test case generation. Since Python is much more user-friendly and easy to use than any other programming language, so why should we as a developer not […]

The post How to Use Python To Generate Test Cases for Java Classes appeared first on TechBeamers.

Categories: FLOSS Project Planets

Mike Driscoll: Creating a Modal Dialog For Your TUIs in Textual

Planet Python - Tue, 2024-02-06 10:24

Textual is a Python package that you can use to create beautiful text-based user interfaces (TUIs). In other words, you can create a GUI in your terminal with Textual.

In this tutorial, you will learn how to create a modal dialog in your terminal. Dialogs are great ways to alert the user about something or get some input. You also see dialogs used for such things as settings or help.

Let’s get started!

Adding a Modal Dialog

The first step is to think up some kind of application that needs a dialog. For this tutorial, you will create a form allowing the user to enter a name and address. Your application won’t save any data as that is outside the scope of this article, but it will demonstrate how to create the user interface and you can add that functionality yourself later on, if you wish.

To start, create a new file and name it something like tui_form.py. Then enter the following code:

from textual.app import App, ComposeResult from textual.containers import Center from textual.containers import Grid from textual.screen import ModalScreen from textual.widgets import Button, Footer, Header, Input, Static, Label class QuitScreen(ModalScreen): """Screen with a dialog to quit.""" def compose(self) -> ComposeResult: yield Grid( Label("Are you sure you want to quit?", id="question"), Button("Quit", variant="error", id="quit"), Button("Cancel", variant="primary", id="cancel"), id="dialog", ) def on_button_pressed(self, event: Button.Pressed) -> None: if event.button.id == "quit": self.app.exit() else: self.app.pop_screen() class Form(Static): def compose(self) -> ComposeResult: """ Creates the main UI elements """ yield Input(id="first_name", placeholder="First Name") yield Input(id="last_name", placeholder="Last Name") yield Input(id="address", placeholder="Address") yield Input(id="city", placeholder="City") yield Input(id="state", placeholder="State") yield Input(id="zip_code", placeholder="Zip Code") yield Input(id="email", placeholder="email") with Center(): yield Button("Save", id="save_button") class AddressBookApp(App): CSS_PATH = "modal.tcss" BINDINGS = [("q", "request_quit", "Quit")] def compose(self) -> ComposeResult: """ Lays out the main UI elemens plus a header and footer """ yield Header() yield Form() yield Footer() def action_request_quit(self) -> None: """Action to display the quit dialog.""" self.push_screen(QuitScreen()) if __name__ == "__main__": app = AddressBookApp() app.run()

Since this code is a little long, you will review it piece by piece. You will start at the bottom since the main entry point is the AddressBookApp class.

Here’s the code:

class AddressBookApp(App): CSS_PATH = "modal.tcss" BINDINGS = [("q", "request_quit", "Quit")] def compose(self) -> ComposeResult: """ Lays out the main UI elemens plus a header and footer """ yield Header() yield Form() yield Footer() def action_request_quit(self) -> None: """Action to display the quit dialog.""" self.push_screen(QuitScreen()) if __name__ == "__main__": app = AddressBookApp() app.run()

The AddressBookApp class is your application code. Here, you create a header, the form itself, and the footer of your application. When the user presses the q button, you also set up an accelerator key or key binding that calls action_request_quit(). This will cause your modal dialog to appear!

But before you look at that code, you should check out your Form’s code:

class Form(Static): def compose(self) -> ComposeResult: """ Creates the main UI elements """ yield Input(id="first_name", placeholder="First Name") yield Input(id="last_name", placeholder="Last Name") yield Input(id="address", placeholder="Address") yield Input(id="city", placeholder="City") yield Input(id="state", placeholder="State") yield Input(id="zip_code", placeholder="Zip Code") yield Input(id="email", placeholder="email") with Center(): yield Button("Save", id="save_button")

The Form class has a series of Input() widgets, which are text boxes, that you can enter your address information into. You specify a unique id for each widgets to give you a way to style each of them. You can read more about how that works in Using CSS to Style a Python TUI with Textual. The placeholder parameter lets you add a label to the text control so the user knows what should be entered in the widget.

Now you are ready to move on and look at your modal dialog code:

class QuitScreen(ModalScreen): """Screen with a dialog to quit.""" def compose(self) -> ComposeResult: yield Grid( Label("Are you sure you want to quit?", id="question"), Button("Quit", variant="error", id="quit"), Button("Cancel", variant="primary", id="cancel"), id="dialog", ) def on_button_pressed(self, event: Button.Pressed) -> None: if event.button.id == "quit": self.app.exit() else: self.app.pop_screen()

The QuitScreen class is made up of two functions:

  • compose() – Creates the widgets in the modal dialog
  • on_button_pressed() – The event handler that is fired when a button is pressed

The application will exit if the user presses the “Quit” button. Otherwise, the dialog will be dismissed, and you’ll return to your form screen.

You can style your application, including the modal dialog, using CSS. If you scroll back up to your application class, you’ll see that it refers to a CSS_PATH that points to a file named modal.tcss.

Here’s the CSS code that you’ll need to add to that file:

QuitScreen { align: center middle; } #dialog { grid-size: 2; grid-gutter: 1 2; grid-rows: 1fr 3; padding: 0 1; width: 60; height: 11; border: thick $background 80%; background: $surface; } #question { column-span: 2; height: 1fr; width: 1fr; content-align: center middle; } Button { width: 100%; }

This CSS will set the size and location of your modal dialog on the application. You tell Textual that you want the buttons to be centered and the dialog to be centered in the application.

To run your code, open up your terminal (or cmd.exe / Powershell on Windows), navigate to the folder that has your code in it, and run this command:

python tui_form.py

When you run this command, the initial screen will look like this:

To see the dialog, click the Save button to take the focus out of the text controls. Then hit the q button, and you will see the following:

You’ve done it! You created a modal dialog in your terminal!

Wrapping Up

Textual is a great Python package. You can create rich, expressive user interfaces in your terminal. These GUIs are also lightweight and can be run in your browser via Textual-web.

Want to learn more about Textual? Check out some of the following tutorials:

 

The post Creating a Modal Dialog For Your TUIs in Textual appeared first on Mouse Vs Python.

Categories: FLOSS Project Planets

DrupalEasy: Why you should care about using settings.local.php

Planet Drupal - Tue, 2024-02-06 10:14

Teaching folks why a settings.local.php file is an important part of setting up a personal development environment is so important to us here at DrupalEasy that it is a foundational part of both of our long-form Drupal training courses.

While preparing for an upcoming podcast mini-series I've been invited to participate in with the Talking Drupal folks, I'll be mentoring someone who is looking to re-enter the Drupal development scene after missing out on Drupal's transition from its pre-Symfony days. One of the tasks I have outlined for this person is to set up a settings.local.php file. When I went to find a good resource for the "why" and the "how", I came up empty. I couldn't find a single, up-to-date resource that conveyed what I feel is important.

So, that's what this blog post is all about. 

Why use settings.local.php?

Using a settings.local.php is all about configuring your local development environment for a project to be as useful to you, the developer, as possible. Default settings in this file do things like force all errors to the screen and disabling some of the (but not all) Drupal caches.

This file also pulls in the sites/development.services.yml file which contains some useful service class parameters and overrides - again, things that are useful for local development.

Setting up a settings.local.php literally takes less than two minutes, and when I see a Drupal developer struggling to figure out a white-screen-of-death error on their local environment, I can't help but 🙄

In addition to adding Drupal's core-dev dependencies and the Devel module, enabling the settings.local.php file is literally one of the first things I do when setting up a new site.

How do I enable the settings.local.php?

I'm so glad you asked.

Step 1

Copy sites/example.settings.local.php to sites/default/settings.local.php. Use a user interface (like the MacOS Finder) or the command line - it doesn't matter.

cp web/sites/example.settings.local.php web/sites/default/settings.local.phpStep 2

Uncomment the conditional include for settings.local.php in your sites/default/settings.php file - it looks like this:

# if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { # include $app_root . '/' . $site_path . '/settings.local.php'; # }

Uncommented, it looks like this:

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $site_path . '/settings.local.php'; }Step 3

There is no step 3. This blog post is complete. 
 

Categories: FLOSS Project Planets

Django Weblog: Django security releases issued: 5.0.2, 4.2.10, and 3.2.24

Planet Python - Tue, 2024-02-06 09:55

In accordance with our security release policy, the Django team is issuing Django 5.0.2, Django 4.2.10, and Django 3.2.24. These releases address the security issue detailed below. We encourage all users of Django to upgrade as soon as possible.

CVE-2024-24680: Potential denial-of-service in intcomma template filter

The intcomma template filter was subject to a potential denial-of-service attack when used with very long strings.

Affected supported versions
  • Django main branch
  • Django 5.0
  • Django 4.2
  • Django 3.2
Resolution

Patches to resolve the issue have been applied to Django's main branch and the 5.0, 4.2, and 3.2 stable branches. The patches may be obtained from the following changesets:

The following releases have been issued:

The PGP key ID used for this release is Natalia Bidart: 2EE82A8D9470983E

General notes regarding security reporting

As always, we ask that potential security issues be reported via private email to security@djangoproject.com, and not via Django's Trac instance, nor via the Django Forum, nor via the django-developers list. Please see our security policies for further information.

Categories: FLOSS Project Planets

Real Python: Python Basics Exercises: Lists and Tuples

Planet Python - Tue, 2024-02-06 09:00

In Python Basics: Lists and Tuples, you learned that Python lists resemble real-life lists in many ways. They serve as containers for organizing and storing collections of objects, allowing for the inclusion of different data types. You also learned about tuples, which are also collections of objects. However, while lists are mutable, tuples are immutable.

In this Python Basics Exercises course, you’ll test and reinforce your knowledge of Python lists and tuples. Along the way, you’ll also get experience with some good programming practices that will help you solve future challenges.

In this video course, you’ll practice:

  • Defining and manipulating lists and tuples in Python
  • Leveraging the unique qualities of lists and tuples
  • Determining when you should use lists vs tuples

By the end of this course, you’ll have an even stronger grasp of Python lists and tuples. You’ll be equipped with the knowledge to effectively incorporate them into your own programming projects.

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course.

[ 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

Tag1 Consulting: Gander Automated Performance Testing - Video Demo with Catch

Planet Drupal - Tue, 2024-02-06 08:41

In this second part (check the first part!) of our Tag1 Team Talk on Gander, the new Automated Performance Testing Framework integrated into Drupal Core, we get a live demo from Nat Catchpole (aka. Catch), the lead developer on the project. Nat takes us on a tour through this high-impact tool developed by Tag1 in collaboration with the Google Chrome Team, showing you how you can get up and running with automated performance testing for your projects. Gander is poised to significantly impact Drupal's user experience, performance and Core Web Vitals by creating visibility into how Drupal performs on the front and back end. Catch shares his expert insights into the development and application of Gander and shows how easy it is for developers to start extending and using this today on their projects! Whether you're a Drupal developer looking to improve your project's performance or simply curious about the latest in Drupal technology, this episode offers valuable knowledge and practical advice on getting your Drupal website to perform optimally. With discussions on Gander's immediate benefits and future potential in the Drupal community, this episode is a must-watch for anyone interested in taking their projects to the next level...

Read more Mariano Tue, 02/06/2024 - 05:41
Categories: FLOSS Project Planets

Robert McQueen: Flathub: Pros and Cons of Direct Uploads

Planet Debian - Tue, 2024-02-06 05:57

I attended FOSDEM last weekend and had the pleasure to participate in the Flathub / Flatpak BOF on Saturday. A lot of the session was used up by an extensive discussion about the merits (or not) of allowing direct uploads versus building everything centrally on Flathub’s infrastructure, and related concerns such as automated security/dependency scanning.

My original motivation behind the idea was essentially two things. The first was to offer a simpler way forward for applications that use language-specific build tools that resolve and retrieve their own dependencies from the internet. Flathub doesn’t allow network access during builds, and so a lot of manual work and additional tooling is currently needed (see Python and Electron Flatpak guides). And the second was to offer a maybe more familiar flow to developers from other platforms who would just build something and then run another command to upload it to the store, without having to learn the syntax of a new build tool. There were many valid concerns raised in the room, and I think on reflection that this is still worth doing, but might not be as valuable a way forward for Flathub as I had initially hoped.

Of course, for a proprietary application where Flathub never sees the source or where it’s built, whether that binary is uploaded to us or downloaded by us doesn’t change much. But for an FLOSS application, a direct upload driven by the developer causes a regression on a number of fronts. We’re not getting too hung up on the “malicious developer inserts evil code in the binary” case because Flathub already works on the model of verifying the developer and the user makes a decision to trust that app – we don’t review the source after all. But we do lose other things such as our infrastructure building on multiple architectures, and visibility on whether the build environment or upload credentials have been compromised unbeknownst to the developer.

There is now a manual review process for when apps change their metadata such as name, icon, license and permissions – which would apply to any direct uploads as well. It was suggested that if only heavily sandboxed apps (eg no direct filesystem access without proper use of portals) were permitted to make direct uploads, the impact of such concerns might be somewhat mitigated by the sandboxing.

However, it was also pointed out that my go-to example of “Electron app developers can upload to Flathub with one command” was also a bit of a fiction. At present, none of them would pass that stricter sandboxing requirement. Almost all Electron apps run old versions of Chromium with less complete portal support, needing sandbox escapes to function correctly, and Electron (and Chromium’s) sandboxing still needs additional tooling/downstream patching to run inside a Flatpak. Buh-boh.

I think for established projects who already ship their own binaries from their own centralised/trusted infrastructure, and for developers who have understandable sensitivities about binary integrity such such as encryption, password or financial tools, it’s a definite improvement that we’re able to set up direct uploads with such projects with less manual work. There are already quite a few applications – including verified ones – where the build recipe simply fetches a binary built elsewhere and unpacks it, and if this already done centrally by the developer, repeating the exercise on Flathub’s server adds little value.

However for the individual developer experience, I think we need to zoom out a bit and think about how to improve this from a tools and infrastructure perspective as we grow Flathub, and as we seek to raise funds for different sources for these improvements. I took notes for everything that was mentioned as a tooling limitation during the BOF, along with a few ideas about how we could improve things, and hope to share these soon as part of an RFP/RFI (Request For Proposals/Request for Information) process. We don’t have funding yet but if we have some prospective collaborators to help refine the scope and estimate the cost/effort, we can use this to go and pursue funding opportunities.

Categories: FLOSS Project Planets

Qt Wayland, Supercharged

Planet KDE - Tue, 2024-02-06 05:00

One of the key components to using a Plasma Wayland session is obviously the Qt Wayland Client module for running Qt applications in a Wayland environment. While it has been successfully deployed to millions of devices over the years, there’s still a few areas that feel like they haven’t been touched much since its inception as part of the Qt Lighthouse project, what turned into QPA, the Qt Platform Abstraction.

WIP: Qt Wayland client-side decoration with a proper drop shadow and all Improving the SHM Backing Store

Fushan Wen complained about abysmal performance when using Kolourpaint (a faithful re-creation of the original MS Paint, just better) under Wayland. Thanks to Hotspot (my favorite profiler front-end) we found a bottleneck in Qt’s Wayland SHM (Shared Memory) Backing Store, the infrastructure that provides software-rendered applications with a canvas to draw into. The way Wayland works is basically that an application creates a wl_buffer, fills it with content, and “sends” it to the compositor. Once the compositor is done processing it (e.g. after having uploaded it to the GPU) the client may re-use that buffer again.

If we pick a different buffer to draw into because we want to start drawing before the compositor is done with the previous one, any previous content needs to be transferred over since Qt expects to see the contents it drew previously. This is where we found the choke point: Even though the application reported the correct region that changed (when drawing with a brush only the new splodges of color need to be rendered after all), Qt Wayland copied the entire buffer. Therefore, I replaced the original memcpy with proper damage tracking which significantly sped up rendering. Many thanks to Ilya Fedin for continued support while implementing this.

I then did more profiling and found that when painting on a window with alpha channel, Qt first clears the region to be painted. While there’s not much we can optimize about a “fill with color” call, we can skip doing that entirely if we have just created a new buffer, like is done repeatedly as you resize the window. The new buffer is initialized with zeroes already, therefore we can just start painting on it. Last but not least, I added support for “scrolling” the backing store, which is something Qt might ask us to do when scrolling through a view, such as a text editor or terminal window, and then have the application just fill in a small gap that’s left.

Prettified “Bradient” Decoration Kolourpaint running under Weston with client-side decorations

I very much dislike client-side decorations for their inconsistencies and burden they put on application developers but I nevertheless grew tired of seeing how hideous Qt applications looked on colleague’s computers running Gnome Shell. That is why I spent some time on making Qt’s “Bradient” decoration plug-in not stick out like a sore thumb. While it’s a massive improvement over the blue decoration Qt Wayland originally shipped, there is still a lot to be desired.

I believe it’s quite detrimental that Mutter doesn’t support server-side decorations at all under Wayland. There’s plenty of applications that display non-application content and don’t care much about providing any decoration. For example, even running kwin_wayland under Gnome for development purposes gives you a window with no title bar or window border whatsoever.

Qt likewise relies on the desktop environment to provide a window frame and its drawing of client-side decorations under Wayland is if anyting a massive band-aid. Currently, Qt’s backing store just adds a window decoration around it and then returns the application a region inside the image that excludes the decoration again. It also lacks several features that one would expect from a window title bar, like double click to maximize or clicking the icon to bring up the window manager menu. In the future I am looking forward to putting the decoration into a sub-surface (or even using libdecor) which hopefully fixes many issues related to input and format handling.

Opening the window menu by clicking the icon, just as you would expect

To start off, the easiest change I did was using the correct mouse cursors for resizing the window. I then found that mouse input wasn’t properly translated when the window border was too thick, something that wasn’t noticeable with the default 3px border but surely would become a problem once we added a large shadow. Next, I fixed it not updating live when system colors changed, e.g. when enabling “Dark Mode”. Additionally, the title bar now includes the application name to be consistent with the title it sends to the compositor for display in task bar and window switchers.

Still, adding a proper drop shadow is work in progress: the most important part is to actually remove the window border and rounded corners altogether when the window is maximized or tiled and to adjust the button layout machinery to cope with changing margins. However, I also need to move the qt_blurImage function which creates the drop shadow texture into a place where I can use it without Qt Graphics Views or Qt Widgets (it’s currently used internally by QGraphicsBlurEffect).

Drag’n’Drop

Furthermore, I improved drag and drop handling: Qt Wayland now tries to decode URLs as UTF-8 – Chrome sometimes sends them like this – rather than just UTF-16. I also had it ignore the mysterious “DELETED” format Firefox sends that is likely a remnant from the XDnd specification. The latter fixes dropping an image to the desktop to set it as a wallpaper since Firefox doesn’t actually let anyone read this entry and Plasma gets stuck on it until it runs into a socket timeout.

Dragging a folder using the correct “Copy” cursor rather than the generic “Grabbing Hand” it had previously

The mouse now also uses the proper drag cursors. While the compositor may overrule the preferred action, we still want the default to match other desktop environments. I also fixed keyboard modifier propagation during drag and drop. While Wayland sends an explicit keyboard modifier change (Shift/Alt/Meta pressed or released), it does so after sending the actual key press. Qt on the other hand only updates its internal modifier state in response to an actual key presses. This meant that Qt doesn’t properly update its internal state when pressing a modifier when starting to drag a file and then holding Shift to initiate a “Move” operation. To fix that, Qt Wayland emits drag and drop events (and others) using the Wayland-internal modifier state rather than the one in QGuiApplication.

Categories: FLOSS Project Planets

Update: xdg-toplevel-drag merged

Planet KDE - Tue, 2024-02-06 04:00

In the last post I talked about making things like detachable tabs or widgets work in a Wayland work. The protocol I submitted has now been merged into wayland-protocols!

Following I quickly switched Qt and KWin to use the now standardized protocol. KWin will support it with the initial 6.0 release. The Qt patch has been picked all the way down to the 6.6 branch which means it should be in the 6.6.3 release.

I am also happy to see that Robert Mader is working on making Chrome use the standard protocol, picking up my proof-of-concept level patch. Thank you!

Happy dragging!

Categories: FLOSS Project Planets

Python Bytes: #370 Your Very Own Heroku

Planet Python - Tue, 2024-02-06 03:00
<strong>Topics covered in this episode:</strong><br> <ul> <li><a href="https://dokku.com"><strong>Dokku</strong></a></li> <li><a href="https://www.nicholashairs.com/posts/major-changes-between-python-versions/"><strong>Summary of Major Changes Between Python Versions</strong></a></li> <li>How to check Internet Speed via Terminal? <a href="https://github.com/sivel/speedtest-cli">speedtest-cli</a></li> <li><strong>Blogs: We all should blog more</strong></li> <li><strong>Extras</strong></li> <li><strong>Joke</strong></li> </ul><a href='https://www.youtube.com/watch?v=1P-XjiHzSNU' style='font-weight: bold;'data-umami-event="Livestream-Past" data-umami-event-episode="370">Watch on YouTube</a><br> <p><strong>About the show</strong></p> <p>Sponsored by us! Support our work through:</p> <ul> <li>Our <a href="https://training.talkpython.fm/"><strong>courses at Talk Python Training</strong></a></li> <li><a href="https://courses.pythontest.com/p/the-complete-pytest-course"><strong>The Complete pytest Course</strong></a></li> <li><a href="https://www.patreon.com/pythonbytes"><strong>Patreon Supporters</strong></a></li> </ul> <p><strong>Connect with the hosts</strong></p> <ul> <li>Michael: <a href="https://fosstodon.org/@mkennedy"><strong>@mkennedy@fosstodon.org</strong></a></li> <li>Brian: <a href="https://fosstodon.org/@brianokken"><strong>@brianokken@fosstodon.org</strong></a></li> <li>Show: <a href="https://fosstodon.org/@pythonbytes"><strong>@pythonbytes@fosstodon.org</strong></a></li> </ul> <p>Join us on YouTube at <a href="https://pythonbytes.fm/stream/live"><strong>pythonbytes.fm/live</strong></a> to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.</p> <p><strong>Michael #1:</strong> <a href="https://dokku.com"><strong>Dokku</strong></a></p> <ul> <li>An open source PAAS alternative to Heroku.</li> <li>Dokku helps you build and manage the lifecycle of applications from building to scaling.</li> <li>Powered by Docker, you can install Dokku on any hardware.</li> <li>Once it's set up on a host, you can push Heroku-compatible applications to it via Git. </li> <li>Rich <a href="https://dokku.com/docs/community/plugins/">plug in architecture</a>.</li> </ul> <p><strong>Brian #2:</strong> <a href="https://www.nicholashairs.com/posts/major-changes-between-python-versions/"><strong>Summary of Major Changes Between Python Versions</strong></a></p> <ul> <li>Nicholas Hairs</li> <li>Changes between versions &amp; Tools &amp; utilities to help with switching</li> <li>Hopefully you’re already at least at 3.8, but come on, 3.11 &amp; 3.12 are so fun!</li> <li>Useful things <ul> <li><code>pyupgrade</code> can automatically upgrade code base <ul> <li>(However, I frequently just upgrade and run tests and let my old code be as-is until it bugs me. - Brian)</li> </ul></li> <li><code>black</code> checks <code>pyproject.toml</code> <code>requires-python</code> setting and uses version specific rules.</li> </ul></li> <li>Versions (way more highlights listed in the article) <ul> <li>3.8 <ul> <li>Assignment expressions <code>:=</code> walrus</li> <li><code>f"{variable=}"</code> now works</li> </ul></li> <li>3.9 <ul> <li>Typing has built in generics like <code>dict[]</code>, so no more <code>from typing import Dict</code></li> <li>Dict union operator</li> <li>Strings can <code>removeprefix</code> and <code>removesuffix</code></li> </ul></li> <li>3.10 <ul> <li>Structural pattern matching <code>match/case</code></li> <li>Typing: Union using pipe <code>|</code></li> <li>Dataclasses support <code>slots=True</code> and <code>kw_only=True</code></li> </ul></li> <li>3.11 <ul> <li><code>tomllib</code> included as a standard TOMP parser</li> <li>Exception groups</li> <li>Exception Notes <code>add_note()</code></li> <li>Typing: A <code>Self</code> type</li> <li>Star unpacking expressions allowed in <code>for</code> statements: <code>for x in *a, *b:</code></li> </ul></li> <li>3.12 <ul> <li>f-strings can re-use quotes</li> <li>Typing: better type parameter syntax</li> <li>Typing: <code>@override</code> decorator ensures a method being overridden by a child class actually exists.</li> </ul></li> </ul></li> </ul> <p><strong>Michael #3:</strong> How to check Internet Speed via Terminal? <a href="https://github.com/sivel/speedtest-cli">speedtest-cli</a></p> <ul> <li>Command line interface for testing internet bandwidth using speedtest.net</li> <li>Just <code>pipx install speedtest-cli</code></li> <li>Has a <a href="https://github.com/sivel/speedtest-cli/wiki">Python API</a> too</li> </ul> <p><strong>Brian #4:</strong> <strong>Blogs: We all should blog more</strong></p> <ul> <li>Jeff Triplett is attempting one post per day in February <ul> <li>Feb 1: <a href="https://micro.webology.dev/2024/02/01/choosing-the-right.html">Choosing the Right Python and Django Versions for Your Projects</a></li> <li>Feb 2: <a href="https://micro.webology.dev/2024/02/02/my-first-mac.html">My First Mac</a> <ul> <li>Which also links to a quite interesting Personal: <a href="https://jefftriplett.com/2023/default-apps-2023/">Default Apps 2023</a></li> </ul></li> <li>Feb 3: <a href="https://micro.webology.dev/2024/02/03/whats-your-goto.html">What’s Your Go-to Comfort Media? [rough cut]</a></li> <li>Feb 4: <a href="https://micro.webology.dev/2024/02/04/the-django-apps.html">The Django apps I actually use (rough cut)</a></li> <li>Feb 5: <a href="https://micro.webology.dev/2024/02/05/how-to-test.html">How to test with Django and pytest fixtures</a></li> </ul></li> <li>Need ideas? <ul> <li>Check out <a href="https://hamatti.org/posts/build-an-idea-bank-and-never-run-out-of-blog-ideas/">Build an idea bank and never run out of blog ideas</a></li> </ul></li> <li>Not using AI? Thanks. We appreciate that. <ul> <li>Maybe tag it as <a href="https://notbyai.fyi/">Not By AI</a></li> </ul></li> </ul> <p><strong>Extras</strong> </p> <p>Brian:</p> <ul> <li>If upgrading to pytest 8, be aware that running individual tests with parametrization will result in a reverse order. <ul> <li>It shouldn’t matter. <a href="https://podcast.pythontest.com/episodes/211-stamp-out-test-dependencies-with-pytest-plugins">You shouldn’t be depending on test order.</a></li> <li>But it was surprising to me.</li> <li><a href="https://github.com/pytest-dev/pytest/issues/11937">Issue has been logged</a></li> </ul></li> </ul> <p>Michael:</p> <ul> <li><a href="https://orbstack.dev">Orbstack</a> follow up</li> </ul> <p><strong>Joke:</strong> <a href="https://workchronicles.com/white-lies/">White Lies</a></p>
Categories: FLOSS Project Planets

Specbee: Style Made Simple with Acquia Site Studio’s Style Guide Manager

Planet Drupal - Tue, 2024-02-06 02:41
Ever wished you could tweak your web page’s header font or switch up your CTA color, but skipped it to save your developer from the hassle? With Acquia Site Studio’s Style Guide Manager, you don’t have to! Non-technical content marketers now have the power to make styling tweaks to their Drupal site theme via an intuitive interface. Are you interested in learning more? Come on in! What is Site Studio Style Guide Manager Previously Acquia Cohesion, Site Studio is a composable, low-code digital experience tool by Acquia that enables users to build and assemble pages with less to no code. Check out our previously written article about how to build component-based websites on Drupal using Site Studio.   Style Guide Manager is an optional module that you can enable within Site Studio. It centralizes the design elements like colors, typography, and components in one place, making it easier to maintain a cohesive look and feel throughout your site. It provides a set of style guides that are theme-specific. You can create style guide(s) to manage Site Studio styles within your Drupal theme settings. You can even override your theme styles using the Style guides. Advantages: Change the appearance of your Drupal website based on the active theme. Apply global styles and change the appearance with a simple-to-use interface. Create design systems for multi-brand and multi-sites. Style guide manager has two interfaces: Style guide builder Style guide Style Guide Builder The Style Guide Builder is a tool within Acquia Site Studio that allows you to actively create and manage the Style Guide. It streamlines the process of updating and maintaining the design standards. Changes made here are automatically applied throughout the site. Style guide The output of a Style Guide Builder - a set of design guidelines, is the Style Guide. The Style Guide is a collection of design rules, standards, and components that define the visual appearance of your website. Creating a Style Guide First, make sure you have installed Acquia Site Studio.  Navigate to /admin/cohesion/style_guides  Click on Add Style guide Add the Title Click the + button below the Style Guide form to add the form fields. Add the fields such as Font picker, Color picker, etc. with the combination of form layout fields such as Group accordion, and Tabs as per your requirement. Give a meaningful name for the Field Label so it will generate a meaningful token. This is how your Style Guide creation page will look like: You can also see the preview below of your Style Guide form builder and how it looks on the theme settings. Click on Save and Continue Managing your Styles Now that you have successfully created a Style Guide, let's see where and how you can manage your styles. Navigate to your theme appearance settings (here mine is: /admin/appearance/settings/techx) Add your values such as fonts, colors, etc., and save the configuration. This is how your style guide will look like after successfully saving the configuration. Now, you need to use the Style Guide tokens in the styles to see your styles on the front end as per the Style Guide values. Tokens are predefined variables or placeholders representing design elements such as colors, typography, spacing, and other visual properties. This is not just restricted to styles, you can use these tokens throughout your Site Studio like templates, or components as per your requirements. For example: Make sure you enable the token variable mode and then add your tokens. Implementing the Style Guide With Site Studio’s Style Guide Manager, you can create multiple style guides as per your requirements. You can see all of them in your theme settings as shown below This is what my front end looks like. You can change the values in the Style Guide per your requirements and verify the page/site accordingly. Final Thoughts Site Guide Manager is a very useful tool for non-technical users like content editors and marketers to see all the styles in one place with an easy-to-use user interface and modify them according to their choice. All of this without depending on a developer.        Are you looking to build highly engaging, omnichannel, and result-driven solutions with Acquia and Drupal? We are Acquia partners and we know what it takes to get you there. Talk to us today to find out more.        
Categories: FLOSS Project Planets

Web Wash: Getting Started with Webform in Drupal (2024)

Planet Drupal - Mon, 2024-02-05 20:00

Webform is a Drupal module that allows you to create forms directly in Drupal without using a 3rd party service.

It can be used to create basic “Contact Us” and complex application forms with custom field logic and integration.

In this getting started guide you’ll learn how to:

  1. Create a form
  2. Add elements to form
  3. Customize form with conditional logic
  4. Embed the form
  5. Send submissions to Google Sheets

This tutorial accompanies the video above.

Categories: FLOSS Project Planets

Factorial.io: A weekend dedicated to Drupal CMS

Planet Drupal - Mon, 2024-02-05 19:00

For years, the last weekend in January has been a special one for the worldwide community behind the CMS system Drupal: The Global Contribution Weekend. Factorial has been a major contributor to the Drupal community for many years, so we hosted our own hybrid Global Contribution Weekend event.

Categories: FLOSS Project Planets

Glyph Lefkowitz: Let Me Tell You A Secret

Planet Python - Mon, 2024-02-05 17:36

I do consulting1 on software architecture, network protocol development, python software infrastructure, streamlined cloud deployment, and open source strategy, among other nerdy things. I enjoy solving challenging, complex technical problems or contributing to the open source commons. On the best jobs, I get to do both.

Today I would like to share with you a secret of the software technology consulting trade.

I should note that this secret is not specific to me. I have several colleagues who have also done software consulting and have reflected versions of this experience back to me.2

We’ll get to the secret itself in a moment, but first, some background.

Companies do not go looking for consulting when things are going great. This is particularly true when looking for high-level consulting on things like system architecture or strategy. Almost by definition, there’s a problem that I have been brought in to solve. Ideally, that problem is a technical challenge.

In the software industry, your team probably already has some software professionals with a variety of technical skills, and thus they know what to do with technical challenges. Which means that, as often as not, the problem is to do with people rather than technology, even it appears otherwise.

When you hire a staff-level professional like myself to address your software team’s general problems, that consultant will need to gather some information. If I am that consultant and I start to suspect that the purported technology problem that you’ve got is in fact a people problem, here is what I am going to do.

I am going to go get a pen and a pad of paper, then schedule a 90-minute meeting with the most senior IC3 engineer that you have on your team. I will bring that pen and paper to the meeting. I will then ask one question:

What is fucked up about this place?

I will then write down their response in as much detail as I can manage. If I have begun to suspect that this meeting is necessary, 90 minutes is typically not enough time, and I will struggle to keep up. Even so, I will usually manage to capture the highlights.

One week later, I will schedule a meeting with executive leadership, and during that meeting, I will read back a very lightly edited4 version of the transcript of the previous meeting. This is then routinely praised as a keen strategic insight.

I should pause here to explicitly note that — obviously, I hope — this is not an oblique reference to any current or even recent client; if I’d had this meeting recently it would be pretty awkward to answer that “so, I read your blog…” email.5 But talking about clients in this way, no matter how obfuscated and vague the description, is always a bit professionally risky. So why risk it?

The thing is, I’m not a people manager. While I can do this kind of work, and I do not begrudge doing it if it is the thing that needs doing, I find it stressful and unfulfilling. I am a technology guy, not a people person. This is generally true of people who elect to go into technology consulting; we know where the management track is, and we didn’t pick it.

If you are going to hire me for my highly specialized technical expertise, I want you to get the maximum value out of it. I know my value; my rates are not low, and I do not want clients to come away with the sense that I only had a couple of “obvious” meetings.

So the intended audience for this piece is potential clients, leaders of teams (or organizations, or companies) who have a general technology problem and are wondering if they need a consultant with my skill-set to help them fix it. Before you decide that your issue is the need to implement a complex distributed system consensus algorithm, check if that is really what’s at issue. Talk to your ICs, and — taking care to make sure they understand that you want honest feedback and that they are safe to offer it — ask them what problems your organization has.

During this meeting it is important to only listen. Especially if you’re at a small company and you are regularly involved in the day-to-day operations, you might feel immediately defensive. Sit with that feeling, and process it later. Don’t unload your emotional state on an employee you have power over.6

“Only listening” doesn’t exclusively mean “don’t push back”. You also shouldn’t be committing to fixing anything. While the information you are gathering in these meetings is extremely valuable, and you should probably act on more of it than you will initially want to, your ICs won’t have the full picture. They really may not understand why certain priorities are set the way they are. You’ll need to take that as feedback for improving internal comms rather than “fixing” the perceived problem, and you certainly don’t want to make empty promises.

If you have these conversations directly, you can get something from it that no consultant can offer you: credibility. If you can actively listen, the conversation alone can improve morale. People like having their concerns heard. If, better still, you manage to make meaningful changes to address the concerns you’ve heard about, you can inspire true respect.

As a consultant, I’m going to be seen as some random guy wasting their time with a meeting. Even if you make the changes I recommend, it won’t resonate the same way as someone remembering that they personally told you what was wrong, and you took it seriously and fixed it.

Once you know what the problems are with your organization, and you’ve got solid technical understanding that you really do need that event-driven distributed systems consensus algorithm implemented using Twisted, I’m absolutely your guy. Feel free to get in touch.

  1. While I immensely value my patrons and am eternally grateful for their support, at — as of this writing — less than $100 per month it doesn’t exactly pay the SF bay area cost-of-living bill. 

  2. When I reached out for feedback on a draft of this essay, every other consultant I showed it to said that something similar had happened to them within the last month, all with different clients in different sectors of the industry. I really cannot stress how common it is. 

  3. “individual contributor”, if this bit of jargon isn’t universal in your corner of the world; i.e.: “not a manager”. 

  4. Mostly, I need to remove a bunch of profanity, but sometimes I will also need to have another interview, usually with a more junior person on the team to confirm that I’m not relaying only a single person’s perspective. It is pretty rare that the top-of-mind problems are specific to one individual, though. 

  5. To the extent that this is about anything saliently recent, I am perhaps grumbling about how tech CEOs aren’t taking morale problems generated by the constant drumbeat of layoffs seriously enough

  6. I am not always in the role of a consultant. At various points in my career, I have also been a leader needing to sit in this particular chair, and believe me, I know it sucks. This would not be a common problem if there weren’t a common reason that leaders tend to avoid this kind of meeting. 

Categories: FLOSS Project Planets

TestDriven.io: Django REST Framework and Vue versus Django and HTMX

Planet Python - Mon, 2024-02-05 17:28
This article compares the development experience with Vue and Django REST Framework against HTMX and Django.
Categories: FLOSS Project Planets

PyCharm: PyCharm 2024.1 EAP 3: Tool Window Names in the New UI

Planet Python - Mon, 2024-02-05 17:05

PyCharm 2024.1 EAP 3 is now available. This latest update focuses on enhancing your interactions with the IDE’s interface.

You can download the new version from our website, update directly from the IDE or via the free Toolbox App, or use snaps for Ubuntu.

Let’s take a closer look at what’s included in this new version.

User experience Option to show tool window names in the side toolbars

Starting with PyCharm 2024.1 EAP 3, it is now possible to display tool window names on side toolbars in the new UI. Simply right-click on the toolbar to access the context menu and choose Show Tool Window Names, or enable this option via Settings / Preferences | Appearance & Behavior | Appearance | Tool Windows. It’s also possible to tailor the width of the toolbar by dragging its edge.

Git tab removed from the Search Everywhere dialog

After analyzing the usage statistics, we’ve removed the Git tab from the Search Everywhere dialog by default. If you want to bring it back, you can do so via the Show Git tab in Search Everywhere checkbox in Settings / Preferences | Advanced Settings | Version Control. Git.

That’s it for this week. For a full list of changes, please refer to the release notes.

We value your feedback on these new updates and features. Feel free to leave your thoughts in the comments section or via X (formerly Twitter). If you encounter any issues, please don’t hesitate to report them via our issue tracker.

Categories: FLOSS Project Planets

DrupalEasy: DrupalEasy Podcast S16E4 - Kevin Quillen - Drupal 10 Development Cookbook

Planet Drupal - Mon, 2024-02-05 15:29

We talk with Kevin Quillen, author of Drupal 10 Development Cookbook, published in February, 2023 by Packt Publishing. 

URLs mentionedDrupalEasy News

Professional module development - 15 weeks, 90 hours, live, online course.  
Drupal Career Online - 12 weeks, 77 hours, live online, beginner-focused course.

Audio transcript 

We're using the machine-driven Amazon Transcribe service to provide an audio transcript of this episode.

Subscribe

Subscribe to our podcast on iTunes, Google Play, iHeart, Amazon, YouTube, or Spotify.

If you'd like to leave us a voicemail, call 321-396-2340. Please keep in mind that we might play your voicemail during one of our future podcasts. Feel free to call in with suggestions, rants, questions, or corrections. If you'd rather just send us an email, please use our contact page.

Credits

Podcast edited by Amelia Anello.
 

Categories: FLOSS Project Planets

Pages