Feeds
Django Weblog: Django security releases issued: 5.0.2, 4.2.10, and 3.2.24
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 filterThe 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
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:
- On the main branch
- On the 5.0 release branch
- On the 4.2 release branch
- On the 3.2 release branch
The following releases have been issued:
- Django 5.0.2 (download Django 5.0.2 | 5.0.2 checksums)
- Django 4.2.10 (download Django 4.2.10 | 4.2.10 checksums)
- Django 3.2.24 (download Django 3.2.24 | 3.2.24 checksums)
The PGP key ID used for this release is Natalia Bidart: 2EE82A8D9470983E
General notes regarding security reportingAs 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.
Real Python: Python Basics Exercises: Lists and Tuples
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 ]
Tag1 Consulting: Gander Automated Performance Testing - Video Demo with Catch
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:41Robert McQueen: Flathub: Pros and Cons of Direct Uploads
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.
Qt Wayland, Supercharged
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 StoreFushan 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 decorationsI 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 expectTo 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âDropFurthermore, 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 previouslyThe 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.
Update: xdg-toplevel-drag merged
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!
Python Bytes: #370 Your Very Own Heroku
Specbee: Style Made Simple with Acquia Site Studioâs Style Guide Manager
Web Wash: Getting Started with Webform in Drupal (2024)
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:
- Create a form
- Add elements to form
- Customize form with conditional logic
- Embed the form
- Send submissions to Google Sheets
This tutorial accompanies the video above.
Factorial.io: A weekend dedicated to Drupal CMS
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.
Glyph Lefkowitz: Let Me Tell You A Secret
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.
-
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. â©
-
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. â©
-
âindividual contributorâ, if this bit of jargon isnât universal in your corner of the world; i.e.: ânot a managerâ. â©
-
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. â©
-
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. â©
-
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. â©
TestDriven.io: Django REST Framework and Vue versus Django and HTMX
PyCharm: PyCharm 2024.1 EAP 3: Tool Window Names in the New UI
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 toolbarsStarting 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 dialogAfter 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.
DrupalEasy: DrupalEasy Podcast S16E4 - Kevin Quillen - Drupal 10 Development Cookbook
We talk with Kevin Quillen, author of Drupal 10 Development Cookbook, published in February, 2023 by Packt Publishing.Â
URLs mentioned- Drupal 10 Development CookbookÂ
- Open AI / ChatGPT integration module
- VelirÂ
- Kevin's blogÂ
- Drupal Test TraitsÂ
- Drush's generate commandÂ
Professional module development - 15 weeks, 90 hours, live, online course. Â
Drupal Career Online - 12 weeks, 77 hours, live online, beginner-focused course.
We're using the machine-driven Amazon Transcribe service to provide an audio transcript of this episode.
SubscribeSubscribe 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.
CreditsPodcast edited by Amelia Anello.
Â
DrupalEasy: Debugging all the things with Xdebug, DDEV, PhpStorm, PhpUnit
Over the past few years, we've published a couple of blog posts about setting up Xdebug for Drupal module development. But, like all things in tech, there's always more to learn as tools and technology evolve.
The setupI was recently working with one of our Professional (Drupal) Module Development students trying to determine why she wasn't able to use Xdebug to debug a PhpUnit-based functional test. To be clear, the breakpoint wasn't set in the actual test class, the breakpoint was set in some custom module code that was called by the test class.
In functional tests, Guzzle is used by PhpUnit to make calls like:
$this->drupalGet('')So, in a way, there isn't a direct PHP connection between test class and the code under test. It is in this circumstance that the breakpoint wasn't working.
Xdebug was working fine for this student to debug other aspects of the same project - it just wasn't hitting breakpoints during functional tests.
The solutionThis was one of those instances that I had seen (and solved) previously, but to be honest, PhpStorm/Xdebug solutions have often involved numerous trips into the (extensive) PhpStorm settings area. By the time the problem is fixed, I was never 100% sure exactly which change I made had actually solved the problem. But, this time, I was more carefulâŠ
Obviously, Xdebug must be enabled in DDEV, and PhpStorm's almost-magical auto-configuration for Xdebug needs to have configured a new "Server" with proper path mappings (especially for the project root).
The PhpStorm configuration settings related to Xdebug that I now recommend are:
- Set the "Max connections" value to 20 in the "PHP | Debug" configuration area (see image above).
- Uncheck the âForce break at the first line when no path mapping is specified,â "Force break at first line when a script is outside the project" and "Ignore external connections through unregistered server configurations" checkboxes in the "PHP | Debug" configuration area (see image above.)
- Set "Host" and "Name" in the "PHP | Servers" configuration are the same (and of the form name.ddev.site, where name is your site's DDEV machine name) (see image below.)
- When running functional tests, PhpStorm may request to see up a new server connection in "PHP | Servers" with the name "localhost." Allow it and ensure the path mapping is correct.
With these settings, functional PhpUnit tests can be effectively debugged.Â
PreviousNext: Automatic message scheduling and replacing hook_cron
Symfony Scheduler provides a viable replacement to hook_cron wherein messages can be scheduled for dispatch at a predefined interval. Messages are dispatched the moment they are scheduled, and there is no message duplication, making tasks more reliable and efficient.
by daniel.phin / 6 February 2024This post is part 4 in a series about Symfony Messenger.
- Introducing Symfony Messenger integrations with Drupal
- Symfony Messengerâ message and message handlers, and comparison with @QueueWorker
- Real-time: Symfony Messengerâ Consume command and prioritised messages
- Automatic message scheduling and replacing hook_cron
- Adding real-time processing to QueueWorker plugins
- Making Symfony Mailer asynchronous: integration with Symfony Messenger
- Displaying notifications when Symfony Messenger messages are processed
- Future of Symfony Messenger in Drupal
With this, the sm worker provided by the SM project, the Symfony Messenger integration with Drupal, can be solely relied on. Rather than legacy runners such as Drupal web cron, request termination cron (automated_cron.module), Drush cron, and Ultimate Cron.
Scheduler functionality is implemented by the Symfony Scheduler component. The Drupal integration is provided by the SM Scheduler module
Schedule providerCreate a message and message handler as usual, then create a Schedule Provider:
<?php declare(strict_types = 1); namespace Drupal\my_module\Messenger; use Symfony\Component\Scheduler\Attribute\AsSchedule; use Symfony\Component\Scheduler\RecurringMessage; use Symfony\Component\Scheduler\Schedule; use Symfony\Component\Scheduler\ScheduleProviderInterface; #[AsSchedule('my_scheduler_name')] final class MyScheduleProvider implements ScheduleProviderInterface { /** * {@inheritdoc} */ public function getSchedule(): Schedule { return (new Schedule())->add( RecurringMessage::every('5 minutes', new MyMessage()), ); } }A schedule provider is:
- a class at the Messenger\ namespace
- with a #[AsScheduler] class attribute
- implementing \Symfony\Component\Scheduler\ScheduleProviderInterface
- implements an getSchedule method. This method returns a message instance and the schedule frequency.
For dependency injection, schedule providers have autowiring enabled.
What would normally be the contents of a hook_cron hook would instead be added to the message handler. The message itself does not need to store any meaningful data.
Instead of intervals via RecurringMessage::every(...), crontab syntax can be used:
\Symfony\Component\Scheduler\RecurringMessage::cron('*/5 * * * *', new MyMessage());Running the workerLastly, schedulers must be run via the consume command with a dedicated transport. The transport name is the schedule ID prefixed by scheduler_. For example, given the scheduler ID my_scheduler_name from above, the transport name will be scheduler_my_scheduler_name.
The command finally becomes: sm messenger:consume scheduler_my_scheduler_name .
TimingMessages will be dispatched the moment their interval arrives. Normally intervals begin when the worker is initiated, however you can set a point in time to begin interval computation using the \Symfony\Component\Scheduler\RecurringMessage::every $from parameter.
The worker must be running at the time when a message is scheduled to be sent. The transport won't retroactively catch-up with messages not dispatched during the time it wasn't running.
The next post outlines how to intercept legacy Drupal @QueueWorker items and insert them into the message bus.
Tagged Symfony, Symfony Messenger, Symfony Scheduler, CronTalking Drupal: Talking Drupal #436 - Drupal & AI
Today we are talking about AI within Drupal, How AI can help, and Modules to use with guest Martin Anderson-Clutz. Weâll also cover Augmentor AI as our module of the week.
For show notes visit: www.talkingDrupal.com/436
Topics- Terminology
- IMF analysis
- Prompt engineering
- AI in Drupal
- Best way to try modules
- Best use of AI
- Other ways of integrating
- Augmentor AI
- Open AI
- Prompt Engineering: Get the Most From Your Drupal Site's AI Integration
- Terminology
- NLP - work with text provided in a conversational format, understand the intended meaning, and provide a relevant response
- AI - A subset of CS that aims to develop systems that can mimic human response, or automating sophisticated behavior
- ML - subset of AI that aims to act without explicit guidance, by extrapolating from known data
- Deep learning - a subset of ML which uses artificial neural networks with representational learning to develop and leverage their own means of classification and other feature detection
- LLM - an AI algorithm that uses Deep Learning techniques to accomplish NLP tasks such as responding to unstructured user prompts. LLMs are trained on massive data sets, often gathered from the internet, but sometimes using more specialized data
- Typically the AI interfaces our listeners are already using are based on an LLM, but the nature and recency of the data theyâve been trained on can vary widely. Recently Mike Miles created Drupal Droid, a GPT model specifically trained for Drupal developers, and you can find a demo of that in our YouTube channel
- Mike Miles Drupal Droid
- AI module list
- OpenAI Image
- Search API Pinecone
- TMGMT Translator OpenAI
Martin Anderson-Clutz - mandclu
HostsNic Laflin - nLighteneddevelopment.com nicxvan John Picozzi - epam.com johnpicozzi
MOTW CorrespondentMartin Anderson-Clutz - mandclu Augmentor AI
- Brief description:
- Have you ever wanted a highly configurable way to integrate multiple AI services with your Drupal site? Thereâs a module for that.
- Brief history
- How old: created in Oct 2022 by murrayw of Morpht, though recent releases are by elonel
- Versions available: 1.1.2 which works with Drupal 9.5 and 10
- Maintainership
- Actively maintained, most recent release was earlier this month
- Documentation available
- Number of open issues: 11, 3 of which are bugs
- Usage stats:
- 82 sites
- Module features and usage
- To use Augmentor AI, you need to define one or more âaugmentorâ configuration entities. An augmenter entity implements an augmentor type, which determines what AI service it can use, what configuration options it will have available, and so on.
- The augmentor will define one or more âmessagesâ that provide structure to the prompt that will be passed to the AI model in order to generate a response. It can also be configured in a variety of ways, such as how much randomness to use, a maximum response length, and more.
- You can expose your augmentor(s) to content creators by adding a CKEditor button, or by adding fields to your siteâs entity forms. For each field use can choose the widget to use, and how it should interact with any existing data in the field you want to target.
- For example, you could have it generate a summary from your body field and have it automatically populate the summary field. Or, you can have it suggest tags, but the specialized widget renders each suggestion as a clickable element that will add the tag to a core tag field.
- There are currently modules available to integrate Augmentor AI with ChatGPT, Google Cloud Vision, AWS AI, and more.
EuroPython: Seize the Opportunity: EuroPython 2024 Call for Contributors Extended!
Dear Python Enthusiasts,
Excitement is in the air as we gear up for EuroPython 2024, the conference that brings together the brightest minds in the European Python community!
In the spirit of inclusivity and community collaboration, we are thrilled to announce an extension of the Call for Contributors for EuroPython 2024! We want to ensure that everyone who wishes to contribute has the opportunity to do so. This extension allows more Pythonistas to be a part of this incredible event, shaping the conference and making it an enriching experience for all.
How Can You Get Involved?1. Review the proposals:Have you navigated the ins and outs of proposal submissions? The heart of EuroPython lies in its program. If you&aposre passionate about curating an exceptional conference agenda, we welcome you to join our team of Reviewers. By reviewing proposals and assisting in the selection process, you&aposll contribute to crafting a lineup that reflects the diversity and innovation within the Python community.
2. Volunteer for the Conference Organisation:EuroPython is not just about talks; it&aposs about fostering connections and creating memorable experiences. We&aposre looking for volunteers to help with various aspects of the conference, from registration to technical support. Your contribution, big or small, will play a crucial role in making EuroPython 2024 an unforgettable event for everyone involved.
3. Become a Speaker Mentor:Do you have experience as a speaker at Python conferences? Are you passionate about mentorship? We invite you to be a guiding force for our aspiring speakers. By volunteering as a Speaker Mentor, you&aposll play a pivotal role in shaping the future of Python conference speakers. Your expertise will help potential speakers refine their proposals, ensuring a diverse and high-quality program.
How to Get Involved:1. Reviewers:
- Sign up on the Registration Form.
- Share insights into your experience with Python and conferences.
- Join our collaborative effort to shape an outstanding conference program.
2. Volunteer for Conference Organisation:
- If you’d like to learn more about how we work, check this link: Teams Descriptions
- Let us know your availability and preferences for volunteering roles.
- Be a crucial part of the behind-the-scenes magic that makes EuroPython memorable.
3. Speaker Mentorship:
- Please fill out the Speaker Mentor Application Form.
- Provide details about your experience and areas of expertise.
- Our team will match you with potential speakers based on your background.
Why Volunteer?
Community Contribution:
- Contribute to the Python community by sharing your knowledge and experience.
- Help newcomers find their voice in the tech world.
Networking Opportunities:
- Connect with like-minded individuals, speakers, and fellow volunteers.
- Build relationships that can shape your professional journey.
Personal Growth:
- Hone your mentoring and organisational skills.
- Gain insights into the latest trends and innovations in the Python ecosystem.
Don&apost miss this chance to be an integral part of EuroPython 2024! Let&aposs join forces to make this conference a celebration of Python&aposs diversity, innovation, and community spirit. Together, we can create an event that inspires, educates, and leaves a lasting impact on every participant.
See you at EuroPython 2024!
EuroPython 2024 Organizing Team
The Drop Times: Beyond Code: A Decadal Odyssey with Drupal
Python Morsels: TextIOWrapper✠converting files to strings in Python
Every encountered an _io.TextIOWrapper object when you wished you had a string? That's Python's version of a "text file" object!
Table of contents
- TextIOWrapper objects are files
- _io.TextIOWrapper aren't the only "files"
- Don't try to pass a file to str
- You can also read line-by-line
- Use read to convert _io.TextIOWrapper objects to strings
If you use Python's built-in open function to read from a file, you'll end up with a _io.TextIOWrapper object. You can think of this as a file object.
>>> file = open("example.txt", mode="rt") >>> type(file) <class '_io.TextIOWrapper'>If you open a file in read mode (the default mode), you should be able to call the read method on your file object to read your file into a string:
>>> contents = file.read() >>> contents 'This is an example text-based file.\nIt existed before we read it.\n'More on reading text files in reading files in Python.
_io.TextIOWrapper aren't the only "files"Due to duck typing, âŠ
Read the full article: https://www.pythonmorsels.com/TextIOWrapper/