Feeds

Python GUIs: Q&A: How Do I Display Images in PyQt6? — Using QLabel to easily add images to your applications

Planet Python - Wed, 2024-02-14 01:00

Adding images to your application is a common requirement, whether you're building an image/photo viewer, or just want to add some decoration to your GUI. Unfortunately, because of how this is done in Qt, it can be a little bit tricky to work out at first.

In this short tutorial, we will look at how you can insert an external image into your PyQt6 application layout, using both code and Qt Designer.

Table of Contents Which widget to use?

Since you're wanting to insert an image you might be expecting to use a widget named QImage or similar, but that would make a bit too much sense! QImage is actually Qt's image object type, which is used to store the actual image data for use within your application. The widget you use to display an image is QLabel.

The primary use of QLabel is of course to add labels to a UI, but it also has the ability to display an image — or pixmap — instead, covering the entire area of the widget. Below we'll look at how to use QLabel to display a widget in your applications.

Using Qt Designer

First, create a MainWindow object in Qt Designer and add a "Label" to it. You can find Label at in Display Widgets in the bottom of the left hand panel. Drag this onto the QMainWindow to add it.

MainWindow with a single QLabel added

Next, with the Label selected, look in the right hand QLabel properties panel for the pixmap property (scroll down to the blue region). From the property editor dropdown select "Choose File…" and select an image file to insert.

As you can see, the image is inserted, but the image is kept at its original size, cropped to the boundaries of theQLabel box. You need to resize the QLabel to be able to see the entire image.

In the same controls panel, click to enable scaledContents.

When scaledContents is enabled the image is resized to the fit the bounding box of the QLabel widget. This shows the entire image at all times, although it does not respect the aspect ratio of the image if you resize the widget.

You can now save your UI to file (e.g. as mainwindow.ui).

To view the resulting UI, we can use the standard application template below. This loads the .ui file we've created (mainwindow.ui) creates the window and starts up the application.

PyQt6 import sys from PyQt6 import QtWidgets, uic app = QtWidgets.QApplication(sys.argv) window = uic.loadUi("mainwindow.ui") window.show() app.exec()

Running the above code will create a window, with the image displayed in the middle.

QtDesigner application showing a Cat

Using Code

Instead of using Qt Designer, you might also want to show an image in your application through code. As before we use a QLabel widget and add a pixmap image to it. This is done using the QLabel method .setPixmap(). The full code is shown below.

python import sys from PyQt6.QtGui import QPixmap from PyQt6.QtWidgets import QMainWindow, QApplication, QLabel class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.title = "Image Viewer" self.setWindowTitle(self.title) label = QLabel(self) pixmap = QPixmap('cat.jpg') label.setPixmap(pixmap) self.setCentralWidget(label) self.resize(pixmap.width(), pixmap.height()) app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec()) python import sys from PySide6.QtGui import QPixmap from PySide6.QtWidgets import QMainWindow, QApplication, QLabel class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.title = "Image Viewer" self.setWindowTitle(self.title) label = QLabel(self) pixmap = QPixmap('cat.jpg') label.setPixmap(pixmap) self.setCentralWidget(label) self.resize(pixmap.width(), pixmap.height()) app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec()) python import sys from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.title = "Image Viewer" self.setWindowTitle(self.title) label = QLabel(self) pixmap = QPixmap('cat.jpg') label.setPixmap(pixmap) self.setCentralWidget(label) self.resize(pixmap.width(), pixmap.height()) app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_()) python import sys from PySide2.QtGui import QPixmap from PySide2.QtWidgets import QMainWindow, QApplication, QLabel class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.title = "Image Viewer" self.setWindowTitle(self.title) label = QLabel(self) pixmap = QPixmap('cat.jpg') label.setPixmap(pixmap) self.setCentralWidget(label) self.resize(pixmap.width(), pixmap.height()) app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_())

The block of code below shows the process of creating the QLabel, creating a QPixmap object from our file cat.jpg (passed as a file path), setting this QPixmap onto the QLabel with .setPixmap() and then finally resizing the window to fit the image.

python label = QLabel(self) pixmap = QPixmap('cat.jpg') label.setPixmap(pixmap) self.setCentralWidget(label) self.resize(pixmap.width(), pixmap.height())

Launching this code will show a window with the cat photo displayed and the window sized to the size of the image.

QMainWindow with Cat image displayed

Just as in Qt designer, you can call .setScaledContents(True) on your QLabel image to enable scaled mode, which resizes the image to fit the available space.

python label = QLabel(self) pixmap = QPixmap('cat.jpg') label.setPixmap(pixmap) label.setScaledContents(True) self.setCentralWidget(label) self.resize(pixmap.width(), pixmap.height())

Notice that you set the scaled state on the QLabel widget and not the image pixmap itself.

Conclusion

In this quick tutorial we've covered how to insert images into your Qt UIs using QLabel both from Qt Designer and directly from PyQt5/PySide2 code.

Categories: FLOSS Project Planets

Cameron Eagans: Update on dependency patch resolution

Planet Drupal - Tue, 2024-02-13 23:26
I've found a new path forward with dependency patch resolution. A new beta release of Composer Patches is available with the functionality re-added.
Categories: FLOSS Project Planets

The Drop Times: Contribution Health Dashboards: A Conversation with Alex Moreno

Planet Drupal - Tue, 2024-02-13 22:39
Gain an in-depth understanding of the newly developed Contribution Health Dashboards as Alex Moreno,
The program Manager and Drupal Innovation Coordinator at the Drupal Association discuss CHD development, technological underpinnings, and potential impact on the global diversity of the Drupal community. Discover the challenges faced, future steps, and how the Drupal community can contribute to the dashboards' enhancement.
Categories: FLOSS Project Planets

Peter Bengtsson: How to avoid a count query in Django if you can

Planet Python - Tue, 2024-02-13 22:09

Suppose you have a complex Django QuerySet query that is somewhat costly (in other words slow). And suppose you want to return:

  1. The first N results
  2. A count of the total possible results

So your implementation might be something like this:

def get_results(queryset, fields, size): count = queryset.count() results = [] for record in queryset.values(*fields)[:size] results.append(record) return {"count": count, "results": results}

That'll work. If there are 1,234 rows in your database table that match those specific filters, what you might get back from this is:

>>> results = get_results(my_queryset, ("name", "age"), 5) >>> results["count"] 1234 >>> len(results["results"]) 5

Or, if the filters would only match 3 rows in your database table:

>>> results = get_results(my_queryset, ("name", "age"), 5) >>> results["count"] 3 >>> len(results["results"]) 3

Between your Python application and your database you'll see:

query 1: SELECT COUNT(*) FROM my_database WHERE ... query 2: SELECT name, age FROM my_database WHERE ... LIMIT 5

The problem with this is that, in the latter case, you had to send two database queries when all you needed was one.
If you knew it would only match a tiny amount of records, you could do this:

def get_results(queryset, fields, size): - count = queryset.count() results = [] for record in queryset.values(*fields)[:size]: results.append(record) + count = len(results) return {"count": count, "results": results}

But that is wrong. The count would max out at whatever the size is.

The solution is to try to avoid the potentially unnecessary .count() query.

def get_results(queryset, fields, size): count = 0 results = [] for i, record in enumerate(queryset.values(*fields)[: size + 1]): if i == size: # Alas, there are more records than the pagination count = queryset.count() break found = i + 1 results.append(record) return {"count": count, "results": results}

This way, you only incur one database query when there wasn't that much to find, but if there was more than what the pagination called for, you have to incur that extra database query.

Categories: FLOSS Project Planets

Seth Michael Larson: Challenges while building SBOM infrastructure for CPython

Planet Python - Tue, 2024-02-13 19:00
Challenges while building SBOM infrastructure for CPython AboutBlogNewsletterLinks Challenges while building SBOM infrastructure for CPython

Published 2024-02-14 by Seth Larson
Reading time: minutes

This critical role would not be possible without funding from the OpenSSF Alpha-Omega project. Massive thank-you to Alpha-Omega for investing in the security of the Python ecosystem!

In case you missed it, recently I announced support for Software Bill-of-Materials for the CPython project on the Python Software Foundation blog.

Part of the project is intended to document the challenges that the project faced to start publishing first-party SBOM documents alongside release artifacts. Yesterday I gave a presentation to the OpenSSF SBOM Everywhere SIG, the slides are available in Google Drive, but I'll be summarizing the discussion here:

List of challenges so far for CPython SBOMs

Building for sustainability. There are no guarantees that my role will be around forever. There's a non-zero chance that CPython core developers will need to maintain SBOM infrastructure at some point in the future. This means it needs to have buy-in, be as low-effort to maintain as possible, fit into existing workflows, and be well documented.

This challenge sparked a bunch of conversation in the group about getting buy-in from technical leadership of open source projects. My thoughts being the following:

  • There isn't a one-size-fits-all approach for projects. Every proposal needs to be fit for that project.
  • Having engagements be driven by community members. There's already a relationship of trust that the work will be done right by the community and that the individual won't leave as soon as the project is complete. I applaud Alpha-Omega's approach here of supporting communities to do security work for the ecosystems they care about.
  • Being public and honest about all aspects of the work, especially the not-so-fun truths (like additional maintenance, complexity, etc). I created a public discussion of the SBOM project for CPython and enumerate its impact specifically on developers updating dependencies and how having accurate SBOMs may increase the amount of reports from users we get to patch dependencies.
  • Show value for the maintainers of the project. SBOM itself may not have tons of value specifically for maintainers, but as an avenue for scanners to discover VEX statements and thus reduce the amount of reports we receive to pointlessly patch dependencies is a valuable capability.

Recursive dependency bundling: CPython bundles pip in the ensurepip module. pip bundles 18 dependencies. There are even more projects bundled in older CPython versions which was the primary reason I stopped backporting beyond 3.12. This requires a customized tool to handle the job. pip and its dependencies being a part of the Python package ecosystem helps a lot, this means we can automatically do lookups for metadata on PyPI, drastically reducing maintainer effort to keep the SBOM updated.

Software IDs and metadata of C projects: Many of CPython dependencies are C projects (libexpat, mpdecimal, HACL*, etc) and those projects aren't a part of a packaging ecosystem, they're tarballs you download and install by pasting into a directory. This means there aren't any standards for what a version number or name should be. The unfortunate part of this is it means the SBOM has to be updated manually when these projects are updated by core developers.

CPEs also don't exist universally for the projects, CPEs being the primary software vulnerability identifier used for C projects. OSV and PURL don't work for projects outside of packaging ecosystems.

Other items

That's all for this week! 👋 If you're interested in more you can read last week's report.

Thanks for reading! ♡ Did you find this article helpful and want more content like it? Get notified of new posts by subscribing to the RSS feed or the email newsletter.

This work is licensed under CC BY-SA 4.0

Categories: FLOSS Project Planets

Steinar H. Gunderson: Random Postgres wishlist

Planet Debian - Tue, 2024-02-13 17:16

In no particular order, things it would be neat if Postgres had (some of these I've implemented myself earlier, though not in Postgres):

  • A JIT that is not based on LLVM (using an AOT compiler framework for JIT is just not a salvagable choice; witness the absolute dearth of really successful LLVM-based JITs out there).
  • Interesting orders that understand functional dependencies.
  • Cross-join correlation statistics.
  • Better combination of multi-column statistics (the standard way in academia seems to be maximum entropy).
  • Longer-term, some built-in really solid column store or at least multi-row handling, for larger OLAP jobs.
  • Ability to hold an in-memory sample, also for OLAP stuff.
  • Ditching GEQO for something more modern (there are tons of choices depending on how you want the optimizer to evolve, pick your poison).

I'm sure everyone would want something like multimaster clustering, but I honestly don't care for myself. :-) I only have one server anyway.

Categories: FLOSS Project Planets

PreviousNext: The Future of Symfony Messenger in Drupal

Planet Drupal - Tue, 2024-02-13 15:05

The thrilling conclusion to this eight-part miniseries includes the next steps for the SM project and the Symfony Messenger ecosystem.

by daniel.phin / 14 February 2024

Symfony Messenger and the SM integration permits time savings and improved DX for developers, making the pipeline and workers more flexible.

Real business value is added when messages can be processed in real-time, providing potential infrastructure efficiencies by permitting rescaling resources from web to CLI. End user performance is improved by offloading processing out of web threads.

Further integrations provide feedback to end users such as editors, informing them in real-time when relevant tasks have been processed.

Messenger messages are an opportunity to offload expensive business logic, particularly those which would be found in hooks. Instead of using the batch API, consider creating messages and deferring UI feedback to Toasty rather than blocking a user’s browser.

Given these points, integration with Drupal core could prove quite valuable.

The design of the SM project focuses on core integration from the beginning. The highest priority has been to maintain the original Symfony Messenger services and configuration, while minimising the introduction of new concepts.

In the context of core integration, niceties like SM’s queue interception feature may initially be left on the factory floor, but could prove useful when deprecating @QueueWorker plugins.

Concepts like the consume command may be a tricky requirement for some, but there are always workarounds that can be built, in the same vein as request-termination cron. Workarounds wouldn’t allow for the main advantage of Messenger, which is its real-time processing capabilities.

Next steps for the SM project and the Messenger ecosystem include

Read the other posts in this series:

  1. Introducing Symfony Messenger integrations with Drupal 
  2. Symfony Messenger’ message and message handlers, and comparison with @QueueWorker
  3. Real-time: Symfony Messenger’ Consume command and prioritised messages
  4. Automatic message scheduling and replacing hook_cron
  5. Adding real-time processing to QueueWorker plugins
  6. Handling emails asynchronously: integrating Symfony Mailer and Messenger
  7. Displaying notifications when Symfony Messenger messages are processed
  8. Future of Symfony Messenger in Drupal
Tagged Symfony, Symfony Messenger
Categories: FLOSS Project Planets

PyCoder’s Weekly: Issue #616 (Feb. 13, 2024)

Planet Python - Tue, 2024-02-13 14:30

#616 – FEBRUARY 13, 2024
View in Browser »

Using Python for Data Analysis

In this tutorial, you’ll learn the importance of having a structured data analysis workflow, and you’ll get the opportunity to practice using Python for data analysis while following a common workflow process.
REAL PYTHON

Python Formatters With Lukasz Langa

Episode 27 of The Python Show Podcast welcomes Lukasz Langa, the CPython Developer in Residence, he is also the creator of the Black formatter. They talk about Python, Black, Ruff, and more.
MIKE DRISCOLL podcast

Upcoming Workshop: Taming the Kraken, Managing a Python Monolith w/ Sentry

Join David Winterbottom, principal software engineer at Kraken Technologies, as he shares how he and his team develop, deploy, and maintain a rapidly evolving Python monorepo with over 4 million lines of code with Sentry. RSVP to get a recording and get your questions answered during the session →
SENTRY sponsor

A Bird’s Eye View of Polars

This post on the Polars blog introduces you to how Polars works, showing the steps from queries, plans, optimizations, and then the final execution.
POLARS

Django Security Releases Issued: 5.0.2, 4.2.10, and 3.2.24

DJANGO SOFTWARE FOUNDATION

Python 3.12.2 and 3.11.8 Released

CPYTHON DEV BLOG

PSF: Introducing PSF Grants Program Office Hours

PYTHON SOFTWARE FOUNDATION

Discussions Why Not Real Anonymous Functions?

PYTHON

When Should You Give Up on a Project That Doesn’t Work?

HACKER NEWS

Articles & Tutorials Abandoned Code: Hidden Risks of Unmaintained Software

Software engineers use a lot of third party software. Often people rely on GitHub stars, downloads or articles to choose what to use. Yet, a lot of times that third party software is not maintained anymore. This post talks about some of the problems with using that kind of software.
PORIN CUSTIC • Shared by Porin Custic

Build a Django AI Colorization App

This guide shows you how to build a simple Django app that uses AI to colorize black and white photos. It includes a way to hook your local server when working with APIs that need a network exposed call-back.
PHOTONDESIGNER.COM • Shared by Tom Dekan

Add Versatility To AI Apps, Build With Popular Model Choices Like YOLOv8

Future-proof your AI apps with constantly expanding model compatibility, including YOLOv8, Padim, and more. Speed up development and deploy seamlessly with Intel’s OpenVINO toolkit.
INTEL CORPORATION sponsor

Specialized Python Libraries for Unique Tasks

Python gets used for all sorts of stuff. This list of libraries highlights just how much is out there. Ranging from quick UI tools to text search, to movie editing.
MARINE GOSSELIN

Implement Parsers With Pylasu

In this article, you learn how to implement parsers in Python using Pylasu and ANTLR. It includes working code for parsing a toy language called “slang”.
LORENZO ADDAZI

Inside .git

Julia is at it again, doing a deep dive on how things work. This post shows you everything inside your .git directory and what its all there for.
JULIA EVANS

Safely Rewriting Complex Code

Sometimes you just have to give in and re-write some of your code. This post talks about useful steps to consider when going down this path.
TIMO ZIMMERMANN

Everything You Can Do With Python’s textwrap Module

Learn about all the things you can do with Python’s textwrap module, including formatting, text wrapping, trimming and more
MARTIN HEINZ • Shared by Martin Heinz

Understanding Open Source Licensing

This article discusses the importance of open-source licensing in software development and its implications for stakeholders.
UMA VICTOR

Implementing a Lasting Service Pattern for Your Business Logic

Best practices for building an understandable, maintainable and scalable mechanism for your custom logic via Python classes.
MEDIUM.COM/AMBIENT-INNOVATION • Shared by Ronny Vedrilla

Profiling Your Numba Code

Learn how to use the Profila profiler to find performance bottlenecks in your Numba code.
ITAMAR TURNER-TRAURING

Projects & Code toolong: A TUI to View, Tail, Merge, and Search Log Files

GITHUB.COM/TEXTUALIZE

finagg: Aggregate Historical Data From Free Financial APIs

GITHUB.COM/THEOGOGNF

fasthx: FastAPI and HTMX, the Right Way

GITHUB.COM/VOLFPETER

instld: CLI Package Management

GITHUB.COM/POMPONCHIK • Shared by Evgeniy Blinov

Adopt-Ruff: Find Unconfigured ruff Rules

GITHUB.COM/SCDOR • Shared by Dor Schwartz

Inspira: A Lightweight Framework for Web Applications

GITHUB.COM/CICEKHAYRI • Shared by Hayri Cicek

Events Weekly Real Python Office Hours Q&A (Virtual)

February 14, 2024
REALPYTHON.COM

PyData Bristol Meetup

February 15, 2024
MEETUP.COM

PyLadies Dublin

February 15, 2024
PYLADIES.COM

Inland Empire Python Users Group Monthly Meeting

February 21, 2024
MEETUP.COM

NZPUG-Auckland: The Python Community in 2024

February 21, 2024
MEETUP.COM

Happy Pythoning!
This was PyCoder’s Weekly Issue #616.
View in Browser »

[ Subscribe to 🐍 PyCoder’s Weekly 💌 – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]

Categories: FLOSS Project Planets

Drupal Association blog: Piyush Poddar Joins the Drupal Association Board: A Journey of Growth, Open Source Advocacy, and Global Collaboration

Planet Drupal - Tue, 2024-02-13 13:53

We're excited to welcome Piyush Poddar, the latest addition to the Drupal Association Board. Piyush, Head of Sales and Partnerships at Axelerant, co-founded the Jaipur Drupal User Group and serves on the Board of the Drupal Association of India. Known for his active involvement in writing and speaking at events, Piyush covers a range of topics, including the growth of Open Source and Contribution culture in India. His expertise extends to assisting global Drupal agencies in business expansion through strategic account management, transformed outsourcing practices, and success-driven partnership frameworks. 

As a recent board member, Piyush shares insights on this thrilling journey:

What are you most excited about when it comes to joining the Drupal Association board?
I’m excited to join the Drupal Association Board after having known Drupal for over 16 years. As a long-time advocate and active non-code contributor, I look forward to influencing key decisions and giving back to the community.

This is a pivotal time for Drupal's growth, and my position on the Board allows me to contribute significantly to its expansion, relevance, and commitment to openness and inclusion.

And I’m very excited that with my position on the Board, I will be able to contribute significantly to some of these motions.

What do you hope to accomplish during your time on the board?
From a humble dorm room project to a platform globally embraced by businesses and organizations, Drupal has come a long way. As a board member, I aim to actively push to advance Drupal's business dimension, ensuring its continued relevance in the dynamic Martech space. The Drupal Association's recent efforts at the Web Summit were good, but we need to do more.

I also want to connect the global and Indian Drupal communities, bringing back the energy that faded during the pandemic. Developers are vital for Drupal, and we need to support and empower them for the community to keep growing. Coming up with plans for this is a top priority.

Personally, I look forward to learning a lot, improving my skills, and having valuable experiences in this role.

What specific skill or perspective do you contribute to the board?
My background in Sales, Customer Success Management, and Community Engagement offers a unique viewpoint. 

Digital agencies, being prominent advocates and practitioners of Drupal, have significantly driven its growth and commercial adoption. With over a decade of experience partnering with digital agencies for their growth, I have consistently interacted with their leadership. I aim to bring their challenges and needs to the forefront. 

How has Drupal impacted your life or career?
Drupal has hugely impacted both my professional journey and personal growth. Professionally, it has been instrumental in molding my understanding of complex business challenges related to content, marketing, and publishing. Working on Drupal projects introduced me to the agile methodology, revolutionizing how I approach work. The global adoption of Drupal has broadened my perspective, allowing me to gain a comprehensive understanding of the digital and creative industries on an international scale.

On a personal level, my experience with Drupal has profoundly transformed my views on openness and inclusion. The thriving Drupal community, rooted in open-source ethos and built on selfless contributions, has been a powerful influence. Engaging with people from diverse backgrounds, cultures, ethnicities, and genders, all united by a common cause, has significantly broadened how I engage with people. This exposure has made me more open-minded, vulnerable, and accommodating, deeply enriching my personal values and perspectives.

In essence, Drupal has not just been a part of my career; it has been a journey of learning, growth, and personal evolution.

Tell us something that the Drupal community might not know about you.
I really enjoy traveling. I've explored over 65 cities in 14 countries and have taken approximately 15 flights around the earth.

Share a favorite quote or piece of advice that has inspired you.
I'd like to share a quote that has inspired me: “Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it.” - Steve Jobs

We can't wait to experience the incredible contributions Piyush will make during his time on the Drupal Association Board. Thank you, Piyush, for dedicating yourself to serving the Drupal community through your board work! Connect with Piyush on LinkedIn.

The Drupal Association Board of Directors comprises 12 members, with nine nominated for staggered 3-year terms, two elected by the Drupal Association members, and one reserved for the Drupal Project Founder, Dries Buyteart. The Board meets twice in person and four times virtually annually, overseeing policy establishment, executive director management, budget approval, financial reports, and participation in fundraising efforts.

Categories: FLOSS Project Planets

Drupal Association blog: Turning Takers into Makers: The enhanced Drupal Certified Partner Program

Planet Drupal - Tue, 2024-02-13 12:00

In a recent working paper published by the Harvard Business School entitled “The Value of Open Source Software,” the authors, Manual Hoffmann, Frank Nagle, and Yanuo Zhou, use a new methodology to determine that the value of open source software is in excess of $8.8 trillion. They further admit that this is likely an underestimate.

Clearly, open source software plays a foundational and often underappreciated role in the digital lives of people across the world. This fact will not be news to those immersed in the open source communities that were the subject of the study (though I think the economic impact is illuminating).

Among the contributions of the Working Paper to open source literature, the authors assert that:

...users of OSS should not just free ride but also contribute to the creation and maintenance of OSS(...). Such contributions are a fraction of the costs that firms would incur if OSS did not exist and the active participation of OSS users in helping maintain the OSS they use is critical to the health and future well-being of the OSS ecosystem”

They further add:

Our results further show that the majority of the value created by OSS is created by a small number of contributors.”

While Drupal was not specifically included in the Harvard study (though PHP was), these conclusions are not news to the Drupal Community. Dries Buytaert introduced these concepts to the Community in his 2019 blog post Balancing Makers and Takers to scale and sustain Open Source. In it, he cites the “free rider” problem long studied in traditional economics and applies it to Drupal. His message in short: if Drupal is to thrive, we need to convert Takers to Makers.

In 2023, Drupal was recognized as a Digital Public Good. The recognition highlighted both Drupal’s importance in advancing an open and inclusive web as well as its susceptibility to the Free Rider problem.

The Role of the Drupal Association

The Drupal Association plays a unique role in the Drupal ecosystem.  As the nonprofit formed to support the global, decentralized open source project, our mission is to drive innovation and adoption of Drupal as a high-impact digital public good, hand-in-hand with our open source community.

Our fundamental task, day in and day out, is to ensure that Drupal is secure and available to anyone, anywhere in the world to download and use for free. This takes resources beyond the contributions to code that the community makes. Thus, we leverage financial contributions to maintain and improve the infrastructure that keeps Drupal available.

We are in an environment in which, without an intentional focus on innovation and a commitment to getting the word out about the benefits of Drupal (i.e. marketing), open source projects risk withering, and organizations with far larger budgets and profit incentives will oversell proprietary solutions that unnecessarily trap users data and raise the cost basis of accessing the internet.  Both are contrary to an open and inclusive web.

Enhancements to the Drupal Certified Partner Program

To fulfill our mission and to better support the availability of Drupal, the Drupal Association is re-orienting the Drupal Certified Partner program to recognize and highlight those firms who represent the “small number of contributors” that “are critical to the health and future well-being” of Drupal. In other words, we’re focusing the Drupal Certified Partner program on “Makers.”

We launched the Drupal Certified Partner program in 2021. It was a good start and we have learned much over the past 3 years. We learned that we have room for improvement to amplify and highlight Makers.

The current Marketplace lists 2,283 companies, many of whom provide Drupal services. Of these companies, 591 made a contribution to Drupal in 2023. Of these 591 contributors, the top 14% made 88% of total contributions in 2023. Some of these are relatively small organizations, who aren't necessarily getting the recognition they deserve. In fact, five of the top ten contributors in 2023 were companies with fewer than 50 employees.

It would be fair to say that, in Drupal, the majority of the value is created by a small number of contributors. We hope to better recognize those organizations and grow their number.

Starting on April 1, 2024, the Drupal Certified Partner program will support those companies who are committed to supporting the Drupal Project and the Drupal Community with the following improvements:

  • The Drupal Marketplace on Drupal.org will be reserved solely for Makers, known as Drupal Certified Partners. The Marketplace will be branded as the global list of “Makers” and recommended by the Drupal Association and will only list Drupal Certified Partners in active status.
  • Becoming and maintaining certification as a Drupal Certified Partner will require at least 150 annual credits and complete a short annual business survey.
  • Companies will be awarded a tier badge (Bronze, Silver, Gold, Platinum, Diamond, Top Tier), based solely on their credits (see below).
  • Position on the Marketplace will be largely determined by credits (this is “largely” and not “solely” because we plan on providing Marketplace advantages to those companies that sponsor local camps).
  • An annual financial contribution will be required of all Drupal Certified Partners based on company size and measured by number of employees and full time contractors (see below). The intent is that this contribution be nominal to the size of the organization. These funds are used to maintain the Drupal infrastructure, a core responsibility of the Drupal Association, as well as supporting the Drupal Community.
  • Many benefits conferred by the Drupal Association will be limited to Drupal Certified Partners. These benefits are being updated and will be published before the end of the first quarter of 2024.
  • The Supporting Partner program will be re-oriented to recognize those companies who are not in the business of selling Drupal services, but want to contribute to the project and the community.
New Tiered Badge Levels

In developing the new tiers, we started with our highest performing contributor and then looked for natural cut points in the data to create subsequent tiers. With these changes, the annual contribution credit minimums for each Tier have increased.

Since 2021, when this program launched, code contribution within organizations has increased. What this tells us is the program is working. Organizations are motivated to increase contribution which, in turn, will increase innovation. It also proves we can incrementally increase the weighted contribution credit eligibility to continue to grow code contributions.

Weighted contributions over the previous twelve months will determine the Tier at an organization’s annual renewal date.

New Financial Sponsorship Levels

Maintaining Drupal and making it available worldwide free of charge to anyone to download and use takes resources beyond contributions by the community.  The nonprofit Drupal Association, in conjunction with the Drupal Project, does the bulk of this work.  Undertaking this work on a continual basis and with great quality requires a consistent source of funding.  The Association’s historic reliance on DrupalCon revenue is insufficient to undertake the goals of innovating Drupal faster and expanding its impact.

Drupal’s market impact is conservatively valued at $3 to $5 billion.  If only 1% of the value was invested back into Drupal, this would result in tens of millions of dollars annually.  This would more than address Drupal’s maintenance, innovation, and marketing needs.

In this vein, the enhanced Drupal Certified Partner program will require an annual financial sponsorship amount.  The amount will vary commensurate with the size of the organization.  The idea is that makers who use Drupal should contribute a nominal financial amount to help the Association maintain Drupal.  It is a cost of doing business, similar to any software tool an organization may use to build and maintain their digital presence.  The amount will generate far less than “tens of millions” of dollars, but will provide a sustainable source of revenue that will be invested in innovating and marketing Drupal.  Many companies already contribute at this level, we want to formalize the commitment for all Drupal Certified Partners.

The number of employees and full-time employees will be used as a proxy for company size.

The new Drupal Certified Partner requirements will go into effect starting 1 April 2024. All companies currently on the marketplace who are not yet Certified are invited to enroll. New organizations joining the Drupal Certified Partner program will enroll in this new program starting 1 April. Current Drupal Certified Partners will be invited to enroll on their annual renewal date after 1 April 2024. Current Drupal Certified Partners will not see a change in their financial contribution requirements until their next renewal date.

If your organization does not contribute code or your organization is an end-user, you will still be able to support Drupal the community. The current “Supporting Partner” program will now be called the “Supporting Member” program. The current financial levels will be available and some of the same benefits will be part of the program, such as 10% off DrupalCon registrations. For some, the Supporting Members program will be a starting point towards becoming a Drupal Certified Partner with the Drupal Association hosting webinars and training on how to get started contributing.

A webinar is planned for March to review the new Drupal Certified Partner program.

If you would like to learn more, please register for our upcoming webinar on 5 March 2024 hosted by myself and Kelly Delaney, our Director of Development.

Register for the webinar here. If you can’t make the live webinar, we’ll send the recording to everyone who registered after the event.

Tim Doyle
Chief Executive Officer
Drupal Association

Categories: FLOSS Project Planets

Drupal Association blog: Bounty program extension (for innovative modules and ideas)

Planet Drupal - Tue, 2024-02-13 11:23

A few weeks ago we announced the Bounty Program. This was a pilot program with the idea to solve a few common problems. For a start, and after meeting with different companies and individuals, it is apparent that we need a clear path and guidance to where contributions would be most helpful. A constant question from pretty much all companies I have met was “how can we make our contributions more impactful”.

Fortunately - there are many areas and projects where contributions are VERY important, and where the Drupal Association, core maintainers and other leaders in the project are waiting for a helping hand.

The goal of this credit bounty program is to explore introducing some of that guidance, increasing contribution in those areas where it really matters and, creating more impact to push Drupal innovation further.

The good news is the idea has been working pretty well. For a start we have got some long-standing, tricky issues unblocked, and with new momentum we already have one of those issues fixed. This is a great initial result for the program, because that issue in particular was 5 years old.

Community feedback has also been positive, from the core maintainer team, to companies and people willing to participate in the program or simply excited to see this happening.

The only drawback I saw with this approach is that the issues that we have published are highly specialized and potentially complex. And that’s ok, because contributing to Core is actually a complex, time consuming task, and here your contributions are going to make a big difference. But at the same time this is limiting how many people have the required knowledge and can contribute to this initiative.

That’s why I’m opening a consultation period. Do you think you have an innovative module or project that can benefit drupal? Do you know of one you would like to nominate as an innovative module that could benefit from some momentum and contributors? Is there a core feature request or idea queue issue that you think could use focused attention?

We especially want your nominations if you are a module maintainer and you are willing to spend a little bit of time to support contributors who could help innovate items on your roadmap. , To provide your nominations, please contact me: alex.moreno@association.drupal.org.

What will you get in exchange? Public promotion for your module, being a candidate for extra credit bounties, but most importantly, seeing how your module gets the attention, promotion and the extra push that it deserves as an innovative idea.

This does not stop here, because we have opened another round of consultations with the Core team as well for their own nominations of new issues that will be included in the next round of the credit bounty program.

We will likely select anywhere between 4 and 12 new issues for the second round, so if you you know an innovative module or project that could benefit from this, please send me your proposals: alex.moreno@association.drupal.org

Categories: FLOSS Project Planets

Nonprofit Drupal posts: February Drupal for Nonprofits Chat

Planet Drupal - Tue, 2024-02-13 11:13

Join us THURSDAY, February 15 at 1pm ET / 10am PT, for our regularly scheduled call to chat about all things Drupal and nonprofits. (Convert to your local time zone.)

This month we'll be giving an update on our plans for DrupalCon Portland, including the Nonprofit Summit and the recently announced discount for nonprofit attendees!

And we'll of course also have time to discuss anything else that's on our minds at the intersection of Drupal and nonprofits -- including our plans for NTC in next month.  Got something specific you want to talk about? Feel free to share ahead of time in our collaborative Google doc: https://nten.org/drupal/notes!

All nonprofit Drupal devs and users, regardless of experience level, are always welcome on this call.

This free call is sponsored by NTEN.org and open to everyone. 

  • Join the call: https://us02web.zoom.us/j/81817469653

    • Meeting ID: 818 1746 9653
      Passcode: 551681

    • One tap mobile:
      +16699006833,,81817469653# US (San Jose)
      +13462487799,,81817469653# US (Houston)

    • Dial by your location:
      +1 669 900 6833 US (San Jose)
      +1 346 248 7799 US (Houston)
      +1 253 215 8782 US (Tacoma)
      +1 929 205 6099 US (New York)
      +1 301 715 8592 US (Washington DC)
      +1 312 626 6799 US (Chicago)

    • Find your local number: https://us02web.zoom.us/u/kpV1o65N

  • Follow along on Google Docs: https://nten.org/drupal/notes

View notes of previous months' calls.

Categories: FLOSS Project Planets

Real Python: Create Conway's Game of Life With Python

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

Wouldn’t it be cool to build a Python game that only requires initial user input and then seems to take on a mind of its own, creating mesmerizing patterns along the way? You can do exactly that with Conway’s Game of Life, which is about the evolution of cells in a life grid.

Implementing the Game of Life algorithm is a good exercise with many interesting challenges that you’ll have to figure out. Specifically, you’ll need to build the life grid and find a way to apply the game’s rules to all the cells on the grid so that they evolve through several generations.

In this video course, you’ll:

  • Implement Conway’s Game of Life algorithm with Python
  • Build a curses view to display the Game of Life grid
  • Create an argparse command-line interface for the game
  • Set up the game app for installation and execution

To get the most out of this video course, you should know the basics of writing object-oriented code in Python, creating command-line interface (CLI) apps with argparse, and setting up a Python project.

[ 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

Programiz: Python Program to Remove Duplicate Element From a List

Planet Python - Tue, 2024-02-13 06:28
In this example, you will learn to remove duplicate elements from a list.
Categories: FLOSS Project Planets

PyCharm: The Release Candidate for PyCharm 2023.3.4 Is Out!

Planet Python - Tue, 2024-02-13 05:33

PyCharm 2023.3.4 Release Candidate is now available!

You can get the latest build here, through the free Toolbox App, or via snaps for Ubuntu.

  • AI Assistant: Generate Python type annotations for a function.
  • AI Assistant: Generate Django views, admin or serializers for a model.
  • AI Assistant: Explain DataFrame action in Jupyter notebooks and Python scripts.
  • Django Structure: Quick navigation to settings.py directly from the tool window.
  • Quick Documentation tool window for Type Parameters and Type Aliases.
  • The bug causing the Unsatisfied package requirements notification is now fixed. [PY-65170]
  • Jupyter Notebook: Dropdown menus now work in ipywidget outputs. [PY-61554]

If you spot any bugs, please report them using our issue tracker. We’re also eager to hear your thoughts on the latest IDE updates, so feel free to connect with us on X (formerly Twitter) or drop a comment under this blog post. 

Categories: FLOSS Project Planets

Arturo Borrero González: Back to the Wikimedia Foundation!

Planet Debian - Tue, 2024-02-13 04:30

In October 2023, I departed from the Wikimedia Foundation, the non-profit organization behind well-known projects like Wikipedia and others, to join Spryker.

However, in January 2024 Spryker conducted a round of layoffs reportedly due to budget and business reasons. I was among those affected, being let go just three months after joining the company.

Fortunately, the Wikimedia Cloud Services team, where I previously worked, was still seeking to backfill my position, so I reached out to them. They graciously welcomed me back as a Senior Site Reliability Engineer, in the same team and position as before.

Although this three-month career “detour” wasn’t the outcome I initially envisioned, I found it to be a valuable experience. During this time, I gained knowledge in a new tech stack, based on AWS, and discovered new engineering methodologies. Additionally, I had the opportunity to meet some wonderful individuals. I believe I have emerged stronger from this experience.

Returning to the Wikimedia Foundation is truly motivating. It feels privileged to be part of this mature organization, its community, and movement, with its inspiring mission and values.

In addition, I’m hoping that this also means I can once again dedicate a bit more attention to my FLOSS activities, such as my duties within the Debian project.

My email address is back online: aborrero@wikimedia.org. You can find me again in the IRC libera.chat server, in the usual wikimedia channels, nick arturo.

Categories: FLOSS Project Planets

Talk Python to Me: #449: Building UIs in Python with FastUI

Planet Python - Tue, 2024-02-13 03:00
Building web UIs in Python has always been in interesting proposition. On one end, we have a the full web design story with artisanal HTML and CSS. On another end there are several Python platforms that aim to the bring RAD, rapid app development, style of building with Python. Those can be great, and I've covered a couple of them, but they usually reach a limit on what they can do or how they integrate with the larger web ecosystem. On this episode, we have Samuel Colvin to share his latest exciting project FastUI. With FastUI, you build responsive web applications using React without writing a single line of JavaScript, or touching npm. Yet designers and other tools can focus on React front-ends for a professional SPA like app experience.<br/> <br/> <strong>Episode sponsors</strong><br/> <br/> <a href='https://talkpython.fm/brightdata'>bright data</a><br> <a href='https://talkpython.fm/sentry'>Sentry Error Monitoring, Code TALKPYTHON</a><br> <a href='https://talkpython.fm/training'>Talk Python Courses</a><br/> <br/> <strong>Links from the show</strong><br/> <br/> <div><b>Samuel on Mastodon</b>: <a href="https://fosstodon.org/@samuelcolvin" target="_blank" rel="noopener">fosstodon.org</a><br/> <b>Samuel on X</b>: <a href="https://twitter.com/samuel_colvin" target="_blank" rel="noopener">x.com</a><br/> <br/> <b>FastUI</b>: <a href="https://github.com/pydantic/FastUI" target="_blank" rel="noopener">github.com</a><br/> <b>FastUI Demos</b>: <a href="https://fastui-demo.onrender.com" target="_blank" rel="noopener">fastui-demo.onrender.com</a><br/> <b>FastAPI</b>: <a href="https://fastapi.tiangolo.com" target="_blank" rel="noopener">fastapi.tiangolo.com</a><br/> <b>Pydantic</b>: <a href="https://pydantic.dev" target="_blank" rel="noopener">pydantic.dev</a><br/> <b>How Did REST Come To Mean The Opposite of REST Article</b>: <a href="https://htmx.org/essays/how-did-rest-come-to-mean-the-opposite-of-rest/" target="_blank" rel="noopener">htmx.org</a><br/> <b>Tailwind UI</b>: <a href="https://tailwindui.com/components/application-ui/lists/grid-lists" target="_blank" rel="noopener">tailwindui.com</a><br/> <b>Dropbase</b>: <a href="https://www.dropbase.io" target="_blank" rel="noopener">dropbase.io</a><br/> <b>Anvil</b>: <a href="https://anvil.works" target="_blank" rel="noopener">anvil.works</a><br/> <b>Flutter code example</b>: <a href="https://github.com/ajay-prabhakar/awesome-flutter-ui/blob/master/book_app_ui/lib/main.dart" target="_blank" rel="noopener">github.com</a><br/> <b>ReactJS code example</b>: <a href="https://github.com/Yog9/SnapShot/blob/master/src/App.js" target="_blank" rel="noopener">github.com</a><br/> <b>Watch this episode on YouTube</b>: <a href="https://www.youtube.com/watch?v=DzyxUVm_1cI" target="_blank" rel="noopener">youtube.com</a><br/> <b>Episode transcripts</b>: <a href="https://talkpython.fm/episodes/transcript/449/building-uis-in-python-with-fastui" target="_blank" rel="noopener">talkpython.fm</a><br/> <br/> <b>--- Stay in touch with us ---</b><br/> <b>Subscribe to us on YouTube</b>: <a href="https://talkpython.fm/youtube" target="_blank" rel="noopener">youtube.com</a><br/> <b>Follow Talk Python on Mastodon</b>: <a href="https://fosstodon.org/web/@talkpython" target="_blank" rel="noopener"><i class="fa-brands fa-mastodon"></i>talkpython</a><br/> <b>Follow Michael on Mastodon</b>: <a href="https://fosstodon.org/web/@mkennedy" target="_blank" rel="noopener"><i class="fa-brands fa-mastodon"></i>mkennedy</a><br/></div>
Categories: FLOSS Project Planets

Python Bytes: #371 Python in a Crate

Planet Python - Tue, 2024-02-13 03:00
<strong>Topics covered in this episode:</strong><br> <ul> <li><a href="https://fosstodon.org/@RhetTbull/111876913345192826"><strong>AppleCrate</strong></a></li> <li><a href="https://nedbatchelder.com/blog/202402/one_way_to_package_python_code_right_now.html?utm_source=pocket_reader"><strong>One way to package Python code right now</strong></a></li> <li><a href="https://fosstodon.org/@ihor/111456123685623940"><strong>Flask8 but why?</strong></a></li> <li><strong>Extra, Extra, Extra</strong></li> <li><strong>Extras</strong></li> <li><strong>Joke</strong></li> </ul><a href='https://www.youtube.com/watch?v=zVyw2qTO88c' style='font-weight: bold;'data-umami-event="Livestream-Past" data-umami-event-episode="371">Watch on YouTube</a><br> <p><strong>About the show</strong></p> <p>Sponsored by ScoutAPM: <a href="https://pythonbytes.fm/scout">pythonbytes.fm/scout</a></p> <p><strong>Connect with the hosts</strong></p> <ul> <li>Michael: <a href="https://fosstodon.org/@mkennedy"><strong>@mkennedy@fosstodon.org</strong></a></li> <li>Brian: <a href="https://fosstodon.org/@brianokken"><strong>@brianokken@fosstodon.org</strong></a></li> <li>Show: <a href="https://fosstodon.org/@pythonbytes"><strong>@pythonbytes@fosstodon.org</strong></a></li> </ul> <p>Join us on YouTube at <a href="https://pythonbytes.fm/stream/live"><strong>pythonbytes.fm/live</strong></a> to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.</p> <p><strong>Michael #1:</strong> <a href="https://fosstodon.org/@RhetTbull/111876913345192826"><strong>AppleCrate</strong></a></p> <ul> <li>By <a href="https://fosstodon.org/@RhetTbull/111876913345192826">Rhet Turnbull</a> (from <a href="https://talkpython.fm/episodes/show/383/textinator-and-building-macos-apps-with-python">Building macOS Apps episode</a>)</li> <li>AppleCrate is a tool for creating native macOS installers for your command line tools. </li> <li>It's useful for creating installers for command line tools written in any language. </li> <li>Tools written in interpreted languages like Python will need to be first processed with a tool like pyinstaller to create a standalone executable.</li> <li>AppleCrate uses <a href="https://jinja.palletsprojects.com/en/3.0.x/">Jinja2</a> templates to generate the files required for the installer. This allows you to use template variables in your files or command line parameters to customize the installer. </li> </ul> <p><strong>Brian #2:</strong> <a href="https://nedbatchelder.com/blog/202402/one_way_to_package_python_code_right_now.html?utm_source=pocket_reader"><strong>One way to package Python code right now</strong></a></p> <ul> <li>Ned Batchelder</li> <li>An example repo with all the parts for package</li> <li>A lot of discussion and what to think about in the README (unfortunately rst and not md, but we can’t have everything)</li> <li>Includes <ul> <li>pyproject.toml</li> <li>dev-requirements.txt</li> <li>README.rst</li> <li>Makefile</li> <li>LICENSE.txt</li> <li>.bitignore</li> <li>.editorconfig <ul> <li>see https://editorconfig.org</li> </ul></li> </ul></li> <li>Shout out to to <a href="https://packaging.python.org/en/latest/tutorials/packaging-projects/">Packaging Python Projects</a> on python.org, which is pretty good</li> </ul> <p><strong>Michael #3:</strong> <a href="https://fosstodon.org/@ihor/111456123685623940"><strong>Flask8 but why?</strong></a></p> <ul> <li>Ihor Kalnytskyi: Something I really like about <a href="https://fosstodon.org/tags/ruff">#ruff</a>, a new tool for both linting and formatting in the <a href="https://fosstodon.org/tags/python">#python</a> ecosystem. You can literally pick any lint rule it supports and see both reasoning and examples.</li> <li>Ruff supports over 700 lint rules, many of which are inspired by popular tools like Flake8, isort, pyupgrade, and others. </li> </ul> <p><strong>Brian #4:</strong> <strong>Extra, Extra, Extra</strong></p> <ul> <li><a href="https://flat.app/">Flat.app</a> <ul> <li>kinda like trello, etc. but a very simple interface that makes it pretty easy to use</li> </ul></li> <li><a href="https://tosdr.org/en/frontpage">tosdr.org</a> <ul> <li>Terms of Service; Didn’t Read</li> <li>Kind of a wikipeda way to summarize the terms of service of different web services, and give them ratings/grades</li> </ul></li> <li><a href="https://www.sheenaoc.com/articles/2024-02-06-why-i-write">Why I write</a> <ul> <li>I talked about blogging more last episode. Here’s a cool write-up by Sheena O'Connell</li> <li>reasons <ul> <li>to remember</li> <li>to refine my thinking</li> <li>to impact</li> <li>to get through hard times</li> <li>to connect</li> </ul></li> </ul></li> <li><a href="https://blog.jetbrains.com/pycharm/2024/02/pytest-features/">Three pytest Features You Will Love</a> <ul> <li>Helen Scott at JetBrains/PyCharm</li> <li>Fixtures, Markers, Parametrize</li> <li>Plus shoutouts to my <a href="https://courses.pythontest.com/p/complete-pytest-course">course</a> and <a href="https://pythontest.com/pytest-book/">book</a></li> </ul></li> </ul> <p><strong>Extras</strong> </p> <p>Brian:</p> <ul> <li><a href="https://en.wikipedia.org/wiki/List_of_common_misconceptions">Wikipedia List of common misconceptions</a> - just for fun</li> <li><a href="https://www.eartrumpetlabs.com/products/microphones/edwina">Ear Trumpet Labs (a Potland Company) Edwina mic</a> - just something on my wish list</li> </ul> <p>Michael</p> <ul> <li><a href="https://monitor.mozilla.org/">Mozilla Monitor</a></li> <li><a href="https://docs.python.org/release/3.12.2/whatsnew/changelog.html#python-3-12-2">Python 3.12.2</a> <ul> <li>Upgraded all the Python apps (11 of them) in about 2 minutes and one command</li> </ul></li> <li>Got a Vision Pro? Try the <a href="https://training.talkpython.fm/apps">Talk Python Courses app</a></li> <li>Great video event: <a href="https://www.youtube.com/watch?v=KeegA_uzzSo">Data Doodling with Martina Pugliese</a></li> </ul> <p><strong>Joke:</strong> <a href="https://ifunny.co/picture/why-would-a-fly-land-on-something-like-this-rats-7NlBlVArA?s=cl">Free Tier</a></p>
Categories: FLOSS Project Planets

Specbee: Driving E-Commerce Revenue Success with Drupal Commerce

Planet Drupal - Tue, 2024-02-13 01:56
Every e-commerce business has unique requirements. While some are simple plug-and-play solutions, others are tailored with custom development. Evolving trends like AI-driven personalization, seamless mobile experiences, and the growing importance of sustainability, are equally playing a part in an e-commerce application’s requirements.  Using a framework that offers deep customization is essential for almost every e-commerce store. Today, we’re going to talk about one such e-commerce framework - Drupal Commerce. With Drupal Commerce, you get the flexibility of Drupal and the power of innovation. Let's take a closer look at some of its features and architecture in this article. The Relevance of E-commerce Today Global Reach: With an internet connection, anyone can access e-commerce platforms worldwide. 24/7 Accessibility: Enjoy the convenience of anytime access. Diverse Product Offerings: Unlike offline shopping, where options are limited, e-commerce opens the door to a wide variety of products. Economic Growth: E-commerce fosters economic growth by offering a broad spectrum of products, breaking free from the constraints of limited stock seen in offline shopping. Contactless Transactions: Embrace the ease and safety of contactless transactions in the digital shopping realm. Choosing Drupal Commerce Now, the next question arises: Why should we choose the Drupal Commerce platform for e-commerce? Considering the myriad CMS platforms in the market such as Magento, WordPress, Shopify, and Drupal, selecting the right platform can indeed be challenging. Here are some reasons for opting for Drupal as your e-commerce platform: Open-source and extensible Flexibility for complex business needs Rules-based architecture  Community support and modules Integration with third-party services Stands out for businesses aiming to create a user-friendly and easily accessible e-commerce platform. Key Features of Drupal Commerce Take a look at some key features of Drupal Commerce that you might like: Integrations - Drupal provides extensive integration possibilities with third-party services and tools. E-commerce websites can seamlessly integrate with payment gateways, shipping providers, and other essential services. Rules-Based Architecture - Drupal Commerce, as part of Drupal, integrates with the Rules module. This allows administrators to define complex business rules and workflows, providing flexibility in managing various aspects of the e-commerce process. Headless and Decoupled Architecture - Drupal supports headless and decoupled architectures, allowing businesses to use Drupal as a back-end while using a different front-end technology. This flexibility is beneficial for creating unique and tailored user interfaces  Additional Features: Multiple stores - Easily create and manage multiple stores with Drupal Commerce. Multiple currencies - Handle transactions in multiple currencies. Flexible and Extensible Powerful Content Management Community Support Theming and Responsive Design SEO-Friendly Multilingual Capabilities Security Drupal Commerce Architecture and Components Now, let's delve into the architecture and components of Drupal Commerce. There are different types of entities in Drupal Commerce, including, Store: Can products be added without a store? Absolutely not! A key element in Drupal Commerce, the store, plays a crucial role in controlling billing and shipping countries available during the checkout process. Each store can even have its own currency, a boon for dealing with multiple currencies across locations. Product Architecture: Understanding the product structure is key before diving into adding products in Drupal Commerce. Imagine your store selling t-shirts or shirts. These products come in various sizes, colors, types, fabrics, etc. To handle this complexity, Drupal Commerce introduces Product Attributes. For example: Product Type: t-shirt Size: Product Attribute Color: Product Attribute In Drupal Commerce: There's a single product entity. This product entity comprises 7 different product variations. Size Product Attribute has 3 values: Small, Medium, and Large. Color Product Attribute has 4 values: Green, Orange, Red, and Blue. Order Entities: Order entities contain information about the product, its variation, and customer details. Order Items: These represent purchased items within the order. Order Types: Each order type has its own settings for the cart and checkout pages. We’ll discuss more practical implementations of this later. Implementing Drupal Commerce Prerequisites Make sure you have a web server that satisfies Drupal’s requirements The preferred memory limit is 256MB or more. Latest version of Composer to manage dependencies. DDEV or lando for local development.  Drupal Installation composer require "drupal/commerce"Enable Commerce drush en commerce_product commerce_checkout commerce_cartGetting Started Create a Store From the toolbar navigate to Commerce > Configuration > Store > Stores and click on the Add Store button. Once you add the store, you will be able to add and display products easily.   Configure different product entities To add a new Product inside a Store, let’s first create a Product Type by navigating to Commerce > Configuration > Product types from the toolbar menu or visit /admin/commerce/config/product-types Click on Add Product type button When you select Product variation type as “Create new” then you don’t need to add Product variation additionally. Now, let's create Product Attributes for the same Product Type by navigating to Commerce > Configuration > Product Attributes or simply visit /admin/commerce/product-attributes and click on the “Add product Attribute” button. While adding a Product Attribute, you will notice that the Product variation types (created in step 2) are present and you can map your attributes to your variations. As a result, these attributes will be visible when you add variations to any product. Here in the above example, we have created a Product Attribute as Color, in which we have listed different colors. Similarly you can create different Product attributes like Size, Type, etc. Now that you have created a Store, Product Type, Product Variations, and Product Attributes, it’s time to create a new Product. Add Products 1. To add a Product navigate to Commerce > Products and click on the “Add Product” button. 2. Enter your Product Details and click on “Save and add variations”. 3. Add your different product variations. Displaying Products Product display pages First, you will need to customize the product pages from the “Manage Display” tab option. For multi-product displays, simply create a view page to display multiple products. Add to cart form Next, include the Add to Cart form on product pages or the other pages from where the user can add the products to the cart. To include the “Add to cart” form, navigate to Commerce > Configuration > Orders > Order Item Types and then navigate to “Manage Form Display” of the particular order item (here we used Default)   Product images To add Product Images, you need to add a field inside the Product Variation Type entity so that different images can be uploaded for every different Product variations. Further, you can learn how to use the Drupal Core Image module to create a custom image style for products. To create a custom view mode for product variations, you can use the Image delta formatter module. Add Payment Gateway By default, Drupal Commerce provides a COD (Cash On Delivery) payment gateway, but you can configure different payment gateways as well. To learn more about how to add a payment gateway click here.     Orders You can manage your orders from the Orders page by navigating to Commerce > Orders.   Final Thoughts Choosing the right framework for your unique e-commerce business is absolutely crucial. A robust and customizable framework like Drupal Commerce is not just an option; it's a strategic necessity. Combining the flexibility of Drupal with a flair for innovation, Drupal Commerce stands as a powerful solution for varied e-commerce needs. If you’re looking to build or enhance your e-commerce solution, we have the Drupal development expertise and experience to bring your vision to life. Let’s make it happen!  
Categories: FLOSS Project Planets

Python⇒Speed: Not just NVIDIA: GPU programming that runs everywhere

Planet Python - Mon, 2024-02-12 19:00

If you’re doing computations on a GPU, NVIDIA is the default, alongside its CUDA libraries. Some libraries like PyTorch support do support AMD GPUs and Macs. But from the re-implementations of NumPy, SciPy, and Pandas in the RAPIDS project, to Numba’s GPU support, NVIDIA has best software support in the Python world.

Sticking to NVIDIA-specific software has some downsides, however:

  • It won’t run on modern Mac laptops.
  • Testing in CI is more difficult: you need custom runners that have NVIDIA GPUs.
  • You can’t use any other GPUs you might have access to, like AMD GPUs.

What can you do if you want to use GPUs in a portable manner? In this article we’ll cover one option, the wgpu-py library.

Read more...
Categories: FLOSS Project Planets

Pages