Feeds
Django Weblog: Django 5.1 beta 1 released
Django 5.1 beta 1 is now available. It represents the second stage in the 5.1 release cycle and is an opportunity for you to try out the changes coming in Django 5.1.
Django 5.1 brings a kaleidoscope of improvements which you can read about in the in-development 5.1 release notes.
Only bugs in new features and regressions from earlier versions of Django will be fixed between now and the 5.1 final release. Translations will be updated following the "string freeze", which occurs when the release candidate is issued. The current release schedule calls for a release candidate in a month from now, and a final release to follow about two weeks after that, scheduled for August 7th.
Early and frequent testing from the community will help minimize the number of bugs in the release. Updates on the release schedule are available on the Django forum.
As with all alpha and beta packages, this is not for production use. But if you'd like to take some of the new features for a spin, or to help find and fix bugs (which should be reported to the issue tracker), you can grab a copy of the beta package from our downloads page or on PyPI.
The PGP key ID used for this release is Natalia Bidart: 2EE82A8D9470983E.
Real Python: Understanding the Python Mock Object Library
Python’s unittest.mock library is a tool that helps you create mock objects to simulate complex logic and unpredictable dependencies. This helps you write valuable tests that verify your application logic is correct, reliable, and efficient.
By the end of this tutorial, you’ll be able to:
- Create Python mock objects using Mock
- Assert that you’re using objects as you intended
- Inspect usage data stored on your Python mocks
- Configure certain aspects of your Python mock objects
- Substitute your mocks for real objects using patch()
- Avoid common problems inherent in Python mocking
You’ll begin by learning about what mocking is and how you can use it to improve your tests.
Get Your Code: Click here to download the free sample code that you’ll use to learn about Python’s mock object library.
Take the Quiz: Test your knowledge with our interactive “Understanding the Python Mock Object Library” quiz. You’ll receive a score upon completion to help you track your learning progress:
Interactive Quiz
Understanding the Python Mock Object LibraryIn this quiz, you'll test your understanding of Python's unittest.mock library. With this knowledge, you'll be able to write robust tests, create mock objects, and ensure your code is reliable and efficient.
What Is Mocking?A mock object substitutes and imitates a real object within a testing environment. Using mock objects is a versatile and powerful way to improve the quality of your tests. This is because by using Python mock objects, you can control your code’s behavior during testing.
For example, if your code makes HTTP requests to external services, then your tests execute predictably only so far as the services are behaving as you expected. Sometimes, a temporary change in the behavior of these external services can cause intermittent failures within your test suite.
Because of this, it would be better for you to test your code in a controlled environment. Replacing the actual request with a mock object would allow you to simulate external service outages and successful responses in a predictable way.
Sometimes, it’s difficult to test certain areas of your codebase. Such areas include except blocks and if statements that are hard to satisfy. Using Python mock objects can help you control the execution path of your code to reach these areas and improve your code coverage.
Another reason to use mock objects is to better understand how you’re using their real counterparts in your code. A Python mock object contains data about its usage that you can inspect, such as:
- If you called a method
- How you called the method
- How often you called the method
Understanding what a mock object does is the first step to learning how to use one. Next, you’ll explore the Python mock object library to see how to use Python mock objects.
The Python Mock LibraryPython’s built-in mock object library is unittest.mock. It provides an easy way to introduce mocks into your tests.
Note: The standard library includes unittest.mock starting from Python 3.3 and in all newer versions. If you’re using an older version of Python, then you’ll need to install the official backport of the library.
To do so, install mock from the Python Package Index (PyPI) using pip:
Shell $ python -m pip install mock Copied!You may want to create and activate a virtual environment before installing the package.
unittest.mock provides a class called Mock, which you’ll use to imitate real objects in your codebase. Mock, along with its subclasses, offers incredible flexibility and insightful data that will meet most of your Python mocking needs.
The library also provides a function called patch(), which replaces the real objects in your code with Mock instances. You can use patch() as either a decorator or a context manager, giving you control over the scope in which the object will be mocked. Once the designated scope exits, patch() will clean up your code by replacing the mocked objects with their original counterparts.
Finally, unittest.mock provides solutions for some of the issues inherent in mocking objects, which you’ll explore later in this tutorial.
Now that you have a better understanding of what mocking is and the library you’ll be using, it’s time to dive in and explore the features and functionalities unittest.mock has to offer.
The Mock Objectunittest.mock offers a base class for mocking objects called Mock. The use cases for Mock are practically limitless because Mock is so flexible.
Begin by instantiating a new Mock instance:
Python >>> from unittest.mock import Mock >>> mock = Mock() >>> mock <Mock id='4561344720'> Copied! Read the full article at https://realpython.com/python-mock-library/ »[ 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 ]
Dries Buytaert: Drupal upgrades: tools and workflow
When a new major version of Drupal is released, custom code often requires updates to align with API changes, including the removal of deprecated APIs.
Because I keep forgetting certain aspects of this workflow, I decided to document it for future reference.
Tools overview Tool Interface Functionality Target Audience Upgrade Status module UI in Drupal Identifies deprecated code, hosting environment compatibility, and more Site administrators and developers Drupal Check Command-line Identifies deprecated code Developers, especially during coding and continuous integration (CI) Upgrade Status moduleThe Upgrade Status module assesses a Drupal site's readiness for major version upgrades by checking for deprecated code and other compatibility issues.
Screenshot of a Drupal upgrade status report showing hosting environment compatibility checks.Install the Upgrade Status module like you would install any other Drupal module:
[code bash]$ ddev composer require –dev drupal/upgrade_status[/code]Here, ddev is the tool I prefer for managing my local development environment. composer is a dependency manager for PHP, commonly used to install Drupal modules. The –dev option specifies that the module should be installed as a development requirement, meaning it is necessary for development environments but not installed on production environments.
Enable the Upgrade Status module:
[code bash]$ ddev drush pm-enable upgrade_status[/code]drush stands for "Drupal shell" and is a command-line utility for managing Drupal sites. The command pm:enable (where pm stands for "package manager") is used to enable a module in Drupal.
- After enabling the module, you can access its features by navigating to the Admin > Reports > Upgrade status page at /admin/reports/upgrade-status.
The Upgrade Status module might recommend updating PHP and MySQL, per Drupal's system requirements.
To update the PHP version of DDEV, use the following command:
[code bash]$ ddev config –-php-version 8.3[/code]To upgrade the MySQL version of DDEV and migrate your database content, use the following command:
[code bash]$ ddev debug migrate-database mariadb:10.11[/code]After updating these settings, I restart DDEV and run my PHPUnit tests. Although these tests are integrated into my CI/CD workflow, I also run them locally on my development machine using DDEV for immediate feedback.
Drupal CheckDrupal Check is a command-line tool that scans Drupal projects for deprecated code and compatibility issues.
I always run drupal-check before updating my Drupal site's code and third-party dependencies. This helps ensure there are no compatibility issues with the current codebase before upgrading. I also run drupal-check after the update to identify any new issues introduced by the updated code.
Output of Drupal Check command indicating no deprecated code was found.Installation:
[code bash]$ ddev composer require –dev mglaman/drupal-check[/code]Run Drupal Check from the root of your Drupal installation:
[code bash]$ ./vendor/bin/drupal-check –-memory-limit 500M docroot/modules/custom[/code]I usually have to increase the memory limit, hence the --memory-limit 500M.
Kirigami Addons 1.3.0
Kirigami Addons 1.3.0 is out. Kirigami Addons is a collection of components to enhance your Kirigami/QML application. This release contains many change related to the settings module.
ConfigurationViewThe current way to create a settings page in your application is to use CategorizedSettings with some SettingAction for each setting page. This was based on Kirigami.PageRow which was then either pushed on a layer on mobile or to a seperate page on desktop. This turned out to be quite unreliable in practice as Kirigami.PageRow is a visual element.
The new ConfigurationView is based on a plain non-visual QtObject with for the moment two backends:
- One for mobile which looks similar to the Plasma Settings application of Plasma Mobile.
- One for desktop which looks similar to the System Settings application of Plasma Desktop.
The API is almost the same as the previous CategorizedSettings which made porting quite easy. Here is for example a button that open the settings.
import QtQuick.Controls as Controls import org.kde.kirigamiaddons.settings as KirigamiSettings Controls.Button { id: button KirigamiSettings.ConfigurationView { id: configuration window: button.Controls.ApplicationWindow.window as Kirigami.ApplicationWindow modules: [ KirigamiSettings.ConfigurationModule { moduleId: "appearance" text: i18nc("@action:button", "Appearance") icon.name: "preferences-desktop-theme-global" page: () => Qt.createComponent("org.kde.tokodon", "AppearancePage") }, ... KirigamiSettings.ConfigurationModule { moduleId: "about" text: i18nc("@action:button", "About Tokodon") icon.name: "help-about" page: () => Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutPage") category: i18nc("@title:group", "About") } ] } icon.name: 'settings-configure-symbolic' text: i18nc("@action:button", "Settings") onClicked: configuration.open() }With this change, both CategorizedSettings and SettingAction are now deprecated.
SpellcheckingConfigurationModuleWith ConfigurationView each page is a ConfigurationModule and Kirigami Addons provides a ConfigurationModule for the spellchecking configuration of your application. This will allow to reduce code duplication between NeoChat, Tokodon, Marknote and more applications which uses Sonnet.
KirigamiSettings.ConfigurationView { modules: [ KirigamiSettings.SpellcheckingConfigurationView {} ] } FormCardFormCard design was slighly updated and now uses shadows as you might have already noticed from the previous screenshots.
SearchPopupFieldAnother component which is getting deprecated in SearchPopupField, there is now a replacement for that in Kirigami with the same behavior and I added an example how to port away to Kirigami.SearchDialog and I also ported all the know usage already.
Maintainance workAside from this major changes, there is ongoing maintaince works. This includes:
- Removing the accidental QtWidgets on Android caused by QtLabs.ColorDialog (me: Carl Schwan)
- Ensure all translated strings are loaded from the correct translation domain (me: Carl Schwan)
- The license dialog in the AboutPage is now opened in the correct window (Jack Hill)
- Fix the focus in the FormComboBoxDelegate (Joshua Goins)
- Fix the capitalization in the AboutPage (Joshua Goins)
- Increase the padding in FormCardDialog to match the other FormCard components
You can find the package on download.kde.org and it has been signed with my GPG key.
The Drop Times: Embracing the AI Revolution: A Drupal Developer's Perspective
mark.ie: My LocalGov Drupal contributions for week-ending June 28th, 2024
Here's what I've been working on for my LocalGov Drupal contributions this week. Thanks to Big Blue Door for sponsoring the time to work on these.
roose.digital: How to create the perfect RSS feed in Drupal 10
Gunnar Wolf: Many terabytes for students to play with. Thanks Debian!
My students at LIDSOL (Laboratorio de Investigación y Desarrollo de Software Libre, Free Software Research and Development Lab) at Facultad de Ingeniería, UNAM asked me to help them get the needed hardware to set up a mirror for various free software projects. We have some decent servers (not new servers, but mirrors don’t require to be top-performance), so…
A couple of weeks ago, I approached the Debian Project Leader (DPL) and suggested we should buy two 16TBhard drives for this project, as it is the most reasonable cost per byte point I found. He agreed, and I bought the drives. Today we had a lab meeting, and I handed them over the hardware.
Of course, they are very happy and thankful with the Debian project 😃 In the last couple of weeks, they have already set up an Archlinux mirror (https://archlinux.org/mirrors/fi-b.unam.mx), and now that they have heaps of storage space, plans are underway to set up various other mirrors (of course, a Debian mirror will be among the first).
Krita 5.2.3 Released!
Krita 5.2.3 is released after several weeks of testing of the beta. This is a bugfix release, that primarily brings a complete overhaul of our build system, making it so that our CI system can now build for all 4 platforms (a Continuous Integration system basically builds a program after every change, runs some tests and based on that helps us track down mistakes we made when changing Krita's code).
Beyond the rework of the build system, this release also has numerous fixes, particularly with regards to animated transform masks, jpeg-xl support, shortcut handling on Windows and painting assistants.
In addition to the core team, special thanks goes out to to Freya Lupen, Grum 999, Mathias Wein, Nabil Maghfur Usman, Alvin Wong, Deif Lou, Maciej Jesionowski and Rasyuqa A. H. for various fixes, as well as the first time contributors in this release cycle (Each mentioned after their contribution).
Changes since 5.2.3 beta:- Various fixes to tool canvas input shortcut behaviour (Thanks, Aqaao)
- Improved icons for Android (Bug 463043, thanks Jesse 205!)
- Various fixes to how we use MLT for synchronising audio to animation.
- Python SIP type stub generation, this will help autocompletion in external python editors that support using these stubs (Thanks Kate Corcoran)
- Crash fix with adding animation keyframe column on locked layer (Bug 486893)
- Fix update of "read-only" state of the document when loading and saving (Bug 487544)
- Ask to use PSD data in TIFF only if any was found (Bug 488024)
- Reworked default FFmpeg profiles (Bug 455006, 450790, 429326, 485515, 485514, thanks Ralek Kolemios!)
- Fix issue in KisMergeLabeledLayersCommand when masks where involved (Bug 486419)
- Update batch exporter Python plugin to fix trim option issue (Bug 488343, thanks Nathan Lovato!)
- Welcome Page: Fix "DEV BUILD" button going to a 404 (Thanks Joshua Goins!)
- Tablet Tester: Fix extreme lag with S Pen on Android (Thanks Joshua Goins!)
- Fix canvas fade-out when in 16-bit-uint mode on Angle (Bug 488126)
- WEBP & JPEG-XL: preemptive check for animation (Bug 476761)
- Fix copy-pasting selection of File Layer (Bug 459849)
- Fix color sampler in wrap around mode (Bug 478190)
- Replace old QML touch docker with QWidget-based touch docker to avoid problems on Android (Bug 476690)
- Add support for XSIMD13
- Redraw layers docker thumbnails if the canvas checkers color was changed
- Fix animation playback freezes when pausing past the end of audio (Bug 487371 and 478185)
If you're using the portable zip files, just open the zip file in Explorer and drag the folder somewhere convenient, then double-click on the Krita icon in the folder. This will not impact an installed version of Krita, though it will share your settings and custom resources with your regular installed version of Krita. For reporting crashes, also get the debug symbols folder.
Note that we are not making 32 bits Windows builds anymore.
- 64 bits Windows Installer: krita-5.2.3-setup.exe
- Portable 64 bits Windows: krita-5.2.3.zip
- Debug symbols. (Unpack in the Krita installation folder)
- 64 bits Linux: krita-5.2.3-x86_64.appimage
The separate gmic-qt AppImage is no longer needed.
(If, for some reason, Firefox thinks it needs to load this as text: to download, right-click on the link.)
macOSNote: We're not supporting MacOS 10.13 anymore, 10.14 is the minimum supported version.
- macOS disk image: krita-5.2.3.dmg
We consider Krita on ChromeOS as ready for production. Krita on Android is still beta. Krita is not available for Android phones, only for tablets, because the user interface requires a large screen.
We are no longer building the 32 bits Intel CPU APK, as we suspect it was only installed by accident and none of our users actually used it. We are hoping for feedback on this matter.
Source code md5sumFor all downloads, visit https://download.kde.org/stable/krita/5.2.3/ and click on Details to get the hashes.
KeyThe Linux AppImage and the source .tar.gz and .tar.xz tarballs are signed. You can retrieve the public key here. The signatures are here (filenames ending in .sig).
Armin Ronacher: What is Self Hosted? What is a Stack?
My colleague Ben Vingar wrote a tool called Counterscale which I would describe as “deploy your own analytics”. Except there is a catch: it needs Cloudflare to run. Is it really self hosted if your only way to deploy it is some proprietary cloud vendor?
What's a Stack?Many years ago we talked about software stacks. A common one happened to be “LAMP”. Short for: Linux, Apache, MySQL and typically PHP, though Python and Perl were choices for the P just as well. LAMP lends itself very well for self hosting because all of it is Open Source software you can run and operate yourself free of charge. There was however also a second stack which was not entirely unpopular: “WAMP“ (The W meaning Microsoft Windows). You would not necessarily run it yourself if you had a choice, but I deployed more than one of these. Why? Because some SMEs were already running Windows. If you wrote some software in PHP, having people run the software on their already existing Windows servers was preferable to also running some Linux thing they did not know how to operate.
What makes LAMP, WAMP and whatever work are a few basic technological choices. Originally one of those abstractions was a protocol called CGI which allowed you to marry a programming language to the web server. Later also things like FastCGI appeared to deal with some of the performance challenges that CGI brought and there were also attempts to move PHP right into the web server as embedded language with mod_php. For the database the abstraction in many cases was a dialect of SQL. I built a tool a long time ago that a company ended up running on Microsoft's SQL server with rather minimal changes. So in some sense what made this work was that one was targeting some form of abstraction.
What's Self Hosted?Counterscale targets something that the open source ecosystem does not really have abstracted today: an analytics engine and some serverless runtime. What was CGI and SQL in case of Counterscale is some serverless runtime environment and a column store. All these things do exist in the Open Source ecosystem. All the pieces are there to build your own serverless runtime and all the things are there to build an analytics store on top of ClickHouse, DuckDB or similar databases and Kafka. But we did not agree on protocols and we definitely did not really have that stuff today in a neatly packaged and reusable thing.
Now of course you can build software that runs entirely on Open Source software. In case of Counterscale you don't even have to look very far: Plausible exists. It's also Open Source, it's also an analytics tool, but rather than being like a “CGI script” in spirit, it's a pretty heavy thing. You gotta run docker containers, run a rather beefy ClickHouse installation, I believe it needs Kafka etc. Running Plausible yourself is definitely not neatly as easy as setting up Counterscale. You do however, have the benefit of not relying on Cloudflare.
Level up the ProtocolsSo what does that leave us with? I'm not sure but I'm starting to think that the web needs new primitives. We now run some things commonly but the abstractions over them are not ideal. So people target (proprietary) systems directly. The modern web needs the CGI type protocols for queues, for authentication, for columns stores, for caches etc. Why does it need that? I think it needs it to lower the cost of building small scale open source software.
The reason it's so easy and appealing to build something like Counterscale directly against Cloudflare or similar services is that they give you higher level abstractions than you would find otherwise. You don't have to think about scaling workers, you don't have to think about scaling databases. The downside of course is that it locks you against that platform.
But what would be necessary to have your “own Cloudflare” thing you can run once and then run all your cool mini CGI like scripts above? We miss some necessary protocols. Yet building these protocols is tricky because you target often the least common denominator. Technology also here is hardly the problem. Don't need any new innovative technology here, but you need the social contract and the mindset. Those are hard things, they require dedication and marketing. I have not yet seen that, but I'm somewhat confident that we might see it.
We probably want these protocols and systems built on top of it because it makes a lot of things easier. Sometimes of the cost of doing something drops low enough, it enables a whole new range of things to exist.
Many times when you start building abstractions over these things, you simplify. Even CGI was an incredibly high level abstraction over HTTP if you think about it. CGI in many ways is the original serverless. It abstracts over both HTTP and how a process spawns and its lifecycle. Serverless is bringing back a bit of that, but so far not in a way where this is actually portable between different clouds.
Abstract over Great IdeasIf you have ever chucked up an OG CGI app you might remember the magic. You write a small script, throw it into a specific folder and you are off to the races. No libraries, no complex stuff. CGI at its core was a great idea: make a web server dynamic via a super trivial protocol anyone can implement. There are more ideas like that. Submitting tasks to a worker queue is a great idea, batch writing a lot of data into a system is a great idea, kafka like topics are a great idea, caches are a great idea, so are SQL databases, column stores and much more.
Laravel Forge does a tiny bit of that I feel. Forge goes a bit in to that direction in the sense that it says quite clearly that some components are useful: databases, caches, SSL, crons etc. However it's ambition stops at the boundary of the Laravel ecosystem which is understandable.
Yet maybe over time we can see more of a “SaaS in a box” kind of experience. A thing you run, that you can plug your newfangled, serverless mini tools in, that can leverage auth and all the needs of a modern web application like queues, column stores, caches etc.
PyCoder’s Weekly: Issue #635 (June 25, 2024)
#635 – JUNE 25, 2024
View in Browser »
This PEP proposes updating the versioning scheme for Python to include the calendar year. This aims to make the support lifecycle clear by making it easy to see when a version was first released, and easier to work out when it will reach end of life (EOL). Associated discussion
PYTHON
In this video course, you’ll learn about the mistakes you might make when rounding numbers and how to best manage or avoid them. It’s a great place to start for the early to intermediate Python developer who’s interested in using Python for finance, data science, or scientific computing.
REAL PYTHON course
Stay up to date with the latest advancements in technology by joining the NVIDIA Developer community. Get access to the latest tools, training, and experts. Join the community today and get a free course from the Deep Learning Institute →
NVIDIA sponsor
The latest in a series of articles on testing in Python, this one shows you how to generate test data on the fly, in a repeatable way.
BITECODE
Take this quiz to test your understanding of how a great README file can make your Python project stand out and how to create your own README files.
REAL PYTHON
Ruff is an extremely fast, modern linter with a simple interface, making it straightforward to use. It also aims to be a drop-in replacement for other linting and formatting tools, like Pylint, isort, and Black. It’s no surprise it’s quickly becoming one of the most popular Python linters.
REAL PYTHON
How do you find the most interesting or suspicious points within your data? What libraries and techniques can you use to detect these anomalies with Python? This week on the show, we speak with author Brett Kennedy about his book “Outlier Detection in Python.”
REAL PYTHON podcast
Autoscaling is critical for any resilient, cost-conscious deployment. Are you running Django, Flask, Celery, RQ? This is for you. You’ll learn the ups and downs 😎 of autoscaling in our illustrated guide →
JUDOSCALE sponsor
SQLite has improved a lot over the years, but its non-production reputation seems to have stuck. This is despite the fact that it is in almost every phone on the planet. This short post from Avinash talks about why it has the reputation it does.
AVINASH SAJJANSHETTY
scikit-lego is a library that adds extra estimators for machine learning in scikit-learn. Its most recent release takes advantage of the Narwhals package to support dataframes from a variety of packages.
MARCO GORELLI • Shared by Marco Gorelli
Do you have a Python package that you’d like to share with the world? You should publish it on the Python Package Index (PyPI). This article gives a short example of what you need to do to publish.
MIKE DRISCOLL
A post on Mastodon caused Veronica to go down a rabbit hole. Turns out that in one particular situation, a generator isn’t faster than a list. Learn why str.join() doesn’t like generators.
VERONICA BERGLYD OLSEN
Due to an inordinate amount of bot accounts coming from outlook.com and hotmail.com, PyPI has disallowed new account sign-ups with email addresses from these domains.
THE PYTHON PACKAGE INDEX BLOG
Turns out there are no canonical rules for the names of wheel files. This can cause some confusion when determining if two files are for the same version of a module.
WILLIAM YOSSARIAN
The alpha version of Django 5.1 contains new features for setting pragma controls for databases. This article describes the best choices when working with SQLite.
GIOVANNI COLLAZO
“One of the biggest sticking points of being a solo dev is maintaining motivation.” This post from Marcus discusses some of the things he does to stay motivated.
MARCUS BUFFETT
If you’re in the bioinformatics field and thinking of learning to code, is R or Python your better choice? This article and video highlight the differences.
MING TANG
Microsoft’s new Python in Excel functionality was released almost a year ago. Having now had time to play with it, Felix gives his take.
FELIX ZUMSTEIN
Lots has changed and been added with the release of NumPy 2.0. This article gives you the highlights.
SCIENTIFIC PYTHON BLOG
June 26, 2024
REALPYTHON.COM
June 27, 2024
MEETUP.COM
June 29 to June 30, 2024
NORTHBAYPYTHON.ORG
June 29, 2024
MEETUP.COM
June 29, 2024
PYTHON.ORG.BR
Happy Pythoning!
This was PyCoder’s Weekly Issue #635.
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 ]
PyCharm: PyCharm 2024.1.4: What’s New!
PyCharm 2024.1.4 is here! View and navigate to URLs directly from the Editor tab, get context-based model suggestions for Hugging Face, and enjoy smart code assistance for TypedDict (PEP 692).
You can download the latest version from our download page, or update your current version through our free Toolbox App.
Download PyCharm 2024.1.4 Key Features Gutter actions and inlay hints for URLsNew gutter icons provide an easy way to manage URLs in Flask, FastAPI, and Django projects. In just a few clicks, you can test an endpoint by running the request in the HTTP Client, view all lower-level endpoints, and more.
Furthermore, new inlay hints with endpoint URLs further contribute to code readability for Python web frameworks.
PEP 692: Smart code assistance for TypedDictWith support for PEP 692, keyword arguments defined as TypedDict are now available when you invoke parameter info (⌘P / Ctrl+P), in code completion, and in the quick documentation popup (F1 / Ctrl+Q). Now you have access to yet another tool that lets you use the latest type hinting capabilities in Python to develop an easy-to-understand codebase.
Learn more Hugging Face: Model suggestionsPyCharm can now suggest a list of relevant Hugging Face models that best suit your needs. This allows you to decide which model to use and install without ever having to leave the IDE. Decide what you would like the model to do, and PyCharm will provide a list of options to choose from!
After selecting a model, PyCharm will suggest inserting a code snippet that allows you to use this model directly in the open file, and it will download and install all of the missing packages on which this model depends.
Warnings for uninstalled packages in requirements.txtPyCharm now underlines packages that are listed in requirements.txt but that are not installed on the current Python interpreter with a yellow squiggly line. Hover over the package name and click Install all missing packages to immediately set up your development environment.
Download PyCharm 2024.1.4Get all of the details in our release notes so you don’t miss out on anything new!
If you come across any bugs, please let us know in our issue tracker so we can fix them right away. Connect with us on X (formerly Twitter) and share your thoughts on PyCharm 2024.1.4!
Gunnar Wolf: Find my device - Whether you like it or not
I received a mail today from Google (noreply-findmydevice@google.com) notifying me that they would unconditionally enable the Find my device functionality I have been repeatedly marking as unwanted in my Android phone.
The mail goes on to explain this functionality works even when the device is disconnected, by Bluetooth signals (aha, so “turn off Bluetooth” will no longer turn off Bluetooth? Hmmm…)
Of course, the mail hand-waves that only I can know the location of my device. «Google cannot see or use it for other ends». First, should we trust this blanket statement? Second, the fact they don’t do it now… means they won’t ever? Not even if law enforcement requires them to? The devices will be generating this information whether we want it or not, so… it’s just a matter of opening the required window.
Of course, it is a feature many people will appreciate and find useful. And it’s not only for finding lost (or stolen) phones, but the mail also mentions tags can be made available to store in your wallet, bike, keys or whatever. But it should be opt-in. As it is, it seems it’s not even to opt out of it.
Real Python: Build a GUI Calculator With PyQt and Python
Even though web and mobile applications appear to have taken over the software development market, there’s still demand for traditional graphical user interface (GUI) desktop applications. If you’re interested in building these kinds of applications in Python, then you’ll find a wide variety of libraries to choose from. They include Tkinter, wxPython, PyQt, PySide, and a few others.
In this video course, you’ll learn the basics of building GUI desktop applications with Python and PyQt.
In this video course, you’ll learn how to:
- Create graphical user interfaces with Python and PyQt
- Connect the user’s events on the app’s GUI with the app’s logic
- Organize a PyQt app using a proper project layout
- Create a fully functional GUI application with PyQt
[ 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 ]
Python Software Foundation: FAQ for Proposed Changes to PSF Bylaws
As part of the PSF Board Election, there are three proposed changes to the PSF Bylaws which will be on the upcoming ballot. We have received a significant amount of feedback relating to proposed change #3 (allowing for the removal of Fellows by a majority vote of the Board of Directors). We have been working on a response, which has taken us some time because we want to be as transparent as possible, and there have been many questions raised over the last week or so. Thank you for voicing feedback and your patience with us while we worked on our response.
Please keep in mind that as we are the group who is responsible for the health of the Foundation, we need to be conscious about our statements. There may be direct consequences for our words, and some of the specifics are legally privileged.
The broad categories of questions we’ve included are about the importance of this change, alternatives that were considered and rejected, how the Board is structured against abuse of this change, and a few general questions.
If your specific question isn’t answered here, please join the PSF Board Election Bylaws Office Hour session on Thursday June 27th at 1PM UTC in the #psf-elections channel on the PSF Discord. You can also email your questions to either psf-elections@pyfound.org or membership-wg@pyfound.org or by responding to the For your consideration: Proposed bylaws changes to improve our membership experience thread on the PSF Discuss forum.
We hope that our transparency, the Office Hour session, and our responses in the FAQ below encourage you to vote in favor of all three of the proposed Bylaw changes.
With thanks,
- The PSF Board of Directors
Importance of a measure like this
Q: Why is this even necessary? What kind of legal advice did you ask for?
A: The Board has a responsibility to act in the interests of the Foundation. Our legal counsel has advised us of a possibility where knowingly allowing a bad actor to continue to operate with our implied endorsement would open us up to certain kinds of liability. Our Bylaws do not currently have a mechanism for revoking the Fellow designation, and this change is intended to close that gap.
The text of all three Bylaws changes were proposed or vetted by our legal counsel, and we are confident that the text as proposed allows us to act according to the intent we described in our original post.
A: The Board needs to balance transparency with our duty to act in the best interest of the Foundation. We can’t discuss any events that would hypothetically lead to removing a Fellow, or even whether there have even been any events that would warrant a removal, because releasing details — or even the existence — of investigations where we failed to remove a fellow would open us up to the possibility of liability.
Q: Does the Board stand by this amendment? Was this a majority or a unanimous decision?
A: The board voted unanimously in favor of this amendment, 10 in favor, 0 against, 0 abstentions. While the Bylaws do not allow proxy votes to be formally counted, both Board members who could not attend the meeting also explicitly registered their support for the amendment with other Board members.
A: Some people will not make Code of Conduct reports if they are likely to go to a large public discussion or are unlikely to be acted on. The current lifelong nature of the Fellow designation has created a special group of people who are functionally exempt from the effects of the Code of Conduct.
A: Even though there is no longer a full-time General Counsel as part of the Board of Directors, the PSF retains legal counsel. Legal advice was sought, provided, and followed as part of this amendment process.
A: The PSF’s Bylaws define the legal structure of the Foundation, the Membership, and how the organization is governed. If an aspect of Membership or the Board’s ability to make decisions needs to be changed, the Bylaws need to be changed. This usually happens by discussion amongst the Board, working groups, or even directly from the Membership, resulting in a proposal to amend the Bylaws.
To change the Bylaws, the Board must vote on a proposed amendment, and then the Membership usually has the opportunity to vote to approve those changes. As an organization that represents a diverse community, we strongly value the consent and community buy-in that comes from a vote.
There are other ways to change the bylaws, including not seeking Member approval, or by Membership seeking Bylaws changes without Board approval, but these have never been used.
Q: Why does this only require a majority vote, not a supermajority?
A: This amendment as written already requires a higher standard than most business the Board handles. It requires a majority of the full Board of Directors, not merely a majority of the quorum (as is otherwise required in Section 5.8).
With the current size of the Board, a majority is 7 Directors, and a supermajority (two thirds) is 8. The Board would be open to amending the requirements to a supermajority in the future, but we wish to highlight how small the difference would be in practice.
A: A unanimous vote requirement would create scope for abuse. A unanimous vote requirement would allow for a single dissenting Director to prevent the removal of a problematic Fellow, opening the Foundation to liability.
In certain cases, that liability could extend to individual Directors, even those who voted to remove the Fellow, simply because the action failed to pass due to one dissenting vote (subject to the provisions of Article XII “Limits on Liability of Directors”).
This personal liability would be a significant barrier to many community members' willingness to serve on the Board.
Q: Why does the Board need to act responsibly?
A: The Board needs to act in the service of the Foundation’s mission, and has a responsibility to the community to keep vital infrastructure like PyPI running, providing fiscal sponsorship to community groups like PyLadies chapters, or giving grants to international communities.
Acting against the interests of the membership would cause the community to lose trust in us, and threaten our ability to keep Python’s infrastructure running.
A: This proposed Bylaws amendment requires a Member to fail a “condition of membership” to be removed. Such a condition would need to have been previously enacted by the Board and would apply to any Member in that class of Membership. This prevents the Board from removing a Member arbitrarily.
The Membership regularly holds the Board accountable through annual elections. Should there be an immediate need to act, the Membership can call a special meeting of the Board or the Membership and hold the Board to account. The proposed change allows a removed Member 15 business days before their removal is final, during which time they can use the tools available to hold the Board to account.
A: The Board is elected in cohorts, such that usually only 3-4 seats are open each year. Any “hostile takeover” would need to be conducted over the course of a few years and could not be engineered by any company or other formal entity because we already have rules preventing Board capture in our Bylaws (section 5.15).
“No more than one quarter (1/4) of the members of the Board of Directors may share a common affiliation.”
Q: Why does this offer the possibility of covering non-Code of Conduct policies?
A: The Amendment gives the Board the right to add other qualifications to membership, and the Bylaws do not prevent the Board from amending the Code of Conduct (and we have done so multiple times before). If we were to change the Bylaws such that the only policy that allowed us to remove members was the Code of Conduct, this would have the perverse effect of incentivizing the Board to amend the Code of Conduct to cover other cases where removing a Member may be a necessity. This would make the Code of Conduct too long, complicated, and unfocused to be effective in the cases where it is already used.
A: It is true that the amended text covers all classes of Membership, however, in practice the only truly new ability granted to the board is being able to remove Fellows.
The text of the Bylaws already grants mechanisms that could allow the Board to make Members in other classes ineligible for Membership, including the ability to set “alternate eligibility criteria” (section 4.6-4.7) beyond those in the Bylaws or an “applicable membership fee” (section 4.5). The only class of membership for which there is no way to restrict eligibility on existing Members are the Fellows, who are granted life membership, except if they are removed by a vote of the Membership. This amendment makes it possible to remove Members, no matter which class, using the same tools.
A: The current membership and the past members of the Conduct Work Group are listed in the charter which can be found on the Code of Conduct Work Group Charter page. The group consists of diverse representatives from around the world. The charter lists the process for applying to join the Work Group.
pygame: pygame 2.6.0
Please file an issue if you notice a problem:
https://github.com/pygame/pygame/issues