Feeds

Drupal.org blog: Updated window for Drupal.org login flow deployment

Planet Drupal - Tue, 2024-08-06 20:37

The Drupal Association engineering team is preparing to switch over to our new single sign-on solution for user login. This is an important step in our work to upgrade Drupal.org, and in the future will give you the ability to use your Drupal.org identity in new ways. 

This switchover was previously scheduled for Thursday, 25 July, but unfortunately we had to roll-back that attempt. After pausing for a week to avoid disrupting the Drupal 11 release window, we are ready to try again.

The switch-over is scheduled for:

  • Thursday 8 August - from 9am to 1pm Pacific (16:00-20:00 UTC).

During this window you will not be able to update your Drupal.org profile, and during portions of this window you may not be able to login to Drupal.org, and may not be able to access related services which use your Drupal identity, such as git.drupalcode.org.

Below you'll find the details from our original blog post about how the login experience will look different: 

If you are an existing user

When you click to login or create an account you will be redirected to: accounts.drupal.org 

You will log in with your existing Drupal.org username or email and your current password, and your two factor authentication code if you have TFA enabled.

Once you log in, you will have to change your password.

If you have Two Factor Authentication enabled, you will also have to set up a new seed.

After that, you'll be taken back to Drupal.org as normal. You should be directed back to the path you came from.

If you are creating a new account

When you click 'create account' on Drupal.org you will be taken to the new account creation page: 

After you complete the basic information,  you will be taken to the Drupal.org welcome page to fill out the rest of your user profile.

If you need to change your account information

The majority of your account information will continue to live in your Drupal.org profile, however, some basic account information will now be stored and updated in the Drupal.org SSO system.

When you click to edit your first and last name, username, password, email address, or enable two factor authentication you'll be taken to the account page:

Setting up Two Factor Authentication

This account settings page is also where you can change your Two Factor Authentication settings. You can use the 'Account Security' tab in the sidebar to navigate to the Two Factor setup process:

If you need to reset your password

If you have forgotten your password, you can reset your password from the login page:

You will receive a password reset email from noreply@drupal.org allowing you to change your password.

If you encounter any issues with your account, please contact us at help@drupal.org

We want to thank two of our partners for supporting this project.

Cloud-IAM is our SSO partner. Cloud-IAM is a privacy centric provider of hosted solutions for Keycloak, an open source identity management service. They are enthusiastic supporters of the Drupal community, and would like to offer any site owners and agencies who are looking for their own identity and access management service 10% off, with promo code: DRUPAL10.

Our implementation partner on this project was Tag1Consulting. Tag1Consulting is a global team of Drupal experts working with clients from non-profits to the Fortune 500, and is one of the top contributors to Drupal. They have been the Drupal Association's infrastructure partner for many years. 

Categories: FLOSS Project Planets

ImageX: Exploring the Drupal 11 Release: New Features and Major Enhancements

Planet Drupal - Tue, 2024-08-06 18:50

Authored by Nadiia Nykolaichuk.

Drupal 11.0.0 has been successfully released as a new major Drupal version which is very exciting news for everyone using Drupal or thinking about making the switch! This flexible, accessible, powerful, integration-ready, and secure CMS has transformed even more on the way from Drupal 10 to Drupal 11

Categories: FLOSS Project Planets

Dries Buytaert: Introducing Drupal Starshot's product strategy

Planet Drupal - Tue, 2024-08-06 18:49

I'm excited to share the first version of Drupal Starshot's product strategy, a document that aims to guide the development and marketing of Drupal Starshot. To read it, download the full Drupal Starshot strategy document as a PDF (8 MB).

This strategy document is the result of a collaborative effort among the Drupal Starshot leadership team, the Drupal Starshot Advisory Council, and the Drupal Core Committers. We also tested it with marketers who provided feedback and validation.

Drupal Starshot and Drupal Core

Drupal Starshot is the temporary codename for an initiative that extends the capabilities of Drupal Core. Drupal Starshot aims to broaden Drupal's appeal to marketers and a wider range of project budgets. Our ultimate goal is to increase Drupal's adoption, solidify Drupal's position as a leading CMS, and champion an Open Web.

For more context, please watch my DrupalCon Portland keynote.

It's important to note that Drupal Starshot and Drupal Core will have separate yet complementary product strategies. Drupal Starshot will focus on empowering marketers and expanding Drupal's presence in the mid-market, while Drupal Core will prioritize the needs of developers and more technical users. I'll write more about the Drupal Core product strategy in a future blog post once we have finalized it. Together, these two strategies will form a comprehensive vision for Drupal as a product.

Why a product strategy?

By defining our goals, target audience and necessary features, we can more effectively guide contributors and ensure that everyone is working towards a common vision. This product strategy will serve as a foundation for our development roadmap, our marketing efforts, enabling Drupal Certified Partners, and more.

Drupal Starshot product strategy TL;DR

For the detailed product strategy, please read the full Drupal Starshot strategy document (8 MB, PDF). Below is just a summary.

Drupal Starshot aims to be the gold standard for marketers that want to build great digital experiences.

We'd like to expand Drupal's reach by focusing on two strategic shifts:

  1. Prioritizing Drupal for content creators, marketers, web managers, and web designers so they can independently build websites. A key goal is to empower these marketing professionals to build and manage their websites independently without relying on developers or having to use the command line or an IDE.
  2. Extending Drupal's presence in the mid-market segment, targeting projects with total budgets between $30,000 and $120,000 USD (€25,000 to €100,000).

Drupal Starshot will differentiate itself from competitors by providing:

  1. A thoughtfully designed platform for marketers, balancing ease of use with flexibility. It includes smart defaults, best practices for common marketing tasks, marketing-focused editorial tools, and helpful learning resources.
  2. A growth-oriented approach. Start simple with Drupal Starshot's user-friendly tools, and unlock advanced features as your site grows or you gain expertise. With sophisticated content modeling, efficient content reuse across channels, and robust integrations with other leading marketing technologies, ambitious marketers won't face the limitations of other CMSs and will have the flexibility to scale their site as needed.
  3. AI-assisted site building tools to simplify complex tasks, making Drupal accessible to a wider range of users.
  4. Drupal's existing competitive advantages such as extensibility, scalability, security, accessibility, multilingual support, and more.
Give feedback

The product strategy is a living document, and we value input. We invite you to share your thoughts, suggestions, and questions in the product strategy feedback issue within the Drupal Starshot issue queue.

Get involved

There are many opportunities to get involved with Drupal Starshot, whether you're a marketer, developer, designer, writer, project manager, or simply passionate about the future of Drupal. To learn more about how you can contribute to Drupal Starshot, visit https://drupal.org/starshot.

Thank you

I'd like to thank the Drupal Starshot leadership team, the Drupal Starshot Advisory Council, and the Drupal Core Committers for their input on the strategy. I'm also grateful for the marketers who provided feedback on our strategy, helping us refine our approach.

Categories: FLOSS Project Planets

PyCoder’s Weekly: Issue #641 (Aug. 6, 2024)

Planet Python - Tue, 2024-08-06 15:30

#641 – AUGUST 6, 2024
View in Browser »

Setuptools Breaks Things, Then Fixes Them

This post is Bite Code’s monthly summary, but the lead story happened just days ago. In line with a 7 year old deprecation, setuptools finally removed the ability to call its test command. Many packages promptly broke. The following day the change was undone.
BITE CODE!

How to Write an Installable Django App

In this step-by-step tutorial, you’ll learn how to create an installable Django app. You’ll cover everything you need to know, from extracting your app from a Django project to turning it into a package that’s available on PyPI and installable through pip.
REAL PYTHON

Prod Alerts? You Should be Autoscaling

Let Judoscale solve your scaling issues. We support Django, Flask, and FastAPI, and we also autoscale your Celery and RQ task queues. Traffic spike? Scaled up. Quiet night? Scaled down. Work queue backlog? No problem →
JUDOSCALE sponsor

State of Flask and Pallets in 2024

Talk Python interviews David Lord, the lead maintainer of the Pallets open source organization which is responsible for Flask, Jinja, and Click. They talk about the latest for the org and Flask.
TALK PYTHON podcast

Python 3.13.0 Release Candidate 1 Released

CPYTHON DEV BLOG

Quiz: Python Strings and Character Data

REAL PYTHON

Quiz: How to Use Generators and yield in Python

REAL PYTHON

Articles & Tutorials Tips for Navigating an Issue Tracker on GitHub

Scouring an open source project’s issues can lead to an open source contribution, but there is often an overwhelming amount of issues to sift through. In this article, Stefanie shares her tips for navigating an open source project’s issue tracker to find something to work on.
STEFANIE MOLIN • Shared by Stefanie Molin

Working With JSON Data in Python

In this tutorial, you’ll learn how to read and write JSON-encoded data in Python. You’ll begin with practical examples that show how to use Python’s built-in “json” module and then move on to learn how to serialize and deserialize custom data.
REAL PYTHON

Simulate a Text File in Python

Testing an application that reads files from a disk can be complicated. It may depend on the machine, require special access, or be frustratingly slow. This course shows you how to simulate a text file using Python to simplify testing.
REAL PYTHON course

How I Use Python to Organize My Data Analyses

This is a description of how Joshua uses Python in a package-centric way to organize his approach to data analyses. This is a system he has evolved while working on his computational biology Ph.D. and working in industry.
JOSHUA COOK • Shared by Joshua Cook

Python String Formatting: Available Tools and Their Features

In this tutorial, you’ll learn about the main tools for string formatting in Python, as well as their strengths and weaknesses. These tools include f-strings, the .format() method, and the modulo operator.
REAL PYTHON

Why Does python -M json Not Work? Why Is It json.tool?

Python’s json.tool command-line interface pretty prints your JSON. Have you ever wondered why it is in json.tool instead of the module directly? This article explains the history behind this module.
TREY HUNNER

PSF Bylaws Change

Recently, the PSF board was alerted to a flaw in the bylaws that could expose the foundation to unbounded financial liability. As such, a board driven change has been instituted.
PYTHON SOFTWARE FOUNDATION

Fear of Over-Engineering Has Killed Engineering Altogether

This opinion piece outlines why the culture of rapid delivery has eroded quality engineering. It talks about how we got where we are and what should be done instead.
PAO RAMEN

Tracing the Evolution of a Python Function With git log

The git log command has arguments you can use to examine just part of a commit. This article shows you how to trace the changes to a single Python function.
JOËL PERRAS

tea-tasting: Statistical Analysis of A/B Tests

This post introduces you to the new tea-tasting project that lets you do statistical analysis on your A/B tests.
EVGENY IVANOV

Projects & Code pygamelib: Text-Mode Game Development With Python

GITHUB.COM/PYGAMELIB

git-authorship: Who Wrote Each Line in Your Repo

GITHUB.COM/THEHALE

saa: Translate Times Into Spoken Expressions

GITHUB.COM/PROTEUSIQ

python-vendorize: Vendorize Packages From PyPI

GITHUB.COM/MWILLIAMSON

django-slick-reporting: Dashboard and Reporting Engine

GITHUB.COM/RAMEZISSAC

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

August 7, 2024
REALPYTHON.COM

Python Atlanta

August 8 to August 9, 2024
MEETUP.COM

Python Nordeste 2024

August 9 to August 11, 2024
PYTHONNORDESTE.ORG

Python Communities

August 10 to August 11, 2024
NOKIDBEHIND.ORG

PyDelhi User Group Meetup

August 10, 2024
MEETUP.COM

DFW Pythoneers 2nd Saturday Teaching Meeting

August 10, 2024
MEETUP.COM

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

Acquia Developer Portal Blog: Changing to Drupal and Maintaining Search Engine Rankings

Planet Drupal - Tue, 2024-08-06 14:55

So you’ve decided to change to Drupal, or maybe you are making a major upgrade from a really old version of Drupal to a more modern one and you are concerned about your SEO.

Changing content management systems will impact your search engine optimization (SEO), but with careful consideration and planning this can be a positive change rather than a negative one.

What is SEO

There are many misconceptions about search engine optimization, and part of that is because the industry has often been cast in a negative light. Really SEO is the process of making sure your website meets certain guidelines and standards so search engines can understand its content, relevance, and value to users.

Categories: FLOSS Project Planets

GUAC adopts license metadata from ClearlyDefined

Open Source Initiative - Tue, 2024-08-06 12:23

The software supply chain just gained some transparency thanks to an integration of the Open Source Initiative (OSI) project, ClearlyDefined, into GUAC (Graph for Understanding Artifact Composition), an OpenSSF project from the Linux Foundation. GUAC provides a comprehensive mapping of software packages, dependencies, vulnerabilities, attestations, and more, allowing organizations to achieve better compliance and security of their software supply chain.

GUAC offers the full view of the supply chain

Software supply chain attacks are on the rise. Many tools are available to help generate software bills of materials (SBOMs), signed attestations and vulnerability reports, but they stop there, leaving users to figure out how they all fit together. GUAC provides an aggregated, queryable view across the whole software supply chain, not just one SBOM at a time.

GUAC is for developers, operations and security practitioners who need to identify and address problems in their software supply chain, including proactively managing dependencies and responding to vulnerabilities. GUAC provides supply chain observability with a graph view of the software supply chain and tools for performing queries to gain actionable insights.

GUAC enhanced with ClearlyDefined integration

The latest version of GUAC (v0.8.0) now provides support for ClearlyDefined. GUAC will query the ClearlyDefined license metadata store to discover license information for packages, even when the SBOM does not include that information.

A ClearlyDefined certifier will listen on collector-subscriber for any pkg/src strings, then convert to ClearlyDefined coordinates, then query the API service for the definition. The user agent will be the same as existing outgoing GUAC requests GUAC/<version> (e.g. GUAC/v0.1.0).

A CertifyLegal node will be created using the “licensed” “declared” field from the definition. The expression will be copied and any license identifiers found will result in linked License noun nodes, created if needed. Type will be “declared”. Justification will be “Retrieved from ClearlyDefined”. Time will be the current time the information was retrieved from the API.

Similarly a node will be created using the “licensed” “facets” “core” “discovered” “expressions” field. Multiple expressions will be “AND”ed together. Type will be “discovered”, and other fields the same (Time, Justification, License links, etc).

The “licensed” “facets” “core” “attribution” “parties” array will be concatenated and stored in the Attribution field on CertifyLegal.

Optionally, “described” “sourceLocation” can be used to create a HasSourceAt GUAC node.

Thanks to the community

Although licenses don’t directly impact security, they are an important part of understanding the software supply chain. We would like to thank Parth Patel (Kusari), Jeff Mendoza (Kusari), Ben Cotton (Kusari), and Qing Tomlinson (SAP) for their support to get this feature implemented in GUAC. The ClearlyDefined community looks forward to working together with the GUAC community to help organizations worldwide to better achieve compliance and security of their software supply chain.

Categories: FLOSS Research

The Drop Times: Resurrected with Resilience: Dallas Ramsden's Drupal Legacy

Planet Drupal - Tue, 2024-08-06 10:18
In an exclusive interview with Elma John from The DropTimes, Dallas Ramsden, CEO and Solutions Architect at Xequals and Drupal Services Specialist at Sparks Interactive, shares his incredible 16-year journey with Drupal. From surviving a life-threatening accident to becoming a beacon of resilience and a dedicated Drupal veteran, Dallas discusses his passion for the platform, his transition to teaching, and his vision for the future of Drupal and technology. Join us to learn from this inspiring story of determination, community building, and lifelong learning.
Categories: FLOSS Project Planets

Drupal Association blog: Preparing for Drupal 7 End of Life: Key Steps to Take Now

Planet Drupal - Tue, 2024-08-06 10:00

As the end-of-life (EOL) for Drupal 7 approaches on 5 January 2025, site owners must adequately prepare to guarantee their websites' continued security, functionality, and compliance. Here, we outline the key steps to navigate this transition smoothly.

1. Conduct a Comprehensive Site Audit

A thorough site audit is the first step in preparing for Drupal 7's EOL. This process involves:

  • Inventorying Content and Modules: List all content types, modules, themes, and custom code currently in use.

  • Assessing Module Usage: Identify which modules are essential and which can be replaced or eliminated.

  • Checking for Unsupported Modules: Determine if any modules are already unsupported and look for alternative solutions.

  • Evaluating Performance: Analyze site performance to identify any bottlenecks or issues that need addressing during the migration.

2. Plan Your Migration Strategy

With a clear understanding of your site's current state, the next step is to plan your migration strategy. Key considerations include:

  • Choosing the Right Drupal Version: While Drupal 11 is the latest version, you may need to evaluate if an interim upgrade to Drupal 10 is more feasible.

  • Timeline and Budget: Estimate the time and resources required for the migration. Consider factors such as the complexity of your site, the number of custom modules, and the need for design changes.

  • Engaging Stakeholders: Communicate the migration plan with all relevant stakeholders, including developers, content creators, and business leaders, to ensure alignment and support.

  • Extended Long-Term Support: If your migration plan has an unsupported gap, consider utilizing HeroDevs Drupal 7 Never-Ending Support, a secure drop-in replacement for Drupal 7. HeroDevs’ service provides security, compliance, and compatibility updates as you plan your migration. As additional partners join the program, options will be listed in the Migration Resource Center.

3. Select a Certified Migration Partner

Migrating from Drupal 7 to a newer version is a complex task that often requires professional assistance. Selecting a certified migration partner who will provide the expertise and experience needed to ensure a successful transition. Look for partners who:

  • Have Proven Experience: Check for case studies or references from similar migration projects.

  • Offer Comprehensive Services: Ensure they can handle all aspects of the migration, from planning and execution to post-migration support.

  • Understand Your Industry: Partners familiar with your industry can provide more tailored solutions and insights.

4. Update Your Hosting Environment

Ensure your hosting environment is ready for the new Drupal version. This may involve:

  • Upgrading PHP and MySQL Versions: Verify that your hosting provider supports the PHP and MySQL versions required by your new version of Drupal

  • Evaluating Server Performance: Ensure your server infrastructure can handle the new site's requirements, especially if you expect increased traffic or enhanced functionality.

  • Considering a New Hosting Provider: If your current provider doesn't meet the requirements, consider migrating to a provider specializing in hosting Drupal sites.

5. Backup and Test

Before starting the migration, create a full backup of your site. This ensures you have a fallback option in case anything goes wrong. Additionally, set up a testing environment to:

  • Run Migration Tests: Perform a dry run of the migration process to identify and resolve potential issues.

  • Validate Functionality: Test all aspects of the site, including custom modules and integrations, to ensure everything works as expected post-migration.

  • User Acceptance Testing (UAT): Engage end-users to test the site and provide feedback on any usability or functionality issues.

6. Execute the Migration

With all preparations in place, proceed with the migration. Follow a phased approach to minimize disruption:

  • Migrate in Stages: Consider migrating in stages, starting with less critical sections of the site to ensure a smooth transition.

  • Monitor Progress: Continuously monitor the migration process to quickly address any issues that arise.

  • Communicate Changes: Keep all stakeholders informed about the migration progress and any potential downtime or changes.

7. Post-Migration Steps

After the migration, there are a few additional steps to ensure long-term success:

  • Conduct a Final Site Audit: Verify that all content, modules, and functionality have been successfully migrated and are working correctly.

  • Optimize Performance: Implement performance optimizations to ensure the new site runs efficiently.

  • Plan for Ongoing Maintenance: Establish a plan for regular updates, backups, and security monitoring to keep the site secure and up-to-date.

Conclusion

Preparing for Drupal 7's end-of-life requires careful planning and execution. By conducting a comprehensive site audit, planning your migration strategy, selecting a certified migration partner, updating your hosting environment, and following through with testing and execution, you can ensure a smooth transition to a more modern, secure, and efficient version of Drupal. Taking these steps now will help future-proof your website and provide a solid foundation for continued success.

Categories: FLOSS Project Planets

Real Python: Interacting With REST APIs and Python

Planet Python - Tue, 2024-08-06 10:00

There’s an amazing amount of data available on the Web. Many web services, like YouTube and GitHub, make their data accessible to third-party applications through an application programming interface (API). One of the most popular ways to build APIs is the REST architecture style. Python provides some great tools not only to get data from REST APIs but also to build your own Python REST APIs.

In this video course, you’ll learn:

  • What REST architecture is
  • How REST APIs provide access to web data
  • How to consume data from REST APIs using the requests library
  • What steps to take to build a REST API
  • What some popular Python tools are for building REST APIs

[ 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

FSF Events: Free Software Directory meeting on IRC: Friday, August 9, starting at 12:00 EDT (16:00 UTC)

GNU Planet! - Tue, 2024-08-06 09:51
Join the FSF and friends on Friday, August 9 from 12:00 to 15:00 EDT (16:00 to 19:00 UTC) to help improve the Free Software Directory.
Categories: FLOSS Project Planets

Django Weblog: Django security releases issued: 5.0.8 and 4.2.15

Planet Python - Tue, 2024-08-06 09:39

In accordance with our security release policy, the Django team is issuing releases for Django 5.0.8 and Django 4.2.15. These releases address the security issues detailed below. We encourage all users of Django to upgrade as soon as possible.

CVE-2024-41989: Memory exhaustion in django.utils.numberformat.floatformat()

The floatformat template filter is subject to significant memory consumption when given a string representation of a number in scientific notation with a large exponent.

Thanks to Elias Myllymäki for the report.

This issue has severity "moderate" according to the Django security policy.

CVE-2024-41990: Potential denial-of-service in django.utils.html.urlize()

The urlize() and urlizetrunc() template filters are subject to a potential denial-of-service attack via very large inputs with a specific sequence of characters.

Thanks to MProgrammer for the report.

This issue has severity "moderate" according to the Django security policy.

CVE-2024-41991: Potential denial-of-service vulnerability in django.utils.html.urlize() and AdminURLFieldWidget

The urlize and urlizetrunc template filters, and the AdminURLFieldWidget widget, are subject to a potential denial-of-service attack via certain inputs with a very large number of Unicode characters.

Thanks to Seokchan Yoon for the report.

This issue has severity "moderate" according to the Django security policy.

CVE-2024-42005: Potential SQL injection in QuerySet.values() and values_list()

QuerySet.values() and values_list() methods on models with a JSONField are subject to SQL injection in column aliases via a crafted JSON object key as a passed *arg.

Thanks to Eyal Gabay of EyalSec for the report.

This issue has severity "moderate" according to the Django security policy.

Affected supported versions
  • Django main branch
  • Django 5.1 (currently at release candidate status)
  • Django 5.0
  • Django 4.2
Resolution

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

CVE-2024-41989: Memory exhaustion in django.utils.numberformat.floatformat() CVE-2024-41990: Potential denial-of-service in django.utils.html.urlize() CVE-2024-41991: Potential denial-of-service vulnerability in django.utils.html.urlize() and AdminURLFieldWidget CVE-2024-42005: Potential SQL injection in QuerySet.values() and values_list() The following releases have been issued

The PGP key ID used for this release is Sarah Boyce: 3955B19851EA96EF

General notes regarding security reporting

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

Categories: FLOSS Project Planets

Stefanie Molin: Common Pre-Commit Errors and How to Solve Them

Planet Python - Tue, 2024-08-06 08:00
Having issues with your `pre-commit` setup? In this troubleshooting guide, I've collected the most common errors `pre-commit` users face and provided explanations and guidance for fixing them.
Categories: FLOSS Project Planets

Daniel Roy Greenfeld: TIL: Parsing messy datetimes strings

Planet Python - Tue, 2024-08-06 06:37

How to convert inconsistent datetime strings into datetime objects.

Recently I've been working on yet another rewrite of my blog, this time to FastHTML. Thanks to the power and ease of that framework, that took about 45 minutes to replicate all the web pages of my blog. Wahoo!

Alas, the atom/rss feeds took quite a bit longer.

For the atom/rss feeds I chose to use the venerable Feedgen library. The challenge there is that Feedgen is rightfully particular about the datetime objects it accepts. And over the years as this site has had 650 posts added the timestamps have become rather inconsistent in their format. On that issue I fully blame the author, who unfortunately is me.

In any case, I wrote a little Python function that handles it in a timezone aware way using the dateutils.parser() functon that I learned.

# Python stdlib from datetime import datetime from dateutils import parser # You'll need to install the pytz dependency import pytz def convert_dtstr_to_dt(date_str: str) -> datetime: """ Convert a naive or non-naive date/datetime string to a datetime object. Naive datetime strings are assumed to be in GMT (UTC) timezone. """ try: dt = parser.parse(date_str) if dt.tzinfo is None: # If the datetime object is naive, set it to GMT (UTC) dt = dt.replace(tzinfo=pytz.UTC) return dt except (ValueError, TypeError) as e: Raise Exception(f"Error parsing date string: {e}")

Original source code here.

Note: As of publishing, this article is still on my old blog. The DNS switchover to the FastHTML version of my blog happens later this week.

Categories: FLOSS Project Planets

Specbee: How to split configurations across different sites in Drupal 10

Planet Drupal - Tue, 2024-08-06 04:59
Configuration management is one of the best features introduced in Drupal. It allows developers to easily push configuration changes from development to staging, and finally to production environments. However, some configurations are environment-specific. For instance, modules like Devel, Kint, Views UI, and Google Tag are only enabled in development environments and not in production. Fortunately, the Configuration Split module offers a solution by storing configurations in a separate directory, allowing for environment-specific imports. In this article, you'll learn how to split configurations across different websites using this powerful Drupal 10 module. Setup and using the Configuration Split module Installing the Drupal Configuration Split module is like installing any other contributed module. Use composer to install it since it automatically installs all the necessary dependencies. Open the terminal, within the project and enter the command. $ composer require drupal/config_splitCreate the split configuration Once installed and enabled, we can create one or more "splits" to keep our configuration file in a separate folder. Go to Admin > Configuration > Development > Configuration Split Settings Click Add Configuration Split Setting Enter a Label In the folder field, enter the folder name relative to the Docroot. The path will specify the folder inside which the split configurations should be stored. ../config/dev_splitMake sure the machine name of your split is the same as the folder name. You can keep the split active or inactive by default. These settings can be overridden by settings.php. Choose the module you want to split. In our case – the Devel Module. Since we are pushing the module to a separate config split folder, We have to partially split core.extension.yml file, which stores information about what modules must be installed on your site. Click Save. The config files of the selected module will also be sent to the same folder once you export the config split. The module also enables users to select any particular config file to be split. Activate a Split Once the split is created, it needs to be activated to carry out a split. The Drupal 10 Configuration Split module does not provide a UI for this purpose, but instead, we can modify our settings.php file to activate the split: $config['config_split.config_split.dev_split']['status'] = TRUE;Where, dev_split is the machine name of the split we created earlier. Now, export your configuration using drush cex. You can see the config_split settings getting updated and the module getting removed from your core.extension file, along with respective settings files. To export the configs selected in the dev_split, you have to run a different command, i.e. drush config-split: export “split_name”In our case it would be, drush config-split:export dev_split. Now you can see the files selected in dev_split getting exported to the dev_split directory.  For our Development split, we need to have it activated in the development environment, but not in production. To do so, we add the following to our settings.php on our development environment. $config['config_split.config_split.development']['status'] = TRUE; For the Production site we won't add this code in the settings file, or we can also disable it explicitly by using below code: config['config_split.config_split.development']['status'] = FALSE;Activate split based on environment You can also specify which split should be active in a certain environment by adding a condition in settings.php as shown below: if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {    switch ($_ENV['AH_SITE_ENVIRONMENT'])    {      case 'develop':     $config['config_split.config_split.dev_split']['status'] = TRUE;     break;      case 'live':     $config['config_split.config_split.prod_split']['status'] = TRUE;     break;    }  }The above code will activate dev_split in the development (‘develop’) environment and prod_split in the production (‘live’) environment. Final Thoughts The Configuration Split Module is a fantastic feature introduced in Drupal’s configuration management. By splitting up configurations based on environments, you can use the module only in certain environments, based on your needs. We hope you found this article helpful. For more interesting articles on Drupal and everything technology, please bookmark our blog and come back for more!
Categories: FLOSS Project Planets

Akansha Tech Journal: Inside the Codebase: A Deep Dive into Drupal Rag Integration

Planet Drupal - Tue, 2024-08-06 04:27
Welcome back to our simple guide on Drupal Rag Integration. Our earlier introduction got you excited, and we couldn't be happier—thank you! Now, let's get into how the code behind the app makes your website smart and user-friendly. We'll explore how everything from adding new info to your site to answering user questions works with just a few clicks. This tool is great for anyone who wants a website that stays up-to-date and talks back.
Categories: FLOSS Project Planets

Python Bytes: #395 pythont compatible packages

Planet Python - Tue, 2024-08-06 04:00
<strong>Topics covered in this episode:</strong><br> <ul> <li><strong><a href="https://py-free-threading.github.io?featured_on=pythonbytes">py-free-threading.github.io</a></strong></li> <li><strong><a href="https://pyfound.blogspot.com/2024/07/pythons-supportive-and-welcoming.html?featured_on=pythonbytes">Python’s Supportive and Welcoming Environment is Tightly Coupled to Its Progress</a></strong></li> <li><strong><a href="https://uptimekuma.talkpython.fm/status/talk-python?featured_on=pythonbytes">Status pages for sites</a>!</strong></li> <li><strong><a href="https://peps.python.org/pep-0751?featured_on=pythonbytes">PEP 751 – A file format to list Python dependencies for installation reproducibility</a></strong></li> <li><strong>Extras</strong></li> <li><strong>Joke</strong></li> </ul><a href='https://www.youtube.com/watch?v=Ay2u2UoTfmE' style='font-weight: bold;'data-umami-event="Livestream-Past" data-umami-event-episode="395">Watch on YouTube</a><br> <p><strong>About the show</strong></p> <p>Sponsored by us! Support our work through:</p> <ul> <li>Our <a href="https://training.talkpython.fm/?featured_on=pythonbytes"><strong>courses at Talk Python Training</strong></a></li> <li><a href="https://courses.pythontest.com/p/the-complete-pytest-course?featured_on=pythonbytes"><strong>The Complete pytest Course</strong></a></li> <li><a href="https://www.patreon.com/pythonbytes"><strong>Patreon Supporters</strong></a></li> </ul> <p><strong>Connect with the hosts</strong></p> <ul> <li>Michael: <a href="https://fosstodon.org/@mkennedy"><strong>@mkennedy@fosstodon.org</strong></a></li> <li>Brian: <a href="https://fosstodon.org/@brianokken"><strong>@brianokken@fosstodon.org</strong></a></li> <li>Show: <a href="https://fosstodon.org/@pythonbytes"><strong>@pythonbytes@fosstodon.org</strong></a></li> </ul> <p>Join us on YouTube at <a href="https://pythonbytes.fm/stream/live"><strong>pythonbytes.fm/live</strong></a> to be part of the audience. Usually Tuesdays at 10am PT. Older video versions available there too.</p> <p>Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to <a href="https://pythonbytes.fm/friends-of-the-show">our friends of the show list</a>, we'll never share it.</p> <p><strong>Michael #1:</strong> <a href="https://py-free-threading.github.io?featured_on=pythonbytes">py-free-threading.github.io</a></p> <ul> <li>Track the status of compatibility for free-threaded Python </li> <li>See the <a href="https://py-free-threading.github.io/tracking/?featured_on=pythonbytes">Compatibility status tracking page</a> for what you can use</li> <li>Lots of resources for getting your package tested and available for <em>pythont</em></li> </ul> <p><strong>Brian #2:</strong> <a href="https://pyfound.blogspot.com/2024/07/pythons-supportive-and-welcoming.html?featured_on=pythonbytes">Python’s Supportive and Welcoming Environment is Tightly Coupled to Its Progress</a></p> <ul> <li>“Python is as popular as it is today because we have gone above and beyond to make this a welcoming community. Being a friendly and supportive community is part of how we are perceived by the wider world and is integral to the wide popularity of Python. We won a “Wonderfully Welcoming Award” last year at GitHub Universe. Over and over again, the tech press refers to Python as a supportive community.”</li> <li>Some communication recently, with the recent bylaws change, didn’t live up to our promise to be welcoming</li> <li>Please read the article for more details.</li> <li>Another quote: “We have a moral imperative – as one of the very best places to bring new people into tech and into open source – to keep being good at welcoming new people. If we do not rise and continue to rise every day to this task, then we are not fulfilling our own mission, “to support and facilitate the growth of a diverse and international community of Python programmers.” Technical skills are a game-changer for the people who acquire them and joining a vast global network of people with similar interests opens many doors. Behavior that contributes to a hostile environment around Python or throws up barriers and obstacles to those who would join the Python community must be addressed because it endangers what we have built here.”</li> </ul> <p><strong>Michael #3:</strong> <a href="https://uptimekuma.talkpython.fm/status/talk-python?featured_on=pythonbytes">Status pages for sites</a>!</p> <ul> <li>Based on <a href="https://uptime.kuma.pet?featured_on=pythonbytes">Uptime Kuma</a> I covered last week</li> <li><a href="https://uptimekuma.talkpython.fm/status/python-bytes?featured_on=pythonbytes">Python Bytes</a> status</li> <li><a href="https://uptimekuma.talkpython.fm/status/talk-python?featured_on=pythonbytes">Talk Python</a> status</li> </ul> <p><strong>Brian #4:</strong> <a href="https://peps.python.org/pep-0751?featured_on=pythonbytes">PEP 751 – A file format to list Python dependencies for installation reproducibility</a></p> <ul> <li>Brett Cannon</li> <li>Motivation <ul> <li>Currently, no standard exists to: <ul> <li>Specify what top-level dependencies should be installed into a Python environment.</li> <li>Create an immutable record, such as a lock file, of which dependencies were installed.</li> </ul></li> <li>Considering there are at least five well-known solutions to this problem in the community (pip freeze, <a href="https://pypi.org/project/pip-tools/?featured_on=pythonbytes">pip-tools</a>, <a href="https://github.com/astral-sh/uv?featured_on=pythonbytes">uv</a>, <a href="https://python-poetry.org/?featured_on=pythonbytes">Poetry</a>, and <a href="https://pypi.org/project/pdm/?featured_on=pythonbytes">PDM</a>), there seems to be an appetite for lock files in general.</li> </ul></li> <li>Rationale <ul> <li>The format is designed so that a <em>locker</em> which produces the lock file and an <em>installer</em> which consumes the lock file can be separate tools. …</li> <li>The file format is designed to be human-readable. …Finally, the format is designed so that viewing a diff of the file is easy by centralizing relevant details.</li> <li>The file format is also designed to not require a resolver at install time. …</li> </ul></li> </ul> <p><strong>Extras</strong> </p> <p>Brian:</p> <ul> <li><a href="https://courses.pythontest.com?featured_on=pythonbytes">Hello, pytest! </a>course is going well, and is purchasable as in pre-release mode. <ul> <li>Planning on Aug 19 (or before) deadline.</li> <li>Not sure what the final price will be, but I’m starting with $10. <ul> <li>I want people to want to watch it even just so see if they want to recommend to co-workers so the people around them can ramp up on pytest quickly.</li> </ul></li> </ul></li> </ul> <p>Michael:</p> <ul> <li><a href="https://mypy-lang.blogspot.com/2024/07/mypy-111-released.html?featured_on=pythonbytes">Mypy 1.11 Released</a></li> <li><a href="https://fastht.ml?featured_on=pythonbytes">FastHTML</a> (more next week)</li> <li>Coming up on the final chance to be part of <a href="https://codeinacastle.com/python-zero-to-hero-2024?utm_source=pythonbytes">the Code in a Castle event</a>.</li> </ul> <p><strong>Joke:</strong> <a href="https://devhumor.com/media/open-ai?featured_on=pythonbytes">Open source OpenAI?</a></p>
Categories: FLOSS Project Planets

Akademy 2024 T-shirt online orders now open & in-person extended

Planet KDE - Tue, 2024-08-06 02:15

Orders for the Akademy 2024 T-shirt for those attending online are now open till 29th September, these will be shipped after Akademy. For those attending in person the order deadline has been extended till Sunday 11th

Full details are on the Akademy 2024 T-shirt page

  Mockup of Akademy 2024 T-shirt by Jens Reuterberg  
Categories: FLOSS Project Planets

Mike Driscoll: Create Amazing Progress Bars in Python with alive-progress

Planet Python - Mon, 2024-08-05 21:44

Have you ever needed a progress bar in your Python command-line application? One great way of creating a progress bar is to use the alive-progress package created by Rogério Sampaio de Almeida! Alive progress provides multiple different types of progress bars in your terminal or IPython REPL session. The alive progress package will work with any iterable, from lists to querysets, and more.

Let’s spend a little time learning how the alive-progress package works!

Installation

Installing the alive-progress package is easy using the pip installer utility. Here is the command you should use in your terminal:

python -m pip install alive-progress

Pip will install the package and any dependencies it needs. The pip tool shouldn’t take very long to install alive-progress.

Example Usage

The alive-progress package comes with a great demo that you can use to see all the different types of progress bars that the package supports. Open up a Python REPL and run the following code:

from alive_progress.styles import showtime showtime()

When you run this code, you will see something similar to the following:

There is another alive-progress demo that is a little different from the one above. You don’t need to use a Python REPL to run it though. Instead, you can open up your terminal application and run the following command:

python -m alive_progress.tools.demo

When you run this command, you will see something like this:

https://www.blog.pythonlibrary.org/wp-content/uploads/2024/08/alive_demo.mp4

The alive-progress GitHub page also shows several different code examples that demonstrate how to use alive-progress in your code. Here is one of the examples:

from alive_progress import alive_bar import time for x in 1000, 1500, 700, 0: with alive_bar(x) as bar: for i in range(1000): time.sleep(.005) bar()

Here you loop over four different integer values and create a progress bar for each of them. Then you loop over a range of one thousand and the progress bars will run through to completion.

When you run this code in your terminal, you will see this output:

Check out the GitHub repository for more fun examples!

Wrapping Up

The alive-progress package is lots of fun. You can add progress bars to any of your regular Python scripts and see them visually in your applications. This can be especially useful for command-line utilities that you create as they will show the user how far along they are in processing the data.

Download the package and start tinkering today!

The post Create Amazing Progress Bars in Python with alive-progress appeared first on Mouse Vs Python.

Categories: FLOSS Project Planets

Pages