Feeds

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

KDE Plasma 6.1.4, Bugfix Release for August

Planet KDE - Mon, 2024-08-05 20:00

Tuesday, 6 August 2024. Today KDE releases a bugfix update to KDE Plasma 6, versioned 6.1.4.

Plasma 6.1 was released in June 2024 with many feature refinements and new modules to complete the desktop experience.

This release adds three weeks' worth of new translations and fixes from KDE's contributors. The bugfixes are typically small but important and include:

  • DrKonqi: Use frameworks version number from kcrash. Commit.
  • KWin: Fix sticky keys for AltGr. Commit. See bug #444335
  • [kcms/access] Set range for visual bell duration selector. Commit.
View full changelog
Categories: FLOSS Project Planets

Trey Hunner: Quickly find the right datetime format code for your date

Planet Python - Mon, 2024-08-05 14:30

I often find myself with a string representing a date and time and the need to create a format string that will parse this string into a datetime object.

I decided to make a tool that solves this problem for me: https://pym.dev/strptime

Finding the code to parse a date format with strptime

Here’s how I’m now using this new tool.

I find a date string in a random spreadsheet or log file that I need to parse. For example, the string 30-Jun-2024 20:09, which I recently found in a spreadsheet.

I then paste the string into the tool and watch the format appear:

Then I click on the date format to copy-paste it. That’s it!

This tool works by cycling through a number of common formats. It also works for dates without a time, like Jul 1, 2024.

This input field works great when you’re in need of a code for the datetime class’s strptime method (which parses dates). But what if you need a code for strftime (for formatting dates)?

Finding the code to format a date with strftime

If you don’t have a date but instead want to construct a date in a specific common format, scroll down the page a bit.

This page includes a table of common formats.

Click on the format to copy it. That’s it.

Playing with format codes

What if you have a date format already but you’re not sure what it represents?

Paste it in the box!

For example if you’re wondering what the %B in %B %d, %Y means, paste it in to see what that represent with the current date and time:

Other features

There are a few other hidden features in this tool:

  • After a date or date format is pasted, if it corresponds to one of the formats listed in the table of common formats, that row will be highlighted
  • Hitting the Enter key anywhere on the page will select the input field
  • Clicking on a date within the format table will fill that date into the input box
  • The bottom of the page includes links to other useful datetime formatting/parsing tools as well as a link to the relevant Python documentation
Thoughts? Feature requests?

What do you think of this tool?

Is this something you’d bookmark and use often? Is this missing a key feature that you would need for it to be valuable for your use?

Are there date and time formats you’d like to see that don’t seem to be supported yet?

Comment or email me to let me know!

Categories: FLOSS Project Planets

Talking Drupal: Talking Drupal #462 - DrupalCon Singapore

Planet Drupal - Mon, 2024-08-05 14:00

Today we are talking about DrupalCon Singapore, What you can expect, and What’s next for Drupal in Asia with guest Mike Richardson & Surabhi Gokte. We’ll also cover Filefield Paths as our module of the week.

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

Topics
  • When is Drupalcon Asia
  • The last one was in 2016, what did it take to reprise
  • How do you handle language barriers
  • What are your roles in the organizing committee
  • Steering committee and Drupal South
  • What can attendees expect
  • Any special programming
  • What kind of diversity is expected from attendees
  • Driving from Mumbai to Singapore is 110 hours
  • Will Dries be there
  • Can we expect future Drupalcon Asia's
  • Planning and logistics regarding coffee
  • Starshot
Resources Guests

Mike Richardson - Singapore DrupalCon richo_au Surabhi Gokte - surabhi-gokte

Hosts

Nic Laflin - nLighteneddevelopment.com nicxvan John Picozzi - epam.com johnpicozzi Josh Miller - joshmiller

MOTW Correspondent

Martin Anderson-Clutz - mandclu.com mandclu

  • Brief description:
    • Have you ever wanted to use a variety of tokens to customize the directory and file names of your uploaded files? There’s a module for that.
  • Module name/project name:
  • Brief history
    • How old: created in July 2008 by Stuart Clark (Deciphered), though recent releases are by Oleh Vehera (voleger) of Golems GABB
    • Versions available: 7.x-1.2 and 8.x-1.0-beta7, the latter of which supports Drupal 9.3 or newer, and Drupal 10
  • Maintainership
    • Seeking co-maintainers
    • Security Coverage
      • Opted in, but no coverage in practice for Drupal 9 or 10
    • Test coverage
    • Number of open issues: 131 open issues, 50 of which are bugs against the current branch
  • Usage stats:
    • 34,609 sites almost 35,000 sites
  • Module features and usage
    • This module allows you to customize file names and paths by leveraging a variety of entity-based tokens
    • It also integrates with the Pathauto module, giving you options to clean up the tokens for example by removing slashes, filtering out words or punctuation, and so on
    • It can also work with the Transliteration module to convert unicode characters into US-ASCII
    • Filefield Paths has options to rename and move existing files, and can retroactively rename files, effectively bulk updating and moving all your existing files
    • It can also work with the Redirect module to automatically create redirects from the old path and filename to the new location, when renaming
    • I’d also like to give a tip of the cap to Jim Birch of Kanopi for suggesting this module, when I was talking to a customer who was looking to achieve pretty much exactly what this module does
Categories: FLOSS Project Planets

Pages