Feeds

Robin Wilson: One reason for getting a ‘No HTTP triggers found’ error when using Azure Functions with Python V2 programming model

Planet Python - 41 min 35 sec ago

Summary: It might be because there is an exception raised when importing your function_app.py – for example, caused by one of your import statements raising an exception, or a parsing error caused by a syntax error.

I was deploying a FastAPI app to Azure Functions recently. Azure Function is the equivalent of AWS Lambda – it provides a way to run serverless functions.

Since I’d last used Azure Functions, Microsoft have introduced the Azure Functions Python V2 programming model which makes it easier and cleaner to do a number of common tasks, such as hooking up a FastAPI app to run on Functions.

However, it also led to an error that I hadn’t seen before, and that I couldn’t find documented very well online.

Specifically, I was getting an error at the end of my function deployment saying No HTTP triggers found. I was confused by this because I had followed the documented pattern for setting up a FastAPI app. For reference, my function_app.py file looked a bit like this:

import azure.functions as func from complex_fastapi_app import app app = func.AsgiFunctionApp(app=app, http_auth_level=func.AuthLevel.ANONYMOUS)

This was exactly as documented. But I kept getting this error – why?

I replaced the import of my complex_fastapi_app with a basic FastAPI app defined in function_app.py, this time copied directly from the documentation:

import azure.functions as func from fastapi import FastAPI, Request, Response fast_app = FastAPI() @fast_app.get("/return_http_no_body") async def return_http_no_body(): return Response(content="", media_type="text/plain") app = func.AsgiFunctionApp(app=fast_app, http_auth_level=func.AuthLevel.ANONYMOUS)

Everything worked fine now and I didn’t get the error.

After a lot of debugging, it turns out that if there is an exception raised when importing your function_app.py file then Functions won’t be able to establish what HTTP triggers you have, and will give this error.

In this case, I was getting an exception raised when I imported my complex_fastapi_app, and that stopped the whole file being processed. Unfortunately I couldn’t find anywhere that this error was actually being reported to me – I must admit that I find Azure logging/error reporting systems very opaque. I assume it would have been reported somewhere – if anyone reading this can point me to the right place then that’d be great!

I’m sure there are many other reasons that this error can occur, but this was one that I hadn’t found documented online – so hopefully this can be useful to someone.

Categories: FLOSS Project Planets

The Python Coding Blog: The Python Coding Book is Out in Paperback and EBook

Planet Python - 2 hours 55 min ago

The Python Coding Book is out—I published the First Edition in paperback and EBook, which is a revised version of the “Zeroth” Edition which you’ve been able to read here on this site for a while—just ask Google for a “python book” and it will recommend this one as one of it’s top entries!

Read on to see the table of contents, the back-cover blurb introducing the textbook, and testimonials from you, the readers!

Buy Paperback or EBook

The Python Coding Book • A relaxed and friendly programming textbook for beginners

Table of Contents

First Edition, 368 pages

  • 0 Preface • How to Learn to Code
  • Before You Start • Downloading Python and an IDE
  • 1 Getting Started: Your First Project
  • 2 Loops, Lists, and More Fundamentals
  • 3 Power-up Your Coding: Create Your Own Functions
  • 4 Data, Data Types, and Data Structures
  • Monty and The White Room: Understanding Programming
  • 5 Dealing With Errors and Bugs
  • 6 Functions Revisited
  • 7 Object-Oriented Programming
Blurb

Imagine a programming book that feels like a conversation with a friend who’s here to show you the ropes—that’s The Python Coding Book by Stephen Gruppetta. This isn’t a dry textbook. It’s a warm, engaging guide into the world of Python programming, designed with beginners in mind.

With an approach that emphasises clarity and the joy of learning, Stephen guides you through the core concepts of programming, breaking down the barriers that make coding seem inaccessible to many. This book is built on the premise that to truly grasp programming, you need to understand the ‘why’ just as much as the ‘how’. Through engaging explanations, thoughtful analogies, and practical projects, you’re not just learning to code—you’re learning to think and solve problems like a programmer.

Forget about overwhelming details and rapid leaps in complexity. The Python Coding Book introduces concepts at a pace that ensures comprehension, building a solid foundation that instils both knowledge and confidence.

Are you ready for a rewarding journey? The Python Coding Book is more than a book—it’s your first step towards mastering programming with Python. This book is an invitation to not only learn Python but to fall in love with coding.

Testimonials

“It’s the first time I’m understanding what everything does.”

“Your writing is succinct, easy to understand, and process oriented, which I really appreciate. I’m starting to realise that my first experiences with programming weren’t at all representative of my abilities to problem solve or structure my thinking. It has been a great confidence booster for me, and I’m sure other folks are also realising that they were never really the problem. It was the lack of resources or inaccessible information that was the issue. Thanks again for this wonderful resource.”

“The clarity of your writing has helped me understand Python at a deeper level.”

“Thank you for this great resource. I believe this book is the most comprehensive way to understand the material, going beyond the mere memorisation of code snippets or syntax. I recommend it to everyone I talk to who is looking for a Python resource for getting started and who wants to really understand what they are doing at a deeper level.”

Buy Paperback or EBook

The post The Python Coding Book is Out in Paperback and EBook appeared first on The Python Coding Book.

Categories: FLOSS Project Planets

Specbee: Hooks or Events? Choosing the Best Approach for your Drupal Project

Planet Drupal - 5 hours 23 min ago
For Drupal developers, it's crucial to understand two fundamental concepts: Events and Hooks. Why? Because they’re the most powerful ways to enable customization and extensibility in Drupal. An event is a system or module-generated occurrence that triggers specific actions, while a hook is a callback function that allows developers to interact with, modify, or extend the behavior of a Drupal core or any module. Ready to learn more about each of them and find out how they’re different in their roles and usage in Drupal development? Dive in! What are Events in Drupal Events are just like hooks that tell Drupal to call your function if something happens. We can say Events are Object Oriented Hook System. Drupal Events allow various system components to interact and communicate with one another independently or in a decoupled manner. Characteristics Events are part of Drupal's broader adoption of the Symfony framework. Events are dispatched by certain actions or triggers within the system. You can dispatch events while writing custom code in order to notify other components in the system about actions taken by your code. Developers can subscribe to these events and define custom actions to be executed when the event occurs. Example Drupal core event: KernelEvents::REQUEST Scenario: Implementing a custom module that listens to the REQUEST event to perform specific actions before the request is processed. // MyModuleEventSubscriber.php namespace Drupal\my_module\EventSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\RequestEvent; class MyModuleEventSubscriber implements EventSubscriberInterface {   public static function getSubscribedEvents() {     $events[KernelEvents::REQUEST][] = ['onRequestEvent'];     return $events;   }   public function onRequestEvent(RequestEvent $event) {     // Custom logic to be executed on every request.   } }Discover Existing Events There are different methods for finding existing events: 1. Using the WebProfiler module: Download and enable WebProfiler and Devel module since WebProfiler depends on the Devel module Then navigate to Manage > Configuration > Devel Settings > WebProfiler and then select the checkbox to activate the “Events” toolbar item. Now while you visit any page on your site you should see the WebProfiler toolbar at the bottom of the page, and after clicking on the events toolbar icon you will get a list of all event subscribers and information that are called during that request. 2. Use Devel to view and event class: drush devel:event  Enter the number for which you want to get information.:   [0] kernel.controller   [1] kernel.exception   [2] kernel.request   [3] kernel.response   [4] kernel.terminate   [5] kernel.view  > 0  Enter the number to view the implementation.:   [0] Drupal\path_alias\EventSubscriber\PathAliasSubscriber::onKernelController   [1] Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController   [2] Drupal\webprofiler\DataCollector\RequestDataCollector::onKernelController  > 03. Search in your codebase for @Event:  In your editor such as Visual Studio or PHPStorm, search for text @Event within the file mask: *.php option. Subscribe to an Event As we know Drupal uses an event–driven architecture, where various components can communicate with each other by dispatching and subscribing to Events. Here is an example of subscribing to an Event in Drupal 9/10. 1. Define and Event subscriber service  # MyModule/my_module.services.yml services:   my_module.event_subscriber:     class: Drupal\my_module\EventSubscriber\MyModuleEventSubscriber     tags:       - { name: event_subscriber }2. Define an Event subscriber class // MyModule/src/EventSubscriber/MyModuleEventSubscriber.php namespace Drupal\my_module\EventSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\Event; /** * Class MyModuleEventSubscriber. */ class MyModuleEventSubscriber implements EventSubscriberInterface {   /**   * {@inheritdoc}   */   public static function getSubscribedEvents() {     // Specify the event(s) to subscribe to and the method to call when the event occurs.     $events = [       'node.insert' => 'onNodeInsert',       'user.login' => 'onUserLogin',     ];     return $events;   }   /**   * React to a node insert event.   */   public function onNodeInsert(Event $event) {     // Your logic here.     \Drupal::logger('my_module')->notice('Node inserted!');   }   /**   * React to a user login event.   */   public function onUserLogin(Event $event) {     // Your logic here.     \Drupal::logger('my_module')->notice('User logged in!');   } }In this example: MyModuleEventSubscriber is a class that implements the EventSubscriberInterface. The getSubscribedEvents method specifies which events the subscriber is interested in and which method to call when each event occurs. The onNodeInsert and onUserLogin methods contain the logic you want to execute when the corresponding events occur. Dispatch an Event In order to allow another developer to subscribe to the Events and react accordingly, you can dispatch an event within your modules or submodules. Before dispatching an Event we need to understand when to dispatch an event. You can dispatch an event if you want to extend your logic without updating your existing code. Events can be dispatched at any time like creating, updating, loading or deleting data managed by your module. Lets explain this with an example. Take a scenario where we want other developers to interact when a new entity (taking node here) is created after submitting your custom form. 1. Create a custom module (if don’t have): # Create the module directory mkdir modules/custom/custom_logger # Create the module file touch modules/custom/custom_logger/custom_logger.info.yml2. In custom_logger.info.yml, add the following content: name: 'Custom Logger' type: module description: 'Custom module for logging events.' core_version_requirement: ^8 || ^9 || ^10 package: Custom3. Create an Event: // modules/custom/custom_logger/src/Event/CustomLoggerEvent.php namespace Drupal\custom_logger\Event; use Symfony\Component\EventDispatcher\Event; /** * Defines the custom event for the custom_logger module. */ class CustomLoggerEvent extends Event {   /**   * The node that triggered the event.   *   * @var \Drupal\node\Entity\Node   */   protected $node;   /**   * CustomLoggerEvent constructor.   *   * @param \Drupal\node\Entity\Node $node   *   The node that triggered the event.   */   public function __construct($node) {     $this->node = $node;   }   /**   * Get the node object.   *   * @return \Drupal\node\Entity\Node   *   The node.   */   public function getNode() {     return $this->node;   } }4. Dispatch the Event: Creating any entity (taking node here) and dispatching a custom event with a created entity (node) as a parameter. // modules/custom/custom_logger/src/Form/MyCustomForm.php namespace Drupal\custom_logger\Form; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\custom_logger\Event\CustomLoggerEvent; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * My custom form. */ class MyCustomForm extends FormBase {   /**   * The event dispatcher service.   *   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface   */   protected $eventDispatcher;   /**   * Constructs a new MyCustomForm object.   *   * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher   *   The event dispatcher service.   */   public function __construct(EventDispatcherInterface $event_dispatcher) {     $this->eventDispatcher = $event_dispatcher;   }   /**   * {@inheritdoc}   */   public static function create(ContainerInterface $container) {     return new static(       $container->get('event_dispatcher')     );   }   /**   * {@inheritdoc}   */   public function getFormId() {     return 'my_custom_form';   }   /**   * {@inheritdoc}   */   public function buildForm(array $form, FormStateInterface $form_state) {     // Build your form elements here.     return $form;   }   /**   * {@inheritdoc}   */   public function submitForm(array &$form, FormStateInterface $form_state) {     // Process form submission and create a new node.     // ...     // Dispatch the custom event.     $node = $this->getCreatedNode(); // Implement this method based on your use case.     $event = new CustomLoggerEvent($node);     $this->eventDispatcher->dispatch('custom_logger.event', $event);     // Perform any additional actions after the event is dispatched.   } }5. React to Event: Now other modules or parts of the application can now subscribe to the custom_logger.event with the created node as a parameter. What are Hooks in Drupal Hooks allow modules to alter and extend the existing behavior of Drupal Core or any other module without modifying existing code. Read about update and post update hooks to update your Drupal site in this article. Characteristics Drupal's traditional way of allowing modules to interact with the system. Code can be improved or modified independently and incrementally. Hooks are predefined functions with specific names that Drupal core or modules call at various points during execution. Developers implement these functions in their modules to extend or alter default behavior. Very efficient and easy to implement. Types of Hooks Hooks that react to events: like when the user gets logged in and some action needs to be performed. This is very similar to Events. This is invoked when specific actions are performed. For example hook_user_cancel(). Hooks that answer questions: like “info hooks”. These are invoked when some component is gathering information about a particular topic. These hooks return arrays whose structure and values are determined in the hook definition. For example, see user module hook user_toolbar() that adds links to the common user account page to the Toolbar. Note: In  Drupal 8 or further versions this is generally handled by the plugin system. Therefore there are very few hooks present now than in Drupal 7. Hooks that alter existing data: Alter hooks are generally suffixed with alter. These are invoked to allow modules to alter the existing code. For example: hook_form_alter(). Example: Drupal core hook: hook_form_alter() Scenario: Modifying a form defined by another module. // my_module.module function my_module_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {   // Custom logic to alter the form. }Discover existing Hooks Hooks can be defined by any of contrib or custom modules, even though there are some hooks invoked by Drupal core subsystems like Form API that are always present. This can be a little tricky sometime to find out what hooks are available and which ones to implement. There are different ways to discover existing hooks: Look for the hook definitions in *.api.php files contained either in Drupal core or any contributed modules. You can use your IDE to search for functions whose name starts with hook_. You can get a complete list of hooks here. Another way is to use drush command that will five you a list of all implementations of a specific hook. drush fn-hook help #Alias of drush devel:hookInvoke a New Hook To allow other developers to modify or extends our feature you should invoke a hook or alternatively dispatch an event. This can be done on any action like creating, deleting, updating or event when we receive or push some data through API. Hooks are invoked using the module_handler \Drupal::moduleHandler() services. Hooks can be invoked in different ways: Execute the hook in every module that implements it: ModuleHandler::invokeAll() Execute the hook per-module, usually by looping over a list of enabled modules: ModuleHandler::invoke() Call an alter allowing for alteration of existing data structures using ModuleHandler::alter(). Define a new hook To define a new hook you should do the following: 1. Choose a unique name for your hook 2. Document your hook Hooks are documented in a {MODULE_NAME}.api.php file: // custom_hooks.api.php /** * Define a custom hook for reacting to specific events. * * This hook is invoked when a certain event occurs in the system. * Modules can implement this hook to perform additional actions in response to the event. * * @param string $param1 *   An example parameter for the hook. * @param array $param2 *   Another example parameter for the hook. * * @ingroup custom_hooks_hooks */ function hook_custom_event($param1, array $param2) {   // Your custom hook logic here. }3. Invoking your hook in your module’s code: /** * Implements hook_ENTITY_TYPE_view(). */ function hooks_example_node_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {   // Invoke a hook to alert other modules that the count was updated.   $module_handler = \Drupal::moduleHandler();   // In this example we're invoking hook_custom_event()             $module_handler->invokeAll('custom_event', [$entity]); }When to Use Events or Hooks Events: Prefer events when actions need to be decoupled or when integrating with Symfony components. Hooks: Use hooks for more straightforward modifications or when interacting with the Drupal core and contributed modules. Pros and Cons of using Events VS Hooks Events: Pros: Decoupling, better organization, and Symfony integration. Cons: Slightly steeper learning curve for those unfamiliar with Symfony. Hooks: Pros: Simplicity, well-established in Drupal, easier for Drupal – specific tasks. Cons: Tighter coupling, less organization in larger projects. Final Thoughts Understanding Events and Hooks is extremely crucial for effective Drupal development. While hooks are traditional Drupal mechanisms for extending functionality, events have been introduced since Drupal 8 as part of it’s event-driven architecture. Choosing the right mechanism should be based on the complexity and nature of the Drupal project. Got a Drupal project in mind that requires a 100% Drupal-focused expertise? We’d love to talk to you!
Categories: FLOSS Project Planets

Acquia Developer Portal Blog: DevOps: The Gravity of the Modern Web Cosmos

Planet Drupal - Mon, 2024-03-18 18:59

Some of the illustrations in this article are created by: Martin Anderson-Clutz and Thomas Scola.

🪐Imagine the modern web as an endless universe, a cosmos where websites and applications orbit around users like planets around stars, each vying for attention in the vast expanse of digital space. In this universe, for development teams, DevOps emerges as the force of gravity that holds everything together, an essential principle that ensures these digital worlds don't just float aimlessly but evolve, adapt, and thrive. 

Categories: FLOSS Project Planets

Data School: Jupyter & IPython terminology explained 💡

Planet Python - Mon, 2024-03-18 14:58

Are you trying to understand the differences between Jupyter Notebook, JupyterLab, IPython, Colab, and other related terms? You&aposre in the right place!

I&aposll explain by walking through a brief history of the IPython and Jupyter projects:

IPython

IPython was first released in 2006 as an "interactive" version of the Python shell. Whereas the Python shell uses the >>> prompt, you can recognize IPython from its use of In [1] and Out [1] notation to indicate input/output and line numbers:

IPython includes many features not present in the default Python shell, such as object introspection, "magic" commands, system shell access, and more.

IPython Notebook

In 2011, the IPython Notebook was released. It was known as a "computational notebook" because it allowed you to weave together code, plots, and narrative text into a single document:

It was called the IPython Notebook (and not the Python Notebook) because it used IPython as the "kernel", which is the language-specific process that runs the code in a notebook.

Jupyter Notebook

In 2015, the IPython Notebook introduced support for programming languages other than Python.

Also in 2015, IPython split into two projects: IPython (for Python-specific components) and Jupyter (for language-agnostic components).

As part of that split, the IPython Notebook was renamed the Jupyter Notebook. The name "Jupyter" was inspired by the open languages of science: Julia, Python, and R:

To be clear, "Jupyter Notebook" was the name of both the coding environment and the files created by that environment. In other words, you would open "the Jupyter Notebook" to create "a Jupyter notebook".

Jupyter notebook files used the extension ".ipynb", which was the extension (and file format) originally created for IPython notebooks.

JupyterLab

At this point, the Jupyter Notebook was a lightweight coding environment, with far less features than a traditional IDE (integrated development environment).

In 2018, JupyterLab (one word) was released as a more full-featured alternative to the Jupyter Notebook:

Notebooks created within JupyterLab are still called "Jupyter notebooks", they still use the extension ".ipynb", and they&aposre compatible with notebooks created by the Jupyter Notebook.

JupyterLab was originally designed to replace the Jupyter Notebook environment. However, due to the continued popularity of the "classic" Notebook environment, JupyterLab and Jupyter Notebook continue to be developed as separate applications (as of 2024).

Summary
  • The Jupyter Notebook is a lightweight coding environment for creating and editing Jupyter notebooks.
  • JupyterLab is more full-featured IDE for creating and editing Jupyter notebooks.
  • IPython is the Python kernel for Jupyter Notebook and JupyterLab, and is also a standalone Python shell. IPython is the reason that magic commands and other enhancements are available within Jupyter Notebook and JupyterLab.
  • Jupyter notebooks are computational documents that can contain code, plots, and text. They use the extension ".ipynb" and are compatible with both the Jupyter Notebook and JupyterLab environments.

Here are a few related terms that I didn&apost mention above:

  • JupyterLab Desktop is a cross-platform desktop application that allows you to create and manage multiple JupyterLab sessions and Python environments.
  • JupyterLite is a JupyterLab distribution that runs entirely in the browser, without you having to launch a Jupyter server from a terminal.
  • Google Colab, Kaggle Code, and Deepnote are a few of the many web-based services that provide a Jupyter-like interface for creating notebooks that are compatible with Jupyter. (More specifically, they can import and export files that use the ".ipynb" format.)

Are there any other Jupyter-related terms you want me to explain? Please let me know if the comments! 👇

Categories: FLOSS Project Planets

Talking Drupal: Talking Drupal #442 - Mercury Editor

Planet Drupal - Mon, 2024-03-18 14:00

Today we are talking about Mercury Editor, What it does, and how it could change your editorial life with guest Justin Toupin. We’ll also cover Webform Protected Downloads as our module of the week.

For show notes visit: www.talkingDrupal.com/442

Topics
  • What is Mercury Editor
  • What is powering Mercury Editor
  • Do you see any risk building on top of Paragraphs
  • Does Mercury Editor cost anything
  • Can companies hire Aten to add features
  • What are some key features
  • What makes Mercury Editor unique
  • How stable is the content
  • What happens if Paragraphs stops being supported
  • How can the community help
Resources Guests

Justin Toupin - atendesigngroup.com justin2pin

Hosts

Nic Laflin - nLighteneddevelopment.com nicxvan John Picozzi - epam.com johnpicozzi Anna Mykhailova - kalamuna.com amykhailova

MOTW Correspondent

Martin Anderson-Clutz - mandclu

  • Brief description:
    • Have you ever wanted to have downloadable content on your website, only available to visitors who have filled out a webform? There’s a module for that.
  • Module name/project name:
  • Brief history
    • How old: created in Sep 2010 by berliner, but the most recent releases are by james.williams of Computer Minds
    • Versions available: 7.x-1.1 and 8.x-1.0-alpha2 versions available, the latter of which works with Drupal 9 and 10
  • Maintainership
    • Actively maintained, the latest release was a week ago
    • Security coverage
    • Introductory blog linked on the project page
    • Number of open issues: 18 open issues, none of which are bugs against the current branch
  • Usage stats:
    • 804 sites
  • Module features and usage
    • Having thought leadership content like white papers or reports gated behind a lead capture form is a common pattern for websites, and this module is designed to make that easy to set up
    • You use the module by adding a handler to your webform, similar to triggering an email send
    • In the configuration for your webform protected download handler you have options for how much verification you want for the download link, whether or not the link should expire after a period of time, and so on, in addition to uploading one or more files that can be downloaded by people who submit the webform
    • The module provides tokens for the download URLs, so you can easily include them in a submission confirmation message or email
Categories: FLOSS Project Planets

Open Source AI Definition – Weekly update Mar 18

Open Source Initiative - Mon, 2024-03-18 12:58
Comments on draft 0.0.6 from the forum
  • Point raised by participant that training data has been listed both as optional and a precondition. This might cause confusion as it is unclear whether we should have the right to access training data or know what training data was used for the model
  • To contribute, read the new draft here 
Moving on to next steps! Town hall this Friday Comments on definitions under “What is open source AI? Still strong debate about access to training data 
  • There is a fear that this will harm the ecosystem in the long run, as the original work of the model never can be “forked” to improve the model itself.
Categories: FLOSS Research

The Drop Times: MidCamp 2024 Innovates with Unconference Format and Training

Planet Drupal - Mon, 2024-03-18 12:44
MidCamp 2024, set to take place at DePaul University, promises innovative formats and a focus shift towards AI, marking a significant evolution in the annual Midwest Drupal Camp's history.
Categories: FLOSS Project Planets

The Drop Times: Tracking Drupal's Global Footprint

Planet Drupal - Mon, 2024-03-18 12:44

Dear Readers,

Drupal has seen widespread adoption worldwide, a testament to its flexibility, security, and scalability. Renowned for its modular architecture and strong community support, Drupal empowers developers, businesses, and governments to create and manage diverse digital experiences. From educational institutions and media outlets to non-profit organizations and governmental agencies, the platform's extensive capabilities allow for the customization and integration necessary to meet complex digital needs.

An endeavor to track Drupal's usage across various industry sectors represents a need of the moment for the Drupal community and is put forth by Paul Johnson. The project aims to showcase Drupal's diverse applicability and strengthen its shared knowledge base by gathering detailed resources and data. This concerted effort, aimed at illuminating Drupal's footprint, will offer insights into the platform's impact and success across different domains. It sets the stage for a deeper understanding of the community's achievements and challenges, guiding them toward more strategic, evidence-based decisions within the digital ecosystem.

The DropTimes [TDT] has already published a comprehensive study on Drupal's usage in prominent educational institutions worldwide, which can set the right example for this new project. Grzegorz Pietrzak's study on global city website trends analysis further underscores Drupal's influence across diverse sectors, amplifying the platform's prominence within various industry verticals. The full study is published on our website; read it here

As the community delves into the specifics of these endeavors and their implications, it is crucial to remain connected and informed. With that, welcome to the last week's most important content covered by The DropTimes.

Performance is the cornerstone of user experience and operational efficiency in web development. Learn about the genesis, capabilities, and transformative potential of Gander, the automated performance testing framework for Drupal, as elucidated by Nathaniel Catchpole and Janez Urevc in Elma John's latest article

We have a new addition to our Spotlights channel, Zoocha, a leading Drupal Development Agency in the UK. The article discusses the intricate world of Zoocha, bringing to light the company's journey, strategies, and outlook with contributions from Will Huggins, the CEO, and the Zoocha team.

Dries Buytaert, the founder of Drupal, visited Japan for the first time in nearly eight years. He presented the latest developments in Drupal and associated web technologies at the Drupal Meetup. Tokyo. Read the article by Kazima Abbas for a comprehensive overview of the Tokyo Meetup and its significance. 

Interestingly, the recent Drupal Meetup, organized by Valuebound in collaboration with the Drupal Association, marked a significant event for Drupal enthusiasts and professionals. The event, held at Valuebound's office in Bangalore, featured a special meet-and-greet session with Tim Doyle, the CEO of the Drupal Association. As an after-note, Tim wrote, that "Drupal is alive and well in India", owing to the enthusiastic Drupal Community in India.

The Drupal Community has many events to celebrate this week, but MidCamp 2024 and DrupalSouth Sydney 2024 tops the list. As the Media Partner for both events, The DropTimes is determined to provide its readers timely updates. A complete list of events for the week is available here.

The upcoming DrupalCamp Burkina Faso 2024 is close to reaching its funding target, needing just $2,000 more to facilitate the largest DrupalCamp event in West Africa.  DrupalCamp Asheville is now open for speaker submissions, inviting seasoned presenters and newcomers to share their expertise and insights. Also, the last chance to submit proposals for Stanford WebCamp 2024 ends on or before March 25, 2024. The DrupalSouth Splash Awards 2024 shortlist, sponsored by Ironstar, has been announced ahead of the event. 

Imre Gmelig Meijling, CEO of React Online Digital Agency in The Netherlands, has been introduced as one of the newest members elected to the Drupal Association Board. Alex Moreno has launched a comprehensive guide to enhance impactful contributions to Drupal and the Drupal Association. The contributor guide lists strategic initiatives, crucial issues, and essential modules, offering contributors an avenue to make significant impacts within the Drupal community.

The Drupal community has recently seen the introduction of a new module, Bill of Lading, created by Jeff Greenberg. This module simplifies site management by generating a comprehensive list of Drupal structures using a new Drush command, 'bol.' QuantCDN co-founder Kristen Pol has announced a major update to their Drupal static site generator, enhancing Drupal 9 and 10 integration with new features, including visibility into Quant metadata directly within the Drupal platform.

We acknowledge that there are more stories to share. However, due to constraints in selection, we must pause further exploration for now.

To get timely updates, follow us on LinkedIn, Twitter and Facebook. Also, join us on Drupal Slack at #thedroptimes.

Thank you,

Sincerely
Alka Elizabeth
Sub-editor, TheDropTimes.

Categories: FLOSS Project Planets

The Drop Times: Drupal Page Builders—Part 1: Paragraph-Based Solutions

Planet Drupal - Mon, 2024-03-18 12:44
Dive into the changing dynamics of Drupal's page-building features with André Angelantoni's new series on The DropTimes. Discover the progression of Drupal's page layout options as the author begins exploring Paragraph-Based Solutions. Gain historical insights, learn about the shift towards Layout Builder, and examine the Paragraphs module and related tools like Layout Paragraphs and Mercury Editor. Anticipate detailed discussions on contributed modules, alternative solutions, and potent distributions in the forthcoming parts of the series. Ideal for developers and content managers seeking to upgrade their Drupal 10+ projects.
Categories: FLOSS Project Planets

Drupal Mountain Camp: Thanks for being a part of Drupal Mountain Camp 2024

Planet Drupal - Mon, 2024-03-18 10:10
Thanks for being a part of Drupal Mountain Camp 2024 admin Mon, 03/18/2024 - 15:10

Wow, what an event!

We would like to thank you for contributing to the magic of Drupal Mountain Camp 2024 and making it tremendous success!

From the snow-capped peaks of learning to the comfy fireside chats of networking, the event was a one-of-a-kind experience that left a lasting imprint on all of us.

As I look back on the laughter-filled evenings and the insightful discussions that echoed through the venue to the fondue evening, I'm reminded of the incredible sense of community that defines us.

We are immensely grateful for the insightful presentations by our honoured speakers, the generous support from our valuable sponsors, and the dedication and hard work of our volunteers to ensure the event's success.

Together, we explored new ideas, shared knowledge, and forged meaningful connections within the Drupal community.

As we reflect on the success of this year's conference, we're already looking forward to what lies ahead for the next Drupal Mountain Camp.

 

 

Feedback

We implore everyone to submit their feedback to each session they attended by going to the schedule and clicking on each session, then giving a quick anonymous feedback.

The schedule should still be available via the custom domain:
https://event.drupalmountaincamp.ch/drupal-mountain-camp-2024/schedule/

Furthermore, we would greatly appreciate all feedback regarding the conference as a whole to be submitted on the "Closing Session".

 

Highlights

Here's some of the statistics that we calculated from the event.

  • 77 participants
  • 350+ coffees consumed
  • 63 Fondues eaten at Schatzalp
  • 39 People took the sled down Schatzalp
  • 0 Injuries
  • 11 Sponsors
  • 12 Team members
  • 6 Volunteers
  • 17.65% Diverse Speakers
  • 58 Posts in LinkedIn, Instagram Twitter and Mastodon
  • 236 Unique Visitors on LinkedIn since Nov 11
  • 25 issues worked on #MountainCamp2024

Participants per Country

  • 46    Switzerland (CH)
  • 6    Belgium (BE)
  • 5    United Kingdom (GB)
  • 4    Germany (DE)
  • 3    Finland (FI)
  • 3    France (FR)
  • 2    Slovenia (SI)
  • 2    United States (US)
  • 1    Australia (AU)
  • 1    Austria (AT)
  • 1    Bulgaria (BG)
  • 1    Portugal (PT)
  • 1    Spain (ES)
  • 1    Suriname (SR)

 

Media

We're very grateful to have such an awesome media team to capture every single moment.

Official photos by Patrick Itten
https://foto.patrickitten.ch/drupal-mountain-camp-2024

Photos by Josef Kruckenberg
https://www.flickr.com/photos/185226958@N05/albums/72177720315270848/

Relive the recap here by Dan Lemon
https://youtu.be/Z6AX_gexOg0

Extended fondue and sledding with the little happy birthday surprise
https://youtu.be/BgBzHbveSdE

 

Session Videos

We were able to record all the keynote sessions along with all sessions that took place in the Pischa room.

You can find the session videos on our YouTube Channel, under the playlist title "Sessions - Drupal Mountain Camp 2024"

https://www.youtube.com/playlist?list=PL6C9y4dEueZhksow0hSYFsPKGIo2c735C

 

Aaron Winborn Award

This is a reminder that the Aaron Winborn award nominations are open until Friday, March 29, 2024

This annual award recognizes an individual who demonstrates personal integrity, kindness, and above-and-beyond commitment to the Drupal community.
It includes a scholarship and travel stipend for the winner to attend DrupalCon North America and recognition in a plenary session at the event.

https://www.drupal.org/community/cwg/blog/nominations-are-now-open-for-the-2024-aaron-winborn-award

 

What's Next

Drupal Switzerland Association plans to host further in-person events throughout the year, such as gatherings in Zurich, Bern, and hopefully somewhere in the Swiss Romandie area.

We will post new events to our meetup.com account, as well as cross-posting to our Drupal Switzerland Slack and also to Drupal Groups:
https://www.meetup.com/zurich-drupal-meetup/
https://groups.drupal.org/switzerland

Furthermore, we'd like to highlight these two upcoming events for the Drupal community.

 

Drupal Dev Days Burgas

Drupal Developer Days is an annual gathering of people loving, learning, and discussing all things relating to Drupal. This year it'll be hosted by Drupal Bulgaria in Burgas, by the seaside.

The event is planned to take place between June 26-28, 2024 at Burgas Free University in Burgas, Bulgaria.

Drupal Dev Days 2024 is going to be a 3-day event full of amazing sessions, workshops and discussions as well as various social events and other surprises. 

Find out more on their website
https://ddd2024.drupalcamp.bg/

 

DrupalCon Barcelona

You may have seen Mercè in Davos, the mascot for DrupalCon Barcelona. Kuoni-Tumlare will calculate out who won the contest for a free ticket to DrupalCon Barcelona 2024.

This year's DrupalCon takes place from September 24-27, 2024 at the stunning Centre de convencions internacional de Barcelona (CCIB).

Barcelona's accessibility ensures that this event is within reach for all Drupal enthusiasts.

https://events.drupal.org/barcelona2024

 

A Final Thank You

We'd like to extend our deepest gratitude to our valuable sponsors, whose generous support made Drupal Mountain Camp 2024 possible.

To our esteemed speakers, thank you for sharing your expertise and insights, enriching the experience for all attendees.

A heartfelt thank you to our dedicated volunteers, whose hard work and enthusiasm ensured the smooth execution of every detail.

And last but certainly not least, to all our participants, thank you for bringing your passion and energy, making Drupal Mountain Camp a vibrant and unforgettable gathering.

Your contributions have truly made a difference and have left a lasting impact on our community.

Until we meet again, let's continue to collaborate, learn, and grow together in the spirit of Drupal.

 

On behalf of the Drupal Mountain Camp organisation team,
Dan Lemon

 

Categories: FLOSS Project Planets

Real Python: Model-View-Controller (MVC) in Python Web Apps: Explained With Lego

Planet Python - Mon, 2024-03-18 10:00

If you’re curious about web development, then you’ve likely encountered the abbreviation MVC, which stands for Model-View-Controller. You may know that it’s a common design pattern that’s fundamental to many Python web frameworks and even desktop applications.

But what exactly does it mean? If you’ve had a hard time wrapping your head around the concept, then keep on reading.

In this tutorial, you’ll:

  • Approach understanding the MVC pattern through a Lego-based analogy
  • Learn what models, views, and controllers are conceptually
  • Tie your conceptual understanding back to concrete web development examples
  • Investigate Flask code snippets to drive the point home

Maybe you built things with Lego as a kid, or maybe you’re still a Lego-aficionado today. But even if you’ve never pieced two Lego blocks together, keep on reading because the analogy might still be a good building block for your understanding.

Get Your Code: Click here to download an example Flask app that will help you understand MVC in Python web apps.

Take the Quiz: Test your knowledge with our interactive “Model-View-Controller (MVC) in Python Web Apps: Explained With Lego” quiz. Upon completion you will receive a score so you can track your learning progress over time:

Take the Quiz »

Explaining the Model-View-Controller Pattern With Lego

Imagine that you’re ten years old and sitting on your family room floor. In front of you is a big bucket of Lego, or similar modular building blocks. There are blocks of all different shapes and sizes:

  • 🟦🟦🟦 Some are blue, tall, and long.
  • 🟥 Some are red and cube-shaped.
  • 🟨🟨 Some are yellow, big, and wide.

With all of these different Lego pieces, there’s no telling what you could build!

Just as your mind is filling with the endless possibilities, you hear something coming from the direction of the couch. It’s your older brother, voicing a specific request. He’s saying, “Hey! Build me a spaceship!”

“Alright,” you think, “that could actually be pretty cool.” A spaceship it is!

So you get to work. You start pulling out the Lego blocks that you think you’re going to need. Some big, some small. Different colors for the outside of the spaceship, different colors for the engines.

Now that you have all of your building blocks in place, it’s time to assemble the spaceship. And after a few hours of hard work, you now have in front of you—a spaceship:

🟦 🟦🟥🟦 🟦🟥🟥🟥🟦 🟦🟥🟥🟥🟥🟥🟦 🟦🟥🟥🟥🟥🟥🟦 🟦🟥🟩🟩🟩🟥🟦 🟦🟥🟩🟦🟩🟥🟦 🟦🟥🟩🟩🟩🟥🟦 🟦🟥🟥🟥🟥🟥🟦 🟦🟥🟥🟥🟥🟥🟦 🟦🟥🟥🟥🟥🟥🟦 🟦🟥🟥🟥🟥🟥🟥🟥🟥🟥🟦 🟦🟥🟥🟥🟥🟥🟥🟥🟥🟥🟦 🟦🟥🟨🟨🟥🟥🟥🟨🟨🟥🟦 🟨🟨 🟨🟨

You run to find your brother and show him the finished product. “Wow, nice work!”, he says. Then he quietly adds:

Huh, I just asked for that a few hours ago, I didn’t have to do a thing, and here it is. I wish everything was that easy.

Your Brother

What if I told you that building a web application using the MVC pattern is exactly like building something with Lego blocks?

User Sends a Request Read the full article at https://realpython.com/lego-model-view-controller-python/ »

[ 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

ListenData: Python for Data Science: Beginner's Guide

Planet Python - Mon, 2024-03-18 08:32

This tutorial would help you to learn Data Science with Python by examples. It is designed for beginners who want to get started with Data Science in Python. Python is an open source language and it is widely used as a high-level programming language for general-purpose programming. It has gained high popularity in data science world. In the PyPL Popularity of Programming language index, Python leads with a 29 percent share. In advanced analytics and predictive analytics market, it is ranked among top 3 programming languages for advanced analytics.

Data Science with Python Tutorial Table of Contents Introduction Python is widely used and very popular for a variety of software engineering tasks such as website development, cloud-architecture, back-end etc. It is equally popular in data science world. In advanced analytics world, there has been several debates on R vs. Python. There are some areas such as number of libraries for statistical analysis, where R wins over Python but Python is catching up very fast.With popularity of big data and data science, Python has become first programming language of data scientists.

There are several reasons to learn Python. Some of them are as follows -

  1. Python runs well in automating various steps of a predictive model.
  2. Python has awesome robust libraries for machine learning, natural language processing, deep learning, big data and artificial Intelligence.
  3. Python wins over R when it comes to deploying machine learning models in production.
  4. It can be easily integrated with big data frameworks such as Spark and Hadoop.
  5. Python has a great online community support.
Do you know these sites are developed in Python?
  1. YouTube
  2. Instagram
  3. Reddit
  4. Dropbox
  5. Disqus
Python 2 vs. 3 Google yields thousands of articles on this topic. Some bloggers opposed and some in favor of 2.7. If you filter your search criteria and look for only recent articles, you would find Python 2 is no longer supported by the Python Software Foundation. Hence it does not make any sense to learn 2.7 if you start learning it today. Python 3 supports all the packages. Python 3 is cleaner and faster. It is a language for the future. It fixed major issues with versions of Python 2 series. Python 3 was first released in year 2008. It has been 12 years releasing robust versions of Python 3 series. You should go for latest version of Python 3. How to install Python? There are two ways to download and install Python
  1. Download Anaconda. It comes with Python software along with preinstalled popular libraries.
  2. Download Pythonfrom its official website. You have to manually install libraries.
Recommended : Go for first option and download anaconda. It saves a lot of time in learning and coding Python Coding Environments Anaconda comes with two popular IDE :
  1. Jupyter (Ipython) Notebook
  2. Spyder
Spyder. It is like RStudio for Python. It gives an environment wherein writing python code is user-friendly. If you are a SAS User, you can think of it as SAS Enterprise Guide / SAS Studio. It comes with a syntax editor where you can write programs. It has a console to check each and every line of code. Under the 'Variable explorer', you can access your created data files and function. I highly recommend Spyder! Spyder - Python Coding Environment Jupyter (Ipython) Notebook Jupyter is equivalent to markdown in R. It is useful when you need to present your work to others or when you need to create step by step project report as it can combine code, output, words, and graphics.
To read this article in full, please click hereThis post appeared first on ListenData
Categories: FLOSS Project Planets

Golems GABB: Advanced Content Management with the Paragraphs Module in Drupal

Planet Drupal - Mon, 2024-03-18 06:13
Advanced Content Management with the Paragraphs Module in Drupal Editor Mon, 03/18/2024 - 12:13

Creating user-friendly and stylish web pages can sometimes make you nervous, and maybe you want to turn off your computer - does that sound familiar? Even using popular CMSs, including Drupal, sometimes it is difficult to understand this issue and create a functional, modern website. Drupal can offer several effective solutions, and today, we will look at one of them - the Drupal Paragraphs module.
Creating a home page, or even a regular page on a website, requires much effort and time unless you're a professional web developer. Many people with initial design skills face similar problems and spend much time searching for solutions. Often, everything comes with experience. Through trial and error, reading various articles, and watching videos on YouTube, we are looking for an opportunity to achieve the goal.

Categories: FLOSS Project Planets

LN Webworks: Drupal Community Module Evaluation: A Go-to Guide

Planet Drupal - Mon, 2024-03-18 05:47

It's not only about what a module from the Drupal community can achieve when you consider using it. Along with how long you want your website to remain, you need also to consider who will maintain it after it goes up. These factors influence the level of danger you are willing to accept. 

For instance, you might desire modules with an excellent track record and robust community support if you're not too familiar with Drupal.

Every module available on Drupal.org is licensed under the GPLv2 and is open source. This means that while they are free to use, any dangers are your responsibility but every module has a community of users who assist with problems and updates, as well as a team of maintainers for each module. Additionally, partnering with a reputable Drupal web development company can provide further assurance in terms of module selection, ongoing support, and maintenance.

Let's discuss some factors to consider when evaluating a community module.

Categories: FLOSS Project Planets

How to write a QML effect for KWin

Planet KDE - Mon, 2024-03-18 02:00

Since the dawn of the times, the only way to implement any effect that has fancy user interface used to be in C++. It would be rather an understatement to say that the C++ API is difficult to use or get it right so there are no glitches. On the other hand, it would be really nice to be able to implement dashboard-like effects while not compromise on code simplicity and maintainability, especially given the rise of popularity of overview effects a few years ago, which indicated that there is demand for such effects.

In order solve that problem, we started looking for some options and the most obvious one was QtQuick. It’s a quite powerful framework and it’s already used extensively in Plasma. So, in Plasma 5.24, we introduced basic support for implementing kwin effects written in QML and even added a new overview effect. Unfortunately, if you wanted to implement a QtQuick-based effect yourself, you would still have to write a bit of C++ glue yourself. This is not great because effects that use C++ are a distribution nightmare. They can’t be just uploaded to the KDE Store and then installed by clicking “Get New Effects…”. Furthermore, libkwin is a fast moving target with lots of ABI and API incompatible changes in every release. That’s not good if you’re an effect developer because it means you will need to invest a bit of time after every plasma release to port the effects to the new APIs or at least rebuild the effects to resolve ABI incompatibilities.

This has been changed in Plasma 6.0.

In Plasma 6, we’ve had the opportunity to address that pesky problem of requiring some C++ code and also improve the declarative effect API after learning some lessons while working on the overview and other effects. So, enough of history and let’s jump to the good stuff, shall we?

Project Structure

Declarative effects require some particular project structure that we need to learn first before writing any code

└── package
├── contents
│   └── ui
│   └── main.qml
└── metadata.json

The package directory is a toplevel directory, it should contain two things: a metadata.json file and a contents directory. The metadata.json file contains information about the name of the effect, what API it uses, the author, etc.

{
"KPackageStructure": "KWin/Effect",
"KPlugin": {
"Authors": [
{
"Email": "user@example.com",
"Name": "Name"
}
],
"Category": "Appearance",
"Description": "Yo",
"EnabledByDefault": false,
"Id": "hello-world",
"License": "MIT",
"Name": "Hello World"
},
"X-KDE-Ordering": 60,
"X-Plasma-API": "declarativescript"
}

The contents directory contains the rest of QML code, config files, assets, etc. Keep in mind that ui/main.qml is a “magical” file, it acts as an entry point, every effect must have it.

In order to install the effect and make it visible in Desktop Effects settings, you will need to run the following command

kpackagetool6 --type KWin/Effect --install package/

This is quite a lot to memorize. That’s why kwin provides an example qtquick effect that you can grab, tweak some metadata and you’re good to go. You can find the example project at https://invent.kde.org/plasma/kwin/-/tree/master/examples/quick-effect?ref_type=heads. Note that the example project also contains a CMakeLists.txt file, which provides an alternative way to install the effect by the means of cmake, i.e. make install or cmake --install builddir.

Hello World

Let’s start with an effect that simply shows a hello world message on the screen:

import QtQuick
import org.kde.kwin

SceneEffect {
id: effect

delegate: Rectangle {
color: "blue"

Text {
anchors.centerIn: parent
color: "white"
text: "Hello world!"
}
}

ScreenEdgeHandler {
enabled: true
edge: ScreenEdgeHandler.TopEdge
onActivated: effect.visible = !effect.visible
}

ShortcutHandler {
name: "Toggle Hello World Effect"
text: "Toggle Hello World Effect"
sequence: "Meta+H"
onActivated: effect.visible = !effect.visible
}

PinchGestureHandler {
direction: PinchGestureHandler.Direction.Contracting
fingerCount: 3
onActivated: effect.visible = !effect.visible
}
}

import QtQuick is needed to use basic QtQuick components such as Rectangle. import org.kde.kwin imports kwin specific components.

The SceneEffect is a special type that every declarative effect must use. Its delegate property specifies the content for every screen. In this case, it’s a blue rectangle with a “Hello World!” label in the center.

The ShortcutHandler is a helper that’s used to register global shortcuts. ShortcutHandler.name is the key of the global shortcut, it’s going to be used to store the shortcut in the config and other similar purposes. ShortcutHandler.text is a human readable description of the global shortcut, it’s going to be visible in the Shortcuts settings.

The ScreenEdgeHandler allows to reserve a screen edge. When the pointer hits that screen edge, some code can be executed by listening to the activated signal.

The PinchGestureHandler and SwipeGestureHandler allow to execute some code when the user makes a pinch or a swipe gesture, respectively.

effect.visible = !effect.visible toggles the visibility of the effect. When effect.visible is true, the effect is active and visible on the screen; otherwise it’s hidden. You need to set effect.visible to true in order to show the effect.

If you press Meta+H or make a pinch gesture or move the pointer to the top screen edge, you’re going to see something like this

Note that there are no windows visible anymore, it is the responsibility of the effect to decide what should be displayed on the screen now.

Displaying Windows

Being able to display text is great, but it’s not useful. Usually, effects need to display some windows, so let’s display the active window

delegate: Rectangle {
color: "blue"

WindowThumbnail {
anchors.centerIn: parent
client: Workspace.activeWindow
}
}

The change is quite simple. Instead of displaying a Text component, there’s a WindowThumbnail component now. The WindowThumbnail type is provided by the org.kde.kwin module. WindowThumbnail.client indicates what window the thumbnail item should display.

Input

Input processing contains no kwin specific APIs. TapHandler, MouseArea, Keys and other stuff available in QtQuick should just work. For example, let’s implement an effect that arranges windows in a grid and if somebody middle clicks a window, it will be closed

delegate: Rectangle {
color: "pink"

GridView {
id: grid
anchors.fill: parent
cellWidth: 300
cellHeight: 300

model: WindowModel {}
delegate: WindowThumbnail {
client: model.window
width: grid.cellWidth
height: grid.cellHeight

TapHandler {
acceptedButtons: Qt.MiddleButton
onTapped: client.closeWindow()
}
}
}
}

The code looks pretty straightforward except maybe the model of the GridView. WindowModel is a helper provided by org.kde.kwin module that lists all the windows. It can be passed to various views, Repeater, and so on.

The result can be seen here

Delegates are Per Screen

One thing to keep in mind is that the delegates are instantiated per screen. For example,

delegate: Rectangle {
color: "yellow"

Text {
anchors.centerIn: parent
color: "black"
text: SceneView.screen.name
}
}

When you activate the effect on a setup with several outputs, each output will be filled with yellow color and the output name in the center

Usually, the output is irrelevant, but if you need to know what output particular delegate is displayed on, you could use the SceneView.screen attached property.

Configuration

As your effect grows, you will probably face the need to provide an option or two. Let’s say that we want the background color in our hello world effect to be configurable. How do we achieve that? The first step, is to add a main.xml file in package/contents/config directory, i.e.

package/
├── contents
│   ├── config
│   │   └── main.xml
│   └── ui
│   └── main.qml
└── metadata.json

The main.xml file lists all options

<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="">
<entry name="BackgroundColor" type="Color">
<default>#ff00ff</default>
</entry>
</group>
</kcfg>

In our case, only one option is needed: BackgroundColor, which has Color type and #ff00ff default value. You can refer to the KConfigXT documentation to learn more what other entry types are supported.

The next step is to actually use the BackgroundColor option

delegate: Rectangle {
color: effect.configuration.BackgroundColor

Text {
anchors.centerIn: parent
color: "white"
text: "Hello world!"
}
}

effect.configuration is a map object that contains all the options listed in the main.xml.

Now, if you toggle the hello world effect, you’re going to see

There are a few more thing left to do though. If you navigate to Desktop Effects settings, you’re not going a configure button next to the hello world effect

Besides providing a main.xml file, the effect also needs to provide a config.ui file containing a configuration ui

package/
├── contents
│   ├── config
│   │   └── main.xml
│   └── ui
│   ├── config.ui
│   └── main.qml
└── metadata.json

The config.ui file is a regular Qt Designer UI file. The only special thing about it is that the controls that represent options should have special name format: kcfg_ + OptionName. For example, kcfg_BackgroundColor

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QuickEffectConfig</class>
<widget class="QWidget" name="QuickEffectConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>177</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Background color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KColorButton" name="kcfg_BackgroundColor">
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

The last final piece in order to expose the configuration ui is to add the following line in the metadata.json file

"X-KDE-ConfigModule": "kcm_kwin4_genericscripted"

With all of that, the effect is finally displayed as configurable in the system settings and the background color can be changed

Sharing Your Effect With Other People

The preferred method to distribute third party extensions is via the KDE Store. Both JS and QML effects can be uploaded to the same “KWin Effects” category.

Documentation and Other Useful Resources

Documentation is still something that needs a lot of work (and writing it is no fun ). KWin scripting API documentation can be found here https://develop.kde.org/docs/plasma/kwin/api/.

Besides the link above, it’s worth having a look at the examples https://invent.kde.org/plasma/kwin/-/tree/master/examples?ref_type=heads in kwin git repository.

Window Heap

If you need to pack or arrange windows like how the overview effect does, you could use the WindowHeap component from org.kde.kwin.private.effects module. BUT you need to keep in mind that that helper is private and has no stable API yet, so use it on your own risk (or copy paste the relevant code in kwin). Eventually, the WindowHeap will be stabilized once we are confident about its API.

The WindowHeap source code can be found at https://invent.kde.org/plasma/kwin/-/tree/2a13a330404c8d8a95f6264512aa06b0a560f55b/src/plugins/private.

More Examples

If you need more examples, I suggest to have a look at the desktop cube effect in kdeplasma-addons. It’s implemented using the same QML effect API in kwin + QtQuick3D. The source code can be found at https://invent.kde.org/plasma/kdeplasma-addons/-/tree/master/kwin/effects/cube?ref_type=heads

Conclusion

I hope that some people find this quick introduction to QML-based effects in KWin useful. Despite being a couple years old, declarative effects can be still considered being in the infancy stage and there’s a lot of untapped potential in them yet. The QML effect API is not perfect, and that’s why we are interested in feedback from third party extension developers. If you have some questions or feedback, feel free to reach out us at https://webchat.kde.org/#/room/#kwin:kde.org. Happy hacking!

Categories: FLOSS Project Planets

ListenData: 15 Free Open Source ChatGPT Alternatives (with Code)

Planet Python - Sun, 2024-03-17 20:50

In this article we will explain how Open Source ChatGPT alternatives work and how you can use them to build your own ChatGPT clone for free. By the end of this article you will have a good understanding of these models and will be able to compare and use them.

Benefits of Open Source ChatGPT Alternatives

There are various benefits of using open source large language models which are alternatives to ChatGPT. Some of them are listed below.

  1. Data Privacy: Many companies want to have control over data. It is important for them as they don't want any third-party to have access to their data.
  2. Customization: It allows developers to train large language models with their own data and some filtering on some topics if they want to apply
  3. Affordability: Open source GPT models let you to train sophisticated large language models without worrying about expensive hardware.
  4. Democratizing AI: It opens room for further research which can be used for solving real-world problems.
Table of Contents Llama Introduction : Llama

Llama stands for Large Language Model Meta AI. It includes a range of model sizes from 7 billion to 65 billion parameters. Meta AI researchers focused on scaling the model's performance by increasing the volume of training data, rather than the number of parameters. They claimed the 13 billion parameter model outperformed 175 billion parameters of GPT-3 model. It uses the transformer architecture and was trained on 1.4 trillion tokens extracted by web scraping Wikipedia, GitHub, Stack Exchange, Books from Project Gutenberg, scientific papers on ArXiv.

Python Code : Llama # Install Package pip install llama-cpp-python from llama_cpp import Llama llm = Llama(model_path="./models/7B/ggml-model.bin") output = llm("Q: Name the planets in the solar system? A: ", max_tokens=128, stop=["Q:", "\n"], echo=True) print(output) In the model path, you need to have weights for Llama in GGML format and then store them into the models folder. You can search it on Hugging Face website. See one of them here Llama 2 What's New in Llama 2

Here are some of the key differences between Llama 2 and Llama:

  • Training data: Llama 2 is trained on 40% more tokens than Llama, a total of 2 trillion tokens. This gives it a larger knowledge base and allows it to generate more accurate responses.
  • Model size: Llama 2 is available in three sizes: 7 billion parameters, 13 billion parameters, and 70 billion parameters. Whereas, the maximum size of Llama is 65 billion parameters.
  • Chat optimization: Llama 2-Chat is a specialized version of Llama 2 that is optimized for engaging in two-way conversations. It has been trained on a dataset of human conversations, which allows it to generate more natural and engaging responses.
  • Safety and bias mitigation: Llama 2 has been trained with a focus on safety and bias mitigation. This means that it is less likely to generate toxic or harmful content.
  • Open source: Llama 2 is open source, which means that anyone can use it for research or commercial purposes. Whereas, Llama can't be used for commercial purposes.
Python Code : Llama 2 Llam2: 7 Billion Parameters

To run Llama2 7B model, refer the code below. The following code uses a 4-bit quantization technique that reduces the size of the LLM, which can make it easier to deploy and use on sytems with limited memory.

  Colab: Llama2 7B Model %cd /content !apt-get -y install -qq aria2 !git clone -b v1.3 https://github.com/camenduru/text-generation-webui %cd /content/text-generation-webui !pip install -r requirements.txt !pip install -U gradio==3.28.3 !mkdir /content/text-generation-webui/repositories %cd /content/text-generation-webui/repositories !git clone -b v1.2 https://github.com/camenduru/GPTQ-for-LLaMa.git %cd GPTQ-for-LLaMa !python setup_cuda.py install !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/config.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/generation_config.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o generation_config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/special_tokens_map.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o special_tokens_map.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/resolve/main/tokenizer.model -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o tokenizer.model !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/tokenizer_config.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o tokenizer_config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/resolve/main/gptq_model-4bit-128g.safetensors -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o gptq_model-4bit-128g.safetensors %cd /content/text-generation-webui !python server.py --share --chat --wbits 4 --groupsize 128 --model_type llama Llam2: 13 Billion Parameters

To run Llama2 13B model, refer the code below.

  Colab: Llama2 13B Model %cd /content !apt-get -y install -qq aria2 !git clone -b v1.8 https://github.com/camenduru/text-generation-webui %cd /content/text-generation-webui !pip install -r requirements.txt !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/model-00001-of-00003.safetensors -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model-00001-of-00003.safetensors !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/model-00002-of-00003.safetensors -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model-00002-of-00003.safetensors !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/model-00003-of-00003.safetensors -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model-00003-of-00003.safetensors !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/model.safetensors.index.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model.safetensors.index.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/special_tokens_map.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o special_tokens_map.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/tokenizer.model -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o tokenizer.model !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/tokenizer_config.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o tokenizer_config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/config.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/generation_config.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o generation_config.json %cd /content/text-generation-webui !python server.py --share --chat --load-in-8bit --model /content/text-generation-webui/models/Llama-2-13b-chat-hf Alpaca Introduction : Alpaca

A team of researchers from Stanford University developed an open-source language model called Alpaca. It is based on Meta's large-scale language model Llama. The team used OpenAI's GPT API (text-davinci-003) to fine tune the Llama 7 billion (7B) parameters sized model. The goal of the team is to make AI available for everyone for free so that academicians can do further research without worrying about expensive hardwares to execute these memory-intensive algorithms. Although these open source models are not available for commercial use, small businesses can still utilize it for building their own chatbots.

How does Alpaca work

The Stanford team began their research with the smallest language model among Llama models, which was the Llama 7B model, and pre-trained it with 1 trillion tokens. They started with the 175 human-written instruction-output pairs from the self-instruct seed set. They then used OpenAI API to ask ChatGPT to generate more instructions using the seed set. It is to obtain roughly 52,000 sample conversations, which the team used to further fine-tune the Llama models using Hugging Face's training framework.

To read this article in full, please click hereThis post appeared first on ListenData
Categories: FLOSS Project Planets

Brett Cannon: State of WASI support for CPython: March 2024

Planet Python - Sun, 2024-03-17 18:43

The biggest update since June 2023 is WASI is now a tier 2 platform for CPython! This means that the main branch of CPython should never be broken more than 24 hours for WASI and that a release will be blocked if WASI support is broken. This only applies to Python 3.13 and later, although I have been trying to keep Python 3.11 and 3.12 working with WASI as well.

To help make this support easier, the devguide has build instructions for WASI. There is also now a WASI step in CI to help make things easier for core developers.

Starting in wasmtime 14, a new command line interface was introduced. All the relevant bits of code that call wasmtime have been updated to use the new CLI in Python 3.11, 3.12, and 3.13/main.

Lastly, 3.13/main and 3.12 now support WASI SDK 21 – which is the official name of the project – and 3.11 is one bug fix away in the test suite from also having support.

At this point I think CPython has caught up to what&aposs available in WASI 0.2 and wasi-libc via WASI SDK. The open issues are mostly feature requests or checking if assumptions related to what&aposs supported still hold.

I&aposm on parental leave at this point, so future WASI work from me is on hold until I return to work in June. Another side effect of me becoming a parent soon is I stepped down as the sponsor of Emscripten support in CPython. That means CPython 3.13 does not officially support Emscripten and probably starting in 3.14, I will be removing any code that complicates supporting WASI. The Pyodide project already knows about this and they don&apost expect it to be a major hindrance for them since they are already used to patching CPython source code.

Categories: FLOSS Project Planets

Kile 2.9.95 / 3.0 beta 4 released

Planet KDE - Sun, 2024-03-17 16:25

We have a release of Kile 2.9.95, also known as 3.0 beta 4! Earlier today, Michel Ludwig tagged the current Git master. This is the first beta release since October 2019. Beside the port to KDE Frameworks 6 and Qt 6, it provides a couple of new features and bug fixes.

New features
  • Port to KDE Frameworks 6 & Qt 6 (Port by Carl Schwan)
  • Enable high-dpi support
  • Provide option to hide menu bar (Patch by Daniel Fichtner, #372295)
  • Configurable global default setting for the LivePreview engines (Patch by Florian Zumkeller-Quast, #450332)
  • Remove offline copy of "LaTeX2e: An unofficial reference manual", use online version instead (Patch by myself, Christoph Grüninger, Issue #7)
Fixed bugs
  • Kile crashes on selecting "Browse" or "Zoom" for document preview (Patch by Carl Schwan, #465547, #476207, #467435, #452618, #429452)
  • Kile crashes when generating new document (Patch by Carl Schwan, #436837)
  • Ensure \end{env} is inserted in the right place even when the user uses tabs for indentation (Patch by Kishore Gopalakrishnan, #322654)
  • Avoid saving console commands in bash history (Patch by Alessio Bonfiglio, #391537, #453935)
  • Don't crash when deleting templates (#413506)
  • Avoid crashing when closing a document that is being parsed (#404164)

Thanks to all the contributors. They fixed bugs, wrote documentation, modernized the code, and in general took care of Kile.

Enjoy the latest Kile release!

Categories: FLOSS Project Planets

Pages