FLOSS Project Planets

Droptica: How to Manage Multimedia in Drupal? Media Module

Planet Drupal - Wed, 2021-04-14 05:33

Working with multimedia is one of the areas that large websites have to deal with. When multiple editors upload a large number of files, keeping your photos and videos in order can become difficult and time-consuming. Drupal has several proven recipes for managing the media library, which I'll present in this article.

Drupal modules for managing multimedia

Drupal offers great flexibility when working with files on a website. In the simplest terms, you can use fields like "File upload". A more complicated option is to use one of the modules to work with multimedia. Let's take a look at three interesting modules worth knowing about.

IMCE module

IMCE is a file viewer available to administrators and editors that also allows you to add, copy, and delete files and directories. It’s fast and convenient, it offers a preview of photos (including creating thumbnails), allows you to sort them and limit the disk space for individual users.

There was a time when the IMCE module was an absolute must-have for any Drupal website. To this day, over 340 thousand websites use it, but its popularity is steadily declining. The reason for this is that with more editors it's difficult to keep your file directories in order. Searching for a specific item is problematic, because the files have only a name and type. It's also impossible to filter them according to selected criteria. Despite the existence of the IMCE version for Drupal 8, new websites usually use other solutions.


SCALD project

SCALD is a module designed for Drupal 7, with a very rich base of add-ons (over 50 additional modules). It allows you to add photos, videos, and other types of files as entities called atoms. Each atom can have any field list based on which the media list is filtered. There is no module version for Drupal 8, but there is a migration path for atoms to the Media module entity.

I mention the SCALD module due to its significant contribution to building the concept of media management. With the premières of Drupal 6 and 7, the era of entities and fields was slowly approaching. The first ideas began to emerge to present files as entities that could be described in any way. This is how the SCALD project was created – quite niche, although used over the years on large and popular sites with millions of multimedia, such as Radio France, ARTE TV and Le Figaro.

Media module

This is by far the most important of the modules presented here. It follows an idea similar to SCALD, because it turns files into entities. It’s currently used by over 180 thousand Drupal 7-based websites, as well as all the websites based on Drupal 8 and 9. That's because since version 8.4 it’s in the core.

Media is a mature module, prepared for years by a team of experienced programmers. I can confidently say that it's one of the best multimedia management solutions available on the Internet. What makes the Media module so special? I'd point out its four main advantages:

  1. Effective embedding of a file library in the Drupal's entity/field/view model. This solution gives virtually endless possibilities for web developers. The files can have different view modes and form view modes, they can be used in many independent contexts. A photo sent via the Media module can be used multiple times, both as a thumbnail in the content of the article and, for example, as a background of a large banner.
  2. Leaving the directory/file model. When uploading a photo or video, the editor no longer decides about the order in the directory structure. It’s done automatically. Ordering is done using the fields defined in the media. You can, for example, add a category to the files, and then use it to search through the list of multimedia.
  3. Independence from media sources. On a well-designed website, videos will work the same way whether they are uploaded directly or via YouTube or Vimeo. Photos can also be loaded from multiple sources (such as Pixabay or Google Drive). Such an approach makes the work of editors easier and allows quickly adding subsequent sources as needed.
  4. Media isn't only multimedia anymore. You can put documents, Facebook posts or excerpts from Google Maps in the media library. Your only limit is your imagination.

When it comes to migration, remember that the Media module comes in three forms:

In each of these cases, a migration path to the core version is available, so you can easily transfer the multimedia library to a newer Drupal.

Why isn't the Media module used on every website?

This begs the question – since the Media module is so great and also available in the core, why isn't it enabled by default and used in every Drupal project? This is because many Media elements need to be set up by a programmer first. Therefore, this module is a tailor-made solution that is strongly adapted to the needs of a specific website.

It's particularly problematic to correctly display videos from external sources (due to the limited capabilities of external players) and to design appropriate display modes for the media. Getting through these issues can take a long time. Due to this fact, at Droptica we use a ready-made solution included in Droopler, the Drupal distribution.

Media module in Droopler

Since version 2.0, Droopler has built-in support for the Media module. All photos, graphics, icons and videos on the website are stored in the file library.


It's fine if you have a website based on Droopler 1.x. When upgrading to Droopler 2.x all "File upload" fields will be automatically converted to the new format.

The files put in the library can be used in many places on the website - as a paragraph background, an icon, a photo in a gallery or a cover for a blog post. In each of these contexts, the multimedia will be trimmed and adjusted accordingly. Here are examples of using the same photo in a completely different capacity:

As a tile


As a form background


As a blog cover


Once you start using Droopler, you'll be amazed at the ease with which you can use YouTube and Vimeo videos. For example, try putting your video in a paragraph with a banner. In the paragraph edit options add the media in the "Background" field:


Then go to the "Video" tab, enter the video address, click ADD and choose a title for the newly added item. Finally, put the video in a paragraph.


The effect of this action will be a moving background that stretches across the entire screen and is played in a loop. The YouTube controls will be hidden, and the video will have a transparent black overlay, improving the readability of the text.


You can add a video to a gallery in the same way, and e.g. next to the text, in the "Sidebar Image" paragraph. There are practically no restrictions here, all the elements fit together well.


The multimedia library included in the latest Drupal works great with even with a large number of subpages and blog posts. You will quickly notice that reusing the existing photos and videos saves time and effort. Even though the Media module requires a lot of coding for every new project, you can use "prepackages" such as Droopler to start working on the content right away.

Categories: FLOSS Project Planets

Python Morsels: Python doesn't have constants

Planet Python - Wed, 2021-04-14 02:30

Python doesn't have constants.

The CONSTANT convention

We have two variables here that are named with a fully uppercase naming convention:

>>> NUMBERS = [2, 1, 3, 4, 7, 11, 18] >>> COORDINATES = (1, 2, 3)

That naming convention is pretty common for constant variables in other programming languages. Sometimes you'll it in Python as well (PEP 8 actually notes this convention).

Variables point to objects

If we point another variable, nums, to first variable, NUMBERS:

>>> nums = NUMBERS

And then we call the append method on this new nums variable:

>>> nums.append(29)

This will mutate the object that nums points to:

>>> nums [2, 1, 3, 4, 7, 11, 18, 29]

We've changed the list that nums is pointing to. But NUMBERS and nums point to the same object, which means we've changed NUMBERS too!

>>> NUMBERS [2, 1, 3, 4, 7, 11, 18, 29]

That's in fact, what assignment does.

Variables point to objects in Python and we've pointed two variables to the same object. So when we change nums, NUMBERS seems to change as well because the object which NUMBERS points to have changed (remember there's 2 types of change in Python).

You can see this mutation by stepping through this interactive Python Tutor visualization:

Immutable objects cannot be changed

This COORDINATES variable points to a tuple:

>>> COORDINATES (1, 2, 3)

Unlike lists, tuples are immutable objects, meaning tuples cannot be changed.

So, if we point the variable p to COORDINATES:


And then we try to mutate the object that p points to, we'll get an error.

For example we can't assign to an index in that tuple:

>>> p[0] = 10 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'tuple' object does not support item assignment

And we can't append to the tuple:

>>> p.append(29) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'tuple' object has no attribute 'append'

As hard as we might try, there is no way to mutate the tuple that p points to. We can't change tuples because tuples are immutable objects.

Assignment changes what a variable points to

Immutability is about changing objects; it's about mutation, and mutating the objects. But we have two types of change in Python.

Objects are changed through mutations. Variables are changed through assignment statements. Variables point to objects, and you can change which object a variable points to by assigning to that variable.

So, can we take COORRDINATES and assign it to a different tuple?

>>> COORDINATES = (4, 5, 6) >>> COORDINATES (4, 5, 6)

We can! There's nothing stopping us from doing this.

So COORDINATES isn't actually a constant variable. And in fact, there's no way to make it a constant variable. Python doesn't have constants.


In Python, we have this concept of immutability. For each object we can ask, is the object mutable (meaning you can change it), or is it immutable (meaning it can't be changed)?

Variables point to objects. There's no way to lock a variable down and stop it from being reassigned. Constant variables in other languages cannot be reassigned. We don't have any equivalent of that in Python. In Python, there's no way to stop a variable from being reassigned.

As long as you're in the same scope as a variable, you can always reassign it. Likewise, as long as an object is mutable, you can always mutate it. However, you can make an immutable object, but you cannot make a constant variable.

Categories: FLOSS Project Planets

My current Plasma Wayland from git

Planet KDE - Wed, 2021-04-14 01:28
However much distress the current scenario and some personal stuff might cause, I’ve really been having fun with my laptop. Running everything on bleeding edge is exciting: kernel 5.12.rc6, openSUSE Tumbleweed with Plasma built daily from master (so openSUSE Krypton), using only the Wayland session, switching entirely to pipewire and so on. I figured I … Continue reading "My current Plasma Wayland from git"
Categories: FLOSS Project Planets

Codementor: Basic Tutorial: Using Docker and Python

Planet Python - Wed, 2021-04-14 00:12
How I write Dockerfiles for python applications and why.
Categories: FLOSS Project Planets

Spinning Code: SC DUG April 2021 – Getting Started with Electron

Planet Drupal - Tue, 2021-04-13 23:44

This month I gave a talk at South Carolina Drupal User Group on Getting Started with Electron. Electron allows you to use your web developer skills to create desktop applications. I based this talk on some of my recent side projects and the Electron Project Starter I posted the end of last year.

If you would like to join us please check out our up coming events on MeetUp for meeting times, locations, and remote connection information.

We frequently use these presentations to practice new presentations, try out heavily revised versions, and test out new ideas with a friendly audience. So if some of the content of these videos seems a bit rough please understand we are all learning all the time and we are open to constructive feedback. If you want to see a polished version checkout our group members’ talks at camps and cons.

If you are interested in giving a practice talk, leave me a comment here, contact me through Drupal.org, or find me on Drupal Slack. We’re excited to hear new voices and ideas. We want to support the community, and that means you.

The post SC DUG April 2021 – Getting Started with Electron appeared first on Spinning Code.

Categories: FLOSS Project Planets

hussainweb.me: My thoughts on Automatic Updates in Drupal

Planet Drupal - Tue, 2021-04-13 23:20
It’s spring and I decided to come out to a park to work and write today’s post. I sat on a bench and logged in to my WordPress site to start writing the post when I noticed that one of the plugins had updates available. I didn’t have to think about this and straightaway hit the update button. Less than 30 seconds later, the plugin was updated, the red bubble had disappeared, and I had my idea of today’s post. That is why I want to talk about automatic updates on Drupal today.
Categories: FLOSS Project Planets

Sumana Harihareswara - Cogito, Ergo Sumana: Python Packaging Tools: Security Work And An Open Position

Planet Python - Tue, 2021-04-13 20:59

Two exciting bits of news regarding massively improving how we package, distribute, and install Python software!

First: a new grant. New York University (specifically Professor Justin Cappos) and I have successfully asked the US National Science Foundation for a grant to improve Python packaging security. The NSF is awarding NYU $800,000 over two years, from mid-2021 to mid-2023, to further improve the pip dependency resolver and to integrate The Update Framework further into the packaging toolchain. I shared more details in this announcement on an official Python packaging forum.

I'll be part of this work, paid to work on this part-time, doing some outreach, coordination, project management, and similar. Thanks to the NSF, Justin, the Secure Systems Lab at NYU, and all the people who work on Python packaging tools!

Second: the Python Software Foundation is hiring a full-time project manager and community manager for Python's packaging toolchain. Thanks to Bloomberg for the funding! Please check out the job description and spread the news. Please apply by May 18th, 2021.

The job is remote and you can apply from anywhere in the world. As the description says: "Total compensation will range from $100k-$125k USD based on qualifications and experience." And you'd report to Ee W. Durbin III, a colleague I strongly recommend and love working with.

I'm thoroughly grateful that we've now gotten to the point where the PSF can hire for a full-time person for this role. As a volunteer and as a contractor, I've performed -- in many cases initiated -- the activities that this person will do, and I've seen the critical need. We deeply need a full-time coordinator for holistically assessing and improving the user and developer experience of Python packaging, because -- as Russell Keith-Magee said in his PyCon US 2019 keynote -- the status quo poses "an existential threat" to the future of the language. And so one of the desired qualifications for the role is: "Belief that Python packaging problems are of critical importance for the Python language... but that those problems are solvable."

We've gotten better and better at attracting corporate and grant funding -- and yes, I'll take some credit for that, with my past work researching and writing grant proposals, leading funded projects, and volunteering with the Packaging Working Group and cofounding the Project Funding Working Group. So, now, what should we focus on? We need to prioritize improvements for strategic value (e.g., should we first concentrate on overhauling the Warehouse API, or making a generic wheel-builder service, or tightening metadata compliance, or ....?). What can we learn from other package management toolchains, especially those that emerged after PyPI and pip (e.g., yarn, npm, cargo), and what should we copy? In my opinion, you do not need to already have an opinion on these questions to apply for this role -- you just have to be interested in talking with a bunch of stakeholders, poking through past discussions, and collaboratively developing some answers.

I won't be applying for this PSF role -- I'm going to be, instead, excited to collaborate with that person and help them learn all the stuff I know, so that in the long run, we'll have more people, with that set of skills and domain knowledge, working on Python packaging. I'll concentrate on the Python supply chain security piece specifically (via the NSF-funded work at NYU), plus finishing my book and maybe creating and leading associated trainings, and taking what I've learned to other languages and ecosystems through client work.

So: please spread the word and apply!

Categories: FLOSS Project Planets

Dirk Eddelbuettel: RcppArmadillo on CRAN: New Upstream ‘Plus’

Planet Debian - Tue, 2021-04-13 20:22

Armadillo is a powerful and expressive C++ template library for linear algebra aiming towards a good balance between speed and ease of use with a syntax deliberately close to a Matlab. RcppArmadillo integrates this library with the R environment and language–and is widely used by (currently) 852 other packages on CRAN.

This new release brings us the just release Armadillo 10.4.0. Upstream moves at a speed that is a little faster than the cadence CRAN likes. We release RcppArmadillo on March 9; and upstream 10.3.0 came out shortly thereafter. We aim to accomodate CRAN with (roughly) monthly (or less frequent) releases) so by the time we were ready 10.4.0 had just come out.

As it turns, the full testing had a benefit. Among the (currently) 852 CRAN packages using RcppArmadillo, two were failing tests. This is due to a subtle, but important point. Early on we realized that it would be beneficial if the standard R control over random-number creation and seeding affected Armadillo too, which Conrad accomodated kindly with an optional RNG interface—which RcppArmadillo supplies. With recent changes he made, the R side saw normally-distributed draws (via the Armadillo interface) changed, which lead to the two changes. All hail unit tests. So I mentioned this to Conrad, and with the usual Chicago-Brisbane time difference late my evening a fix was in my inbox. The CRAN upload was then halted as I had missed that due to other changes he had made random draws from a Gamma would now call std::rand() which CRAN flags. Another email to Brisbane, another late (one-line) fix back and all was good. We still encountered one package with an error but flagged this as internal to that package’s setup, so Uwe let RcppArmadillo onto CRAN, I contacted that package’s maintainer—who was very receptive and a change should be forthcoming. So with all that we have on CRAN giving us Armadillo 10.4.0.

The full set of changes follows. As Armadillo 10.3.0 was not uploaded to CRAN, its changes are included too.

Changes in RcppArmadillo version (2021-04-12)
  • Upgraded to Armadillo release 10.4.0 (Pressure Cooker)

    • faster handling of triangular matrices by log_det()

    • added log_det_sympd() for log determinant of symmetric positive matrices

    • added ARMA_WARN_LEVEL configuration option, to control the degree of emitted warning messages

    • reduced the default degree of warning messages, so that failed decompositions, failed saving/loading, etc, no longer emit warnings

  • Apply one upstream corrections for arma::randn draws when using alternative (here R) generator, and arma::randg.

Changes in RcppArmadillo version (2021-03-10)
  • Upgraded to Armadillo release 10.3 (Sunrise Chaos)

    • faster handling of symmetric positive definite matrices by pinv()

    • expanded .save() / .load() for dense matrices to handle coord_ascii format

    • for out of bounds access, element accessors now throw the more nuanced std::out_of_range exception, instead of only std::logic_error

    • improved quality of random numbers

Courtesy of my CRANberries, there is a diffstat report relative to previous release. More detailed information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page.

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

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

Categories: FLOSS Project Planets

Awesome Python Applications: Baserow

Planet Python - Tue, 2021-04-13 18:17

Baserow: Web-based no-code persistence platform, like a database meets a spreadsheet, with a REST API.


Categories: FLOSS Project Planets

Sumana Harihareswara - Cogito, Ergo Sumana: Trying to Notice What's Missing

Planet Python - Tue, 2021-04-13 16:16
I'm ploughing through some open source project email threads and thinking:

In 2010, people got together in Berlin for a Wikimedia developers' meeting .... and then a bunch of them hung around a lot longer than they'd expected, because a volcano erupted and so their flights got cancelled. As I understand it, you can trace certain architectural decisions and improvements to the discussions and pair programming from that chunk of unexpected extra in-person time.

It's conference season, at least in the northern hemisphere, and we're going into our second year of virtualized or missing technology conferences. The maintainers, users, and stakeholders of the open source software you depend on have gone more than a year without getting to quietly gossip with each other over a snack or while walking to a sponsored party. It's been more than a year since one guy has been able to make that other guy laugh and remember "ah, he's not so bad really". It's been more than a year since people could easily scribble boxes and arrows together on the back of a conference schedule or poke at the demo on someone's laptop.

We come together every once in a while to refill on trust and camaraderie and a shared understanding of what we're trying to do and who we're trying to do it for; I assume that, for some folks, those wells have now run dry.

In a tree's rings you can see the years of drought. Where, in our code and our conversations, will we see the record of this separation? Do you already see it?

Categories: FLOSS Project Planets

PyCoder’s Weekly: Issue #468 (April 13, 2021)

Planet Python - Tue, 2021-04-13 15:30

#468 – APRIL 13, 2021
View in Browser »

Python 3 Types in the Wild: A Tale of Two Type Systems

This academic paper from researchers at the Rensselaer Polytechnic Institute and IBM TJ Watson Research Center examines the MyPy and PyType tools and explores how Python developers use type annotations. The researchers collected over 70,000 Python GitHub repositories and found that only 2,678 had Python 3-style type annotations, most of which fail to type-check with either of the two tools. The paper’s third section is quite accessible and has a lot of interesting analysis.

How to Make an Awesome Python Package in 2021

The headache often associated with Python packaging is starting to fade away. Don’t believe me? Check out this step-by-step guide to creating and setting up a package repository. You’ll learn how to create a test package on TestPyPI, create a pyproject.toml file with flit, set-up linters and tests, GitHub Actions workflows, and more.

Datadog APM Provides Deeper, More Meaningful Trace Data to Quickly Resolve Application Problems

Datadog’s distributed tracing and APM generates flame graphs from real requests, enabling teams to visualize app performance in real-time. Engineering teams can seamlessly pivot to related logs and metrics without switching tools for fast troubleshooting and MTTR. Try Datadog APM free →
DATADOG sponsor

Start Contributing to Python: Your First Steps

In this quick introduction, you’ll see how you can take your first steps toward contributing to Python. You’ll discover various ways you can contribute and get to know some of the resources that will help you along the way.

Start Managing Multiple Python Versions With pyenv

Learn how to install multiple Python versions and switch between them with ease, including project-specific virtual environments, with pyenv.

PyCharm 2021.1 Is Out!

This release includes faster indexing, enhanced WSL 2 support, and an exciting new collaboration tool called Code With Me.
JETBRAINS.COM • Shared by Bartosz Zaczyński

PDFx V1.4.1 Is Now Available

PDFx is a tool to extract text, links, references, and metadata from PDF files and URLs. This release doesn’t include many new features but is rather a full update of the package repository to current Python standards, including testing and coverage, linting and static checks, GitHub workflows, and more.

Wing Python IDE 7.2.9 Released

This release includes remote development for 64-bit Raspberry Pi, improved auto-closing of quotes, optimized change tracking, and more.

PyPy v7.3.4 Released

This release includes two interpreters supporting the syntaxes for Python 2.7 and 3.7.

Discussions Why Does Pandas None | True Return False When Python None or True Returns True?

| represents the “or” operation, but when used in a boolean index in Pandas, it doesn’t behave the same way as Python’s or as you might expect — if you go off of name alone. The | operator is a bitwise operator, which only works on integer values. In fact, one could say that Python doesn’t really have a true logical “or” operator, since technically or is a short-circuit operator.

Python Jobs Intermediate Python Developer (Boulder, CO, USA)


Software Engineer (New York, NY, USA)


Data Engineer (Seattle, WA, USA)


Software Development Engineer (Indianapolis, IN, USA)

TOC Logistics International, Inc.

More Python Jobs >>>

Articles & Tutorials Using PyTorch + NumPy? You’re Making a Mistake

There’s a subtle bug that’s easy to introduce when using these packages, and it’s likely that many projects suffer from the bug. The issue has to do with how data is loaded, pre-processed, and augmented in PyTorch. If your training pipeline is bottlenecked by data pre-processing, you might decide to load the data in parallel. The canonical way of achieving this results in identical augmentations and can lead to performance degradation, but there’s a way to fix the problem.

How Python Dictionaries Work

Dictionaries are an important part of Python — not just because Python programmers use them a lot, but also because they are used internally by the Python interpreter to run Python code. In this in-depth article, you’ll learn about hash tables and hash functions as well as how Python dictionaries work behind the scenes.

[Free Virtual] How We Built Real-Time Full-Text Website Search with RediSearch

Join us at RedisConf where we feature this topic and more than 60 breakout sessions, 25% of which will be presented by Redis Enterprise customers. Learn about real-world use cases across three tracks. Register today →
REDIS LABS sponsor

Computer Vision and Embroidery

Andrew Healey’s wife wanted to find out what thread colors were used in some of the embroidery hoop images posted to the r/embroidery subreddit, so he embarked on a weekend project to solve the problem using the OpenCV computer vision library. Learn how he did it in this short, fun read, and then check out the source code over on his GitHub repository.

Getting Started With Refactoring Your Python Code

Do you think it’s time to refactor your Python code? What should you think about before starting this task? Listen Brendan Maginnis and Nick Thapen from discuss Sourcery in this episode of the Real Python Podcast. Sourcery is an automated refactoring tool that integrates into your IDE and suggests improvements to your code.

The k-Nearest Neighbors (kNN) Algorithm in Python

k-Nearest Neighbors (kNN) is a non-linear supervised machine learning algorithm suitable for both classification and regression problems. In this tutorial, you’ll learn all about the kNN algorithm in Python, including how to implement kNN from scratch, kNN hyperparameter tuning, and improving kNN performance using bagging.

Projects & Code superset: A Data Visualization and Data Exploration Platform


Python-Raytracer: A Basic Ray Tracer That Exploits NumPy Arrays and Functions to Work Fast


layout-parser: A Python Library for Document Layout Understanding


jurigged: Hot Reloading for Python


github-actions-updater: Like GitHub’s Dependabot but for GitHub Actions

GITHUB.COM/SAADMK11 • Shared by Maksudul Haque

Events Real Python Office Hours (Virtual)

April 14, 2021

GeoPython 2021

April 22 – 24, 2021

PyCon Israel 2021 (Virtual)

May 2 – 3, 2021

PyCon 2021 (Virtual)

May 12 – 18, 2021

DjangoCon Europe 2021 (Virtual)

June 2 – 6, 2021

PyCon India 2021

September 17 – 20, 2021

Happy Pythoning!
This was PyCoder’s Weekly Issue #468.
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

Django Weblog: Announcement of 4.x Technical Board Election Registration

Planet Python - Tue, 2021-04-13 15:16

The release last week of Django 3.2 represents the final feature release of a major release series of Django. Per DEP-10 this release triggers the election for the Technical board for the Django 4.x release cycle.

All DSF members are automatically registered electors.

If you are not a DSF member and would like to apply to vote you need to register here.

The process of electing a new Technical Board will be:

  • Registration of Electors is open for one week and ending Tuesday April 20th, 2021 AoE
  • Registration of Candidates will then be open for one week ending Tuesday April 27th, 2021 AoE
  • On Tuesday May 4th all registered and approved electors will receive an email to the email address they are registered with along with a unique code to be used when voting
  • Voting will be open for one week from May 4th
  • The results of the election will be announced when voting is finished.

If you have any questions about the elevation please contact foundation@djangoproject.com.

Chaim Kirby,

Secretary, Django Software Foundation

Categories: FLOSS Project Planets

OpenSense Labs: Drupal 9 Upgrade: FAQs

Planet Drupal - Tue, 2021-04-13 12:36
Drupal 9 Upgrade: FAQs Gurpreet Kaur Tue, 04/13/2021 - 22:06

Drupal has been in the content management game for over two decades. That is a long period of time and in that time span the CMS has accomplished a lot. It’s community of over a million Drupalists is just one part of it. With 20 years gone, Drupal is still running strong and it’s latest update is proof of that. 

Yes, in the June of 2020, amidst the pandemic, Drupal 9 was launched and it was my only sunshine at that time and I am sure many of my Drupal friends would agree with me. Drupal 9 can be deemed as one of the best offerings of Drupal, not there were many that were anything but great.

Job done easy: Drupal 9 upgrade

The latest version meant we had to take it on, why be comfortable with the past when the present can offer more comfort, right? However, the mammoth task that was the Drupal 8 upgrade, you must remember that, made many of us apprehensive and rightfully so. And that is where we were surprised, pleasantly might I add, by Drupal. 

“Easiest upgrade in a decade.”

This is how the Drupal 9 upgrade is being described and it is because you won’t have to replatform your site, you’d only be updating. It's like taking a connecting flight from London to Paris rather than leaving the airport and taking a train from the station. Connecting flights are easy.

Timeline of Drupal 9 future releases | Source: Drupal.org

Considering the fact that Drupal 9 is not a migration, the upgrade is a breeze. With the addition of new features like Olivero and Claro, being built and stabilised respectively, the new versions of Drupal 9 will become all the more appealing and a release can be expected half yearly much like Drupal 8. So, can we afford to sit back and not take the step towards upgrading our Drupal sites. The fact the Drupal 7 and Drupal 8’s end-of-life has been decided has given us all the more reason to make the upgrade. 

To help you in finding the answer to the popular question of “How to upgrade Drupal 9?”, here I am with an all inclusive checklist for this massive step you are about to take. So, let’s begin.

Is the upgrade different for Drupal 7 and Drupal 8?

This is one of the most commonly asked questions for Drupal 9 upgrade. There are still a lot of Drupal sites that are still operating on the 7th version, so it is understandable to want to know whether ‘the easiest upgrade of the decade' is applicable to them or is it different. 

Drupal 9 upgrade is different for Drupal 7 and 8 sites. This is mainly because Drupal 8 was a whole other ballgame than Drupal 7, while Drupal 9 is just a new and improved version of Drupal 8 with no deprecated APIs. Therefore, the upgrading process was bound to be different.

Let’s see how. 

Drupal 8 to Drupal 9 

Support for Drupal 8 will end on 2nd November, 2021, it will receive patch releases, but there won’t be any major updates in its feature simply because we have Drupal 9. Therefore, upgrading to the newer version is the better option. 

To upgrade from Drupal 8 to Drupal 9, 

  • You would have to see that all your projects are Drupal 9 compatible; 
  • You would have to see that your codebase is free of deprecated APIs; 
  • And then all you would have to do is run update.php. 

It sounds simple enough, right? That is because it is. Of course, you would have to perform some more steps than these three and there would be a number of tools that you would have to use for them. However, it is these three steps that are essentially the crux of upgrading from Drupal 8 onto 9.

Drupal 7 to Drupal 9

Drupal 7’s support is said to end on 28th November, 2022. Although your D7 site has quite some time ahead of it, you still have to start thinking about the upgrade as the process is not as easy as the D8 to D9 upgrade. 

You can take two routes here; 

  • You can first update to Drupal 8, avail functionality from all the modules that are yet to come in Drupal 9 and then take the easy route of upgrading to Drupal 9; 
  • Or you can directly upgrade to Drupal 9 and skip the 8th version. This would be ideal because your upgrade would have a much longer lifespan.

For the upgrade from Drupal 7, you would need three modules; 

  • The Migration Module Suite; 
  • Upgrade Status; 
  • And Drupal Module Upgrader. 

These three do everything from data and content migrations and checking the availability of modules to scanning them and updating them for the upgrade. 

So yes, the Drupal 9 upgrade from Drupal 7 and 8 is different, simply because they are very different versions of the CMS. 

Now that we have this notion clarified, let’s move on to all the nitty-gritty details of the upgrade.  

What tools would you need for the Drupal 9 upgrade?

Can you cook without the right ingredients? Can you make the perfect lasagna without the melt-in-the-mouth pasta? I know you know the answer to these two questions and that’s a big fat no. 

Therefore, the incredible journey towards the Drupal 9 experience has to start by talking about the tool you would need for it, the ingredients that’ll make the upgrade all the more appetising. I’ll stop with the cooking analogy now and come to the point. There are two mandatory tools that you will be needing.

Upgrade Status 

Upgrade Status is a module that ll but prepares your site for the upcoming upgrade you are planning to execute. It is a pretty versatile module that does all the grunt work required before making the leap to D9. 

  • Your site has to be the latest version of Drupal, that is Drupal 8.8 or 8.9, so the first thing this module does is inspects whether you are on that version, if not, it’ll tell you to update.
  • Your system needs to meet Drupal 9’s set requirements for the upgrade to go on smoothly, so the next thing it does is check if you meet them.
  • Your contributed projects also need to be updated and be compatible with Drupal 9. If they are Drupal 8 compatible, there is a high chance they’ll be for Drupal 9. So, Upgrade Status works with Update Status to ensure every project is in sync.
  • Your site needs to be compatible with Drupal 9 in other ways as well, so that is also checked and verified through phpstan.
  • Your system’s integration drush is also taken care of here.
  • Your system might have deprecated APIs, Upgrade Status finds, although there are any fixes provided; for that you'll need another tool.

Upgrade Status’ enchantment doesn’t end here, there is more to this module yet. 

  • I’ve told you that it prepares your Drupal 8 site, but it also gives you the leeway for downloading it with and without the Composer. 
  • It is also available in Drupal 7 and this version would help you in preparation for the Drupal 9 as well as Drupal 8 upgrade, if that is what you want. 
  • Now, the most alluring part, once you’ll upgrade to Drupal 9, it’ll start preparing you for the Drupal 10 upgrade! Yes, you read it right, Drupal 10 launch is in the works and you can be ready for that when it happens with this module.
Deprecation Check

Remember I mentioned deprecated APIs above, well, there are more than APIs that can be deprecated and that needs your attention before you start creating the upgrade environment for your site. That is why, Deprecation Checking and Correction Tools become a necessity.  

All in all, there are five tools for your help. 

  • The first one is an IDE or code editor, which comprehends deprecation to kickstart the process. 
  • Then there is the Drupal-check, this one performs a PHP run and let’s you know whether deprecated code is used and where.
  • Third is the Upgrade Status I talked about above, which essentially scans your entire system and finds deprecated code for you. 
  • The Drupal.org Testing System also supports deprecation inspection.
  • Finally, the Upgrade Rector Contributed Project provides a solution for all of the checking done above and that too in an automated manner.
What are the environment requirements for Drupal 9?

When you are roasting the perfect chicken, the temperature in the oven has to be just right, the timing has to be just right and the flavours have to be just right to make it come out all juicy and succulent. I know I have started with the cooking analogy again, but this is the best comparison I could think of. 

Like that perfect roast chicken, Drupal 9 also needs just the right environment from you and your system to make it work. And this involves; 

Web Servers

Drupal 9 can be run using two different web servers and you need to have the latest versions of these two.

  • For nginx, you have to have the version 0.7.x or above; 
  • And for Apache, it has to be at least 2.4.7.

PHP is the language Drupal is built on, of course you must know that. What you may not know is that you need PHP 7.3 for operating Drupal 9. The latest version 9.1.0 supports PHP 8.

Database and Hosting Structures 

Drupal 9 has specific requirements for its backend database as well as its hosts. These are; 

  • Version 5.7.8+ for MuSQL or Percona; 
  • Version 10.3.7+ for MariaDB;
  • Version 3.26+ for SQLite; 
  • Version 10 for PostgreSQL; 

And if you are planning to use Drush to build your interfaces, go for version 10, since only that is compatible with Drupal 9.

Have you prioritised the update of the core codebase?

Drupal 8 was the last major release before Drupal 9. Like any Drupal version, there are a number of minor releases being launched and you must keep up with them. If you have done so, your core codebase would be up-to-date and you’d be all set for the upgrade. 

One of the Drupal 9 upgrade requirements is that your site be updated to Drupal 8.8 or 8.9 for you to be prepared for the easiest upgrade of the decade. 

What happens if you are on a version older than 8.8?

What’ll happen is the upgrade won’t go through. Now you might ask why? I’ll give you an analogy, can you skip a few grades and land from 6th grade directly to high school? Even if you could, would you say that getting the hang of the classes you’ll have be quite arduous? It most definitely will be. So, like you can’t skip grades and you can’t skip the minor releases of Drupal 8 before going on to Drupal. Because Drupal 8.9 and Drupal 9 are somewhat similar the upgrade is a breeze, however, Drupal 8.4 and 9 do not share that kind of similarity and you might need to upgrade fast. 

From upgrades in PHP to core modules, from themes to contributed modules and from path aliases and database, almost every aspect requires updating to be compatible with Drupal 9. And only Drupal 8.8 and 8.9 have that level of API compatibility. 

How to upgrade if you have a Drupal version that precedes 8.7? 

For a version older than Drupal 8.7, you would have to perform some small code changes and database updates that are not very complex. An update to the latest version of the core would be required, and this would make the database and contributed modules ready for the 9 upgrade.

You can use Upgrade Status to ensure that all of what you just did is compatible with Drupal 9 or not. 

Then you’ll have to check for deprecated code, like we discussed two sections above. Thereafter, you become ready to update your core codebase to Drupal.

How to upgrade if you have a Drupal version that succeeds 8.8?

If you are already on Drupal 8.8, there isn’t much you have to do in order to prepare yourself. The only task to perform is running the Upgrade Status and checking compatibility. 

There is one more thing that you will have to do. And that is what your existing site is based upon because that will decide how the actual upgrade will flow. 

Your site could be based on Composer or it could be based on Tarball. Make sure you keep that in mind before starting the upgrade, as both work on different upgrade mechanisms. While the former has its own list of steps to follow, the latter is upgraded using Drush.

What about updating the custom code?

After upgrading the core codebase, you would have to pay close attention to your custom code. There is a high chance that your project will have custom modules and themes, these mean a custom code would also there and it is your responsibility to update it. 

You wouldn’t need new tools and techniques to help you here. 

  • Upgrade Status will scan all the projects for custom code deprecations; 
  • Upgrade Rector will fix any minor deprecations by itself. 

Updating the custom code is not that big a task, so it is often neglected and overlooked. However, it is important enough to hamper the entire upgrade. So, don’t skip it.

Can the contributed projects be neglected?

If you have taken care of the core and custom projects, you can’t think about leaving the contributed project without any attention. So, updating them is the next agenda on the Drupal 9 upgrade checklist. 

The reason for updating the contributed projects is the same as the core and custom projects, to check the compatibility of the projects with Drupal 9. And you must know by now, since I am repeating it for what feels like the 100th time, Upgrade Status will help you in the compatibility check.

You must know that even though a module is Drupal 9 compatible, there is the off chance that it can be a version of a major release that’ll bring API changes along with it. You have to be mindful of these modules because they can be detrimental to your site’s health. API changes that you are not prepared for can’t be efficacious by any means.

But what if a module is not Drupal 9 compatible?

There are, of course, not many of them, however there are some and you must know how to handle them. You can do any of these two things in this scenario.

  • Creating, you can create a custom code to update it;  
  • Or waiting, you can wait to see if it gets updated by the time you are ready for the final upgrade;  

What about the contributed modules with patches, do they need attention?

There are situations where you may want to update a contributed module, but an update is not in the picture, rather you have patches available and sometimes, not even that. What would you do? Pay attention to the patches, that is what.

Usually if a patch is available for a module, Upgrade Status would inform you about that and you can implement it. 

Then there is the scenario, when a contributed module has neither an update and nor a patch. For such an instance, the combination of Upgrade Status and Upgrade Rector will have you sorted. You can also check Drupal’s Contributed Modules Guidelines to help you further. 

Have you examined your content and field types thoroughly?

Auditing for site building is a must. Adding fields and customisations in Drupal is quite easy, anyone can do it. This is both good and bad. Good because anyone can do it leading to less dependence on developers, bad because anyone can do it meaning there might be redundant field types and outdated content. And in this step, you check for just that. 

  • Check and eliminate fields that were created for a once-in-a-lifetime event; don’t let them sit and waste away.
  • Remember those content types you created to add content later, well, you haven’t done that yet, so they have to go as well.
  • Update the help text; this might seem trivial to you, but being someone who relied on that piece of text to perform all my initial duties instead of pinging my manager every minute, trust me, it is important. If it is outdated, it is useless and why would you want something useless on your upgraded Drupal 9 site?

Customisations are only great until they don’t start bloating your site causing regression. You do not want that, so don’t just keep all your focus on the code, modules and themes, give some time to the content as well.

How do you become sure that your upgrade is successful?

You will execute the upgrade to make your site better than it already is, that should be the aim, right? However, despite you doing everything to the T, there is a chance that you may go in regression. Your upgrade may be doing everything that it is supposed to, but still your site’s performance can be slower than it was. 

Noone wants that scenario to become their reality, so how do you avoid that? How do you ensure that the upgrade is successful? There is certainly a way to ensure that and that’s through testing.

When you perform tests, you get to know what is truly happening with your site. Where you went wrong and what you did right won’t be hidden under a veil. For instance, performing a test to check the administrative and editorial working of the site is ideal. On paper, everything may appear sound, but in reality your editors could be struggling to make even the smallest of edits. And it is only through testing that you’ll be able to find that out. 

You can start at a smaller level with a hello world test and gradually scale up to examine the major aspects of the upgrade. 

Another thing that’ll help you in making the upgrade a success is going slow. Yes, upgrading to Drupal 9 is deemed as the easiest update of the decade, but it is still a huge task to take on. Just the sheer number of modules that wild require updating can become overwhelming, so go slow, update a few modules at one time. This is the chances of errors would be slim and the chances of success would be quite high. 

The Bottom Line 

Drupalists from across the globe had been awaiting the release of Drupal 9 for a long time, now that it is here, there is nothing holding us back from taking the upgrade leap. If I am to be honest, I’d say that I was fearful of the upgrade process. However, when Dries Buytaert say that one of the fundamental issues to address in the Drupal 9 release was the ease of installation, you cannot do anything but believe him. That’s what we should do. 

blog banner blog image Drupal 9 Drupal 9 Upgrade Blog Type Articles Is it a good read ? On
Categories: FLOSS Project Planets

Python for Beginners: Shortcut to comment out multiple lines in Python

Planet Python - Tue, 2021-04-13 10:05

We often need to comment out block of codes in python while testing or debugging the code. When a block is turned into a python comment, it doesn’t contribute in output of the program and helps to determine which function or block is generating error in the program. In this article, we will look at some shortcut to comment out multiple lines of code at once in different python IDEs. Lets see examples for each IDE one by one.

Shortcut to comment out multiple lines in Spyder

In spyder python IDE, we can comment a single line of code by selecting the line and then using the key combination ctrl+1 . This will turn the selected single line to a comment as shown below. The function given in the example adds a number and its square to a python dictionary as as key-value pair.

print("This line will be commented out.") def add_square_to_dict(x,mydict): a=x*x mydict[str(x)]=a return mydict

After pressing ctrl+1:

#print("This line will be commented out.") def add_square_to_dict(x,mydict): a=x*x mydict[str(x)]=a return mydict

The shortcut to comment out multiple lines of code in spyder IDE is to first select all the lines which need to be commented out and then the key combination ctrl+4 is pressed. This turns the entire selected lines into a python comment as shown below.

class MyNumber(): """This is the docstring of this class. It describes what this class does and all its attributes.""" def __init__(self, value): self.value=value def increment(self): """This is the docstring for this method. It describes what the method does, what are its calling conventions and what are its side effects""" self.value=self.value+1 return self.value print (MyNumber.increment.__doc__)

After pressing ctrl+4:

# ============================================================================= # # class MyNumber(): # """This is the docstring of this class. # # It describes what this class does and all its attributes.""" # def __init__(self, value): # self.value=value # def increment(self): # """This is the docstring for this method. # # It describes what the method does, what are its calling conventions and # what are its side effects""" # self.value=self.value+1 # return self.value # print (MyNumber.increment.__doc__) # =============================================================================

We can also use ctrl+1 to uncomment the lines after selecting them when they are commented out or comment out the lines after selecting them to comment them out. In some versions of Spyder ctrl+5 can be used to uncomment the lines of code.

Shortcut to comment out multiple lines in IDLE

To comment out a block of code in IDLE, we have to first select the line and then press the key combination ctrl+D. This will comment out the selected lines of code as shown below.

class MyNumber(): """This is the docstring of this class. It describes what this class does and all its attributes.""" def __init__(self, value): self.value=value def increment(self): """This is the docstring for this method. It describes what the method does, what are its calling conventions and what are its side effects""" self.value=self.value+1 return self.value print (MyNumber.increment.__doc__)

After pressing ctrl+D:

## class MyNumber(): ## """This is the docstring of this class. ## ## It describes what this class does and all its attributes.""" ## def __init__(self, value): ## self.value=value ## def increment(self): ## """This is the docstring for this method. ## ## It describes what the method does, what are its calling conventions and ## what are its side effects""" ## self.value=self.value+1 ## return self.value ## print (MyNumber.increment.__doc__)

To uncomment the lines of code, we just have to select the lines and then press ctrl+shift+d. This will uncomment the selected lines.

Shortcut to comment out multiple lines in Jupyter Notebook

We can use ctrl+/ to comment out the selected lines of python code in Jupyter Notebook. This turns selected lines of code into comment as shown below.

class MyNumber(): """This is the docstring of this class. It describes what this class does and all its attributes.""" def __init__(self, value): self.value=value def increment(self): """This is the docstring for this method. It describes what the method does, what are its calling conventions and what are its side effects""" self.value=self.value+1 return self.value print (MyNumber.increment.__doc__)

After pressing ctrl+/:

# class MyNumber(): # """This is the docstring of this class. # It describes what this class does and all its attributes.""" # def __init__(self, value): # self.value=value # def increment(self): # """This is the docstring for this method. # It describes what the method does, what are its calling conventions and # what are its side effects""" # self.value=self.value+1 # return self.value # print (MyNumber.increment.__doc__)

To uncomment the selected lines, we just have to again press ctrl+/.

Comment out multiple lines in Pycharm

If we have to comment out multiple lines of code in Pycharm, we can select the lines to be commented out and then press ctrl+shift+/ . To uncomment the lines, we just have to select the lines and then again press ctrl+shift+/.


In this article, we have seen shortcuts to comment out multiple lines at once in python different IDEs like spyder, IDLE, Jupyter Notebook and PyCharm. Stay tuned for more informative articles.

The post Shortcut to comment out multiple lines in Python appeared first on PythonForBeginners.com.

Categories: FLOSS Project Planets

Real Python: Start Managing Multiple Python Versions With pyenv

Planet Python - Tue, 2021-04-13 10:00

Have you ever wanted to contribute to a project that supports multiple versions of Python but aren’t sure how you would easily test all the versions? Are you ever curious about the latest and greatest versions of Python? Maybe you’d like to try out these new features, but you don’t want to worry about messing up your development environment. Luckily, managing multiple versions of Python doesn’t have to be confusing if you use pyenv.

This course will provide you with a great overview of how to maximize your time spent working on projects and minimize the time spent in headaches trying to use the right version of Python.

In this course, you’ll learn how to:

  • Install multiple versions of Python
  • Install the latest development version of Python
  • Switch between the installed versions
  • Use virtual environments with pyenv
  • Activate different Python versions and virtual environments automatically

[ 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

Everyday Superpowers: Recover from pre-commit-adjacent file losses

Planet Python - Tue, 2021-04-13 09:40

Pre-commit is a immensely useful tool for your projects. I use it for every project I work on.

In a rare event, it might seem as though you lost many modified files—potentially hours of work, but the truth is your files are safe, and it's easy to restore them.

Categories: FLOSS Project Planets

Stack Abuse: Plotly Scatter Plot - Tutorial with Examples

Planet Python - Tue, 2021-04-13 08:30

Plotly is a JavaScript-based, Python data visualization library, focused on interactive and web-based visualizations. It has the simplicity of Seaborn, with a high-level API, but also the interactivity of Bokeh.

In addition to the core library's functionality, using the built-in Plotly Express with Dash, makes it an amazing choice for web-based applications and interactive, data-driven dashboards, usually written in Flask.

In this guide, we'll take a look at how to plot a Scatter Plot with Plotly.

Scatter Plots explore the relationship between two numerical variables (features) of a dataset.

Import Data

We'll be working with the Heart Attack Dataset from Kaggle, which contains data on various bodily metrics that we could use as indicators of a heart attack possibility.

Let's import the dataset and print the head() to take a peek:

import pandas as pd df = pd.read_csv('heart.csv') print(df.head())

This results in:

age cp trtbps chol fbs restecg thalachh exng oldpeak slp caa output 0 63 3 145 233 1 0 150 0 2.3 0 0 1 1 37 2 130 250 0 1 187 0 3.5 0 0 1 2 41 1 130 204 0 0 172 0 1.4 2 0 1 3 56 1 120 236 0 1 178 0 0.8 2 0 1 4 57 0 120 354 0 1 163 1 0.6 2 0 1

Let's explore the relationships between features such as the thalachh (maximum recorded heart rate), trtbps (resting blood pressure), chol (amount of cholesterol) and output (0 or 1, representing lower or higher chances of experiencing a heart attack respectively).

First, let's go ahead and save our features separately for brevity's sake:

max_heartrate = df['thalachh'] resting_blood_pressure = df['trtbps'] cholesterol_level = df['chol'] output = df['output'] Plot a Scatter Plot with Plotly

Finally, we can go ahead and plot a Scatter Plot. Let's go ahead and first explore the relationship between max_heartrate and cholesterol_level. To plot a Scatter Plot with Plotly, we'll use the scatter() function of the Plotly Express (px) instance:

fig = px.scatter(x=cholesterol_level, y=max_heartrate) fig.show()

The only required arguments are the x and y features, which will plot a Scatter Plot (without axis labels) in a spun-up server on your browser of choice:

Alternatively, if you don't want to define your variables beforehand, Plotly offers the exact same syntax as Seaborn - you specify the data source, and the names of the features you'd like to visualize. This will map the features to labels, and plot them directly without having to specify the features like we did before:

import pandas as pd import plotly.express as px df = pd.read_csv('heart.csv') fig = px.scatter(df, x='chol', y='thalachh') fig.show()

This results in:

Note: You can also do a mish-mash of these approaches, where you supply your DataFrame as the source, but also use pre-defined variables instead of referencing the feature column-names in the scatter() call:

fig = px.scatter(df, x=cholesterol_level, y=max_heartrate) fig.show()

This results in a labeled Scatter Plot as well:

There doesn't seem to be much of a correlation between the cholesterol level and maximum heart rate of individuals in this dataset.

Customizing a Plotly Scatter Plot

Now, we rarely visualize plain plots. The point is to visualize certain characteristics of data, intuitively.

In our case, this might include coloring the markers depending on the output feature, or adding hover_data, which specifies what's shown on the markers when someone hovers over them.

Currently, the hover_data isn't very helpful, only showing us the x and y values, which can already be reasonably inferred from observing the resulting plot.

Let's go ahead and change a few of the parameters to make this plot a bit more intuitive:

import pandas as pd import plotly.express as px df = pd.read_csv('heart.csv') fig = px.scatter(df, x='chol', y='thalachh', color='output', hover_data=['sex', 'age']) fig.show()

We've set the color of each marker to be mapped to the output feature, coloring higher and lower chances of experiencing a heart attack in different colors. We've also included the sex and age of each individual on their markers.

This results in:

Finally, you can also change the size of the marker, either passing it a scalar value (such as 5) to the fig.update_traces() method, or by passing in a vector value (such as mapping the size to a feature) to the size argument.

Let's map the oldpeak feature with the size of each marker:

import pandas as pd import plotly.express as px df = pd.read_csv('heart.csv') fig = px.scatter(df, x='chol', y='thalachh', color='output', size='oldpeak', hover_data=['sex', 'age']) fig.show()

Now, each marker will have a variable size, depending on the values of the oldpeak feature:

Or, if you want to specifically make all markers of the same, fixed size, you can update the Figure's traces:

import pandas as pd import plotly.express as px df = pd.read_csv('heart.csv') fig = px.scatter(df, x='chol', y='thalachh', color='output', hover_data=['sex', 'age']) fig.update_traces(marker={'size': 10}) fig.show()

This results in:


In this guide, we've taken a look at how to plot a Scatter Plot using Python and Plotly.

If you're interested in Data Visualization and don't know where to start, make sure to check out our bundle of books on Data Visualization in Python:

Data Visualization in Python

Become dangerous with Data Visualization

✅ 30-day no-question money-back guarantee

✅ Beginner to Advanced

✅ Updated regularly for free (latest update in April 2021)

✅ Updated with bonus resources and guides

Data Visualization in Python with Matplotlib and Pandas is a book designed to take absolute beginners to Pandas and Matplotlib, with basic Python knowledge, and allow them to build a strong foundation for advanced work with theses libraries - from simple plots to animated 3D plots with interactive buttons.

It serves as an in-depth, guide that'll teach you everything you need to know about Pandas and Matplotlib, including how to construct plot types that aren't built into the library itself.

Data Visualization in Python, a book for beginner to intermediate Python developers, guides you through simple data manipulation with Pandas, cover core plotting libraries like Matplotlib and Seaborn, and show you how to take advantage of declarative and experimental libraries like Altair. More specifically, over the span of 11 chapters this book covers 9 Python libraries: Pandas, Matplotlib, Seaborn, Bokeh, Altair, Plotly, GGPlot, GeoPandas, and VisPy.

It serves as a unique, practical guide to Data Visualization, in a plethora of tools you might use in your career.

Categories: FLOSS Project Planets

Python Software Foundation: The PSF is hiring a Python Packaging Project Manager!

Planet Python - Tue, 2021-04-13 07:00

Thanks to a two-year grant commitment from Bloomberg, our second 2021 Visionary Sponsor and a long term committed supporter of the Python ecosystem, The Python Software Foundation (PSF) is hiring a full-time project and community manager for the Python Packaging ecosystem, with a specific focus on the Python Package Index (PyPI).

We are excited about the opportunities that partnerships like these can provide for our community and know that this one will serve as a model for what can be accomplished when organizations make investments in entire ecosystems rather than individual initiatives.

Bloomberg has been a Python Software Foundation sponsor since 2017. We greatly appreciate their support. You can read more about how Bloomberg is supporting the Python ecosystem, and why they’re interested in improving the Python Packaging ecosystem, on the Tech At Bloomberg blog.

About the role

Over time, the Python packaging ecosystem has grown to span numerous software projects, standards, and use cases within the Python community. This growth and specialization of projects has helped bring the Python community to where it is, but has posed challenges in coordinating important changes across the entire ecosystem. Major projects in the space include PyPI, pip, virtualenv, wheel, setuptools, twine, and packaging.python.org.

The project manager will oversee improvements and added functionality that will benefit all Python users while leading the development of PyPI into a sustainable service. Working with the PSF Director of Resource Development to fund work throughout the packaging ecosystem. This role will also serve as a community manager to solicit feedback and facilitate discussions amongst stakeholders in the Python packaging community to generate consensus and establish new specifications.

Over the past three years, the PSF has overseen work on multiple1 one-off grants in the Python packaging ecosystem, which were successfully fulfilled for improvements to PyPI as well as pip. While these projects have been successful, the PSF is committed to establishing a structure through this role to support such projects sustainably, and assessing the backlog of potentially funded work, as well as lingering demand in the community for further improvement.

Ultimately, this role will provide a basis for progressing initiatives across multiple packaging projects and taking on additional funding opportunities on a continuous basis and acting as a known point of contact for members of the community.

Interested in the position?

If you are interested, please see the job post on the Python Job Board for the job description and instructions to apply. The call for resumes will be open until May 18, 2021.

1: Past funded work includes: MOSS award to finish and launch ground-up rewrite of PyPI (2018); Open Technology Fund contract to add 2FA, API keys, translations, improved accessibility, and internationalization to PyPI (2019); Facebook grant to implement automated checks for package uploads and PEP 548 in PyPI (2020); and MOSS award and Chan Zuckerberg Initiative grant to overhaul user experience and dependency resolver in pip (2020).

Categories: FLOSS Project Planets

Akademy 2021 – Call for Participation!

Planet KDE - Tue, 2021-04-13 05:57

By Allyson Alexandrou

Akademy will be held online from 18th to 25th June and the Call for Participation is open! Submit your talk ideas and abstracts by 2nd May.

While all talk topics are welcome, here are a few talk topics specifically relevant to the KDE Community:

  • Topics related to KDE's current Community Goals.
  • KDE In Action: cases of KDE technology in real life.
  • Overview of what is going on in the various areas of the KDE Community.
  • Collaboration between KDE and other Free Software projects.
  • Release, packaging, and distribution of software by KDE.
  • Increasing our reach through efforts such as accessibility, promotion, translation and localization.
  • Improving our governance and processes, community building.
  • Innovations and best practices in the libraries and technologies used by KDE software.
Why should I submit a talk?

KDE is one of the biggest and well-established Free Software communities. Talking at Akademy gives you an audience that will be receptive to your ideas and will also offer you their experience and know-how in return.

As an independent developer, you will gain supporters for your project, the insight of experienced developers, and you may even gain active contributors. As a community leader, you will be able to discuss the hot topics associated with managing large groups of volunteers, such as management, inclusivity and conflict resolution. As a CTO, you will be able to explain your company’s mission, its products and services and benefit from the brainshare of one of the most cutting edge community-based Free Software projects.

How do I get started?

With an idea. Even if you do not know exactly how you will focus it, no worries! Submit some basic details about your talk idea. All abstracts can be edited after the initial submission.

What should my talk abstract or proposal include?

This is a great question! To ensure you get your point across both clearly and comprehensively, your abstract should include uses of your idea or product and show what different groups of people get out of it. For example, how can a company, developer, or even a user benefit from using your app? In what ways can you further their experiences?

If you’re still stuck on where to start or what to talk about, take a look at a brief list of talks given in previous years at Akademy:

You can find more Akademy videos on the KDE's YouTube channel.

Categories: FLOSS Project Planets

Opensource.com: What's new with Drupal in 2021?

Planet Drupal - Tue, 2021-04-13 03:01

The success of open source projects is largely carried by the pillars of the community and group collaborations. Without putting a stake in the ground to achieve strategic initiatives, an open source project can lose focus. Open source strategic initiatives should aim at solving impactful problems through collaboration involving the project's stakeholders.

Categories: FLOSS Project Planets