Feeds
Julien Tayon: 3D ploter in python-tk with matplotlib.
The challenge seemed pretty easy, to assemble an easy demo with simple example :
- One example on how to use text entry in matplotlib that doubles with a 2D plotter,
- and the one from matplotlib on how to draw a 3D surface with a colorbar
- and the one for projecting the contour of the function on the axis
Without the colorbar I would have just been slightly annoyed by the slowness of the reaction of matplotlib as a GUI, but the colorbar posed a new challenge because it would either stack for each drawing or make plt.clf/ax.cla erase too much (see this great resource on when to use cla/clf in matplotlib).
So ... I tried python-tk with matplotlib knowing all too well that you can embed natively matplotlib in tkinter interface.
And since it was working I kept it.
Here is a screenshot of the interface : WARNING this code should not be let in inventive hands (such as bored teenagers) because there is an evil eval; it requires to be in care of consenting adults.
Some highlights of the code :
- bidir python-tk requires setting the Popen PIPEs to non blocking and using select.select on the output
- matplotlib is unusable in non blocking mode : once matplotlib has the focus you need to destroy it to plot another function
- from np import * is evil, but it let you have access to all array oriented math function (sin, cos, exp, ...)
joshics.in: Unlocking the Future of Edtech with Drupal
Education and technology are no longer separate entities; they've woven into a single, dynamic tapestry known as Edtech. At the heart of this digital revolution lies Drupal—a CMS that goes beyond traditional boundaries, offering a powerful platform for innovation in education.
Seamless Integration with Learning Tools
Drupal isn’t just about managing content. It facilitates seamless integration with popular LMS platforms like Moodle. Consider the ICE-SA portal, which we integrated with Moodle to provide a seamless learning experience for civil engineers. This integration enabled learners to access a wide range of engineering resources and online courses from a single platform, enhancing their learning efficiency and satisfaction.
Scalable Solutions for Growing InstitutionsEducational institutions often face the challenge of scaling their digital platforms to keep pace with growing student numbers. Drupal provides a scalable foundation that evolves alongside the institution. Education Above All needed to revamp their 'resources' website to accommodate a significant increase in user traffic. With Drupal, we ensured the site could handle the growth while maintaining a high level of performance, allowing more educators and learners to benefit from their valuable resources.
Customisable Learning ExperiencesEvery educational organisation has its distinct identity and goals. Drupal’s flexible architecture empowers institutions to tailor their learning portals to meet these unique needs. Take the SABEeX Drupal 10 website, for instance. By integrating SCORM features, the platform offered a more dynamic and interactive learning experience. This allowed learners to engage with customised content and track their progress effectively, transforming the traditional learning journey into a personalised adventure.
Security FirstIn an era where data breaches are all too common, protecting sensitive educational data is paramount. Drupal’s enterprise-level security measures offer robust protection, ensuring peace of mind.
Community Support and CollaborationThe Drupal community is a treasure trove of insights and collaborative potential, especially for those in education. By joining this vast community, developers and educators can share innovations and tools that enhance educational experiences globally. A recent collaboration between several European universities using Drupal led to the development of an open-source tool that revolutionised resource sharing across institutions.
Are you ready to rethink your Edtech strategy with Drupal? Whether you're looking to dive deeper into custom solutions or curious about real-world transformations, Drupal offers the tools to elevate educational experiences. Share your story of innovation or explore how you can harness the power of Drupal
EdTech Drupal Planet Add new commentOliver Davies' daily list: 16 years on Drupal.org
As of today, my user profile on Drupal.org says I've been on it for 16 years.
Originally self-learning HTML and CSS to build a website for a Tae Kwon-Do School I used to train at, I later started to learn PHP and MySQL before trying Drupal after it was suggested to me in a response to a question on a forum (which was also built with Drupal).
Since then, I've done great things with Drupal and met many great people at different events.
I've even started to interview some of them on my podcast.
Here's to the next 16 years, and I'm very excited so see where Drupal and PHP go.
Spyder IDE: Officially announcing the release of Spyder 6!
amazee.io: DrupalCon Barcelona 2024 - Team Recap
Dropsolid Experience Cloud: 10 things you probably didn’t know about Drupal
Dropsolid Experience Cloud: Mautic for Developers: connecting Drupal content to Mautic email marketing
Dropsolid Experience Cloud: Everything you need to know about headless Drupal
Dropsolid Experience Cloud: How to add metatags to your headless Drupal project
Dropsolid Experience Cloud: The road to fully headless Drupal
Dropsolid Experience Cloud: Dropsolid DXP, the most open Drupal powered DXP for enterprises with a low entry barrier
Dropsolid Experience Cloud: What is a Digital Experience Platform (DXP) and why do you need one?
libunistring @ Savannah: GNU libunistring-1.3 released
Download from https://ftp.gnu.org/gnu/libunistring/libunistring-1.3.tar.gz
This is a stable release.
New in this release:
- The data tables and algorithms have been updated to Unicode version 16.0.0.
- New function uc_is_property_modifier_combining_mark and new constant UC_PROPERTY_MODIFIER_COMBINING_MARK.
- Fixed a bug in the *printf functions: The %ls and %lc directives could lead to a crash on Solaris and MSVC.
Nonprofit Drupal posts: October Drupal for Nonprofits Chat
Join us THURSDAY, October 17 at 1pm ET / 10am PT, for our regularly scheduled call to chat about all things Drupal and nonprofits. (Convert to your local time zone.)
We don't have anything specific on the agenda this month, so we'll have plenty of time to discuss anything that's on our minds at the intersection of Drupal and nonprofits. Got something specific you want to talk about? Feel free to share ahead of time in our collaborative Google doc: https://nten.org/drupal/notes!
All nonprofit Drupal devs and users, regardless of experience level, are always welcome on this call.
This free call is sponsored by NTEN.org and open to everyone.
-
Join the call: https://us02web.zoom.us/j/81817469653
-
Meeting ID: 818 1746 9653
Passcode: 551681 -
One tap mobile:
+16699006833,,81817469653# US (San Jose)
+13462487799,,81817469653# US (Houston) -
Dial by your location:
+1 669 900 6833 US (San Jose)
+1 346 248 7799 US (Houston)
+1 253 215 8782 US (Tacoma)
+1 929 205 6099 US (New York)
+1 301 715 8592 US (Washington DC)
+1 312 626 6799 US (Chicago) -
Find your local number: https://us02web.zoom.us/u/kpV1o65N
-
- Follow along on Google Docs: https://nten.org/drupal/notes
Security advisories: Drupal core - Moderately critical - Improper error handling - SA-CORE-2024-002
Under certain uncommon site configurations, a bug in the CKEditor 5 module can cause some image uploads to move the entire webroot to a different location on the file system. This could be exploited by a malicious user to take down a site.
The issue is mitigated by the fact that several non-default site configurations must exist simultaneously for this to occur.
Solution:Install the latest version:
- If you are using Drupal 10.2, update to Drupal 10.2.10.
- Drupal 10.3 and above are not affected, nor is Drupal 7.
All versions of Drupal 10 prior to 10.2 are end-of-life and do not receive security coverage. (Drupal 8 and Drupal 9 have both reached end-of-life.)
This advisory is not covered by Drupal Steward.
Reported By: Fixed By:- catch of the Drupal Security Team
- Lee Rowlands of the Drupal Security Team
- Benji Fisher of the Drupal Security Team
- Kim Pepper
- Wim Leers
- xjm of the Drupal Security Team
- xjm of the Drupal Security Team
- Dave Long of the Drupal Security Team
- Juraj Nemec of the Drupal Security Team
Django Weblog: Announcing weekly DSF office hours
For the last year, Thibaud Colas and I have had a weekly DSF co-working session — we get on a video call and spend an hour quietly working together on DSF things. It's worked well to help us carve out time to work on DSF initiatives, so we'd like to expand into an open-to-everyone weekly "office hours" format.
These will be Wednesdays at 6PM UTC (convert to other time zones). (Yes, that means the first one will be in just about 4 hours, short notice I know, so maybe mark it down for next week.)
All you need to do is bring something DSF-related to work on. This is intentionally broad, as long as it's vaguly DSF-related you're welcome to come. It's not a general-purpose Django coding session (you're welcome to be writing code but it should be related the DSF, e.g. working on djangoproject.com or something.)
This week and next, we'll probably be focusing on nominations for the DSF Board -- nominations close October 25th.
For now, we're deliberately not publishing the video call information publicly — we're a bit worried about spammers and scammers. So if you want to join, you'll need to contact the board, or someone on the board, to get the info. You can use the DSF contact form, and anyone's welcome to contact me directly: — email jacob@djangoproject.com, Signal jacobian.01, or @jacob@jacobian.org on Mastodon.
(Yes, this introduces some friction which is at odds with the "everyone's welcome" ethos. If/when we figure out a better way to moderate these calls, we'll change this.)
I look forward to seeing you there!
Mike Driscoll: SSH Scripting with Fabric and Python
Reading and writing files is a basic task that most software applications need to do. You will also find that you sometimes need to read and write files to a remote machine or perhaps run commands on a remote machine as well. Python is well-suited for this type of activity using tools such as Paramiko. However, in this tutorial, you will spend some time learning how to use a different package called Fabric.
Fabric is a high-level Python package designed especially to execute shell commands remotely over SSH and then yielding useful Python objects in return. This article will focus on the latest version of Fabric, which is 3.2.2 at the time of writing.
Getting FabricFabric is a third party package. That means you need to install Fabric to be able to use it. Fortunately, you can use Python’s pip tool to do so.
Open up a terminal application and run the following command:
python -m pip install fabricIf you don’t want to clutter up your main Python environment, then you should use a Python virtual environment. You can learn more about those in An Intro to Python Virtual Environments.
Once you are finished installing Fabric, you can move on to learning how to use it!
Connecting to the Server with FabricThe Fabric documentation uses the following as a super simple example of running a command on a remote machine using SSH:
from fabric import Connection result = Connection('web1.example.com').run('uname -s', hide=True)You only need two lines of code to start running commands on a remote machine. But what if the remote machine requires credntials?
In that case, you need to create a Config object and update your instantiation of Connection like this:
from fabric import Connection, Config config = Config(overrides={"sudo": {"password": "MyAmazingPassword123"}}) conn = Connection("mike@10.10.166.128:22", connect_kwargs={"password": "MyAmazingPassword123!"}, config=config)If you have a machine that uses an SSH key pair, you can use this alternate connect_kwargs dictionary:
connect_kwargs={ "key_filename": "/home/myuser/.ssh/private.key", }Then simply update the call to Connection and you’re good to go.
Running Commands with FabricNow that you have the knowledge needed to connect to the remote machine, you probably want to start running more complex commands. Here is an example of running a ping command:
from fabric import Connection, Config config = Config(overrides={"sudo": {"password": "MyAmazingPassword123"}}) conn = Connection("mike@10.10.166.128:22", connect_kwargs={"password": "MyAmazingPassword123!"}, config=config) conn.run("ping -c 2 www.google.com")What if you want to be able to use the super user (i.e. root) when running a command? Fabric makes that easy by using the sudo() method:
from fabric import Connection, Config config = Config(overrides={"sudo": {"password": "MyAmazingPassword123"}}) conn = Connection("mike@10.10.166.128:22", connect_kwargs={"password": "MyAmazingPassword123!"}, config=config) conn.sudo("systemctl restart nfs-kernel-server") Transferring Files with FabricIf you want to download a file from a remote machine, Fabric makes this rudimentary task even easier. Here’s how to do it:
from fabric import Connection, Config config = Config(overrides={"sudo": {"password": "MyAmazingPassword123"}}) conn = Connection("mike@10.10.166.128:22", connect_kwargs={"password": "MyAmazingPassword123!"}, config=config) conn.get("remote_file_path", "local_file_path")Note that all you need to do is call get() while specifying the location of the remote file that you want for the first argument and the local path for where you want to download the file as the second argument.
Sending a file to the remote server is done using the put() method:
from fabric import Connection, Config config = Config(overrides={"sudo": {"password": "MyAmazingPassword123"}}) conn = Connection("mike@10.10.166.128:22", connect_kwargs={"password": "MyAmazingPassword123!"}, config=config) conn.put("local_file_path", "remote_file_path")You reverse the arguments for put() versus get(). The local path is passed in first, followed by the remote location that you want to upload to.
But what if you want to upload to a restricted area of the file system on the remote machine? You know, like to the etc folder or any of the other root-owned folders?
Fabric doesn’t have a built-in way to do that. Instead you use a two-step process:
- Upload the file to a directory that your user owns
- Then use sudo() to move the file to the restricted location
Here’s an example:
from fabric import Connection, Config config = Config(overrides={"sudo": {"password": "MyAmazingPassword123"}}) conn = Connection("mike@10.10.166.128:22", connect_kwargs={"password": "MyAmazingPassword123!"}, config=config) # Send the file to a user directory conn.put("local_file_path", "remote_file_path") # Use sudo to move that file to a root location conn.sudo("mv remote_file_path root_location_path") Wrapping UpFabric is a great tool that greatly simplifies running SSH commands on remote computers. If you know how to use common Linux commands or know Python well, you can do lots of different things. For example, you could even upload a Python script to the remote server, run it, and then remove the file. At that point, you could do just about anything that you needed to.
Give Fabric a try and see what you can do!
The post SSH Scripting with Fabric and Python appeared first on Mouse Vs Python.
Real Python: Structural Pattern Matching in Python
Structural pattern matching is a powerful control flow construct invented decades ago that’s traditionally used by compiled languages, especially within the functional programming paradigm.
Most mainstream programming languages have since adopted some form of pattern matching, which offers concise and readable syntax while promoting a declarative code style. Although Python was late to join the party, it introduced structural pattern matching in the 3.10 release.
In this tutorial, you’ll:
- Master the syntax of the match statement and case clauses
- Explore various types of patterns supported by Python
- Learn about guards, unions, aliases, and name binding
- Extract values from deeply nested hierarchical data structures
- Customize pattern matching for user-defined classes
- Identify and avoid common pitfalls in Python’s pattern matching
To get the most out of this tutorial, you should have a basic understanding of conditional statements, loops, functions, and classes in Python. Additionally, familiarity with Python’s built-in data structures, such as tuples, lists, and dictionaries, will be beneficial.
Get Your Free Code: Click here to download the free sample code that shows you how to use structural pattern matching in Python.
Take the Quiz: Test your knowledge with our interactive “Structural Pattern Matching” quiz. You’ll receive a score upon completion to help you track your learning progress:
Interactive Quiz
Structural Pattern MatchingIn this quiz, you'll test your understanding of structural pattern matching in Python. This powerful control flow construct, introduced in Python 3.10, offers concise and readable syntax while promoting a declarative code style.
Getting to Know Structural Pattern MatchingBefore taking advantage of structural pattern matching in your code, make sure that you’re running Python 3.10 or later, as you won’t be able to use it in earlier Python versions. Note that although the name structural pattern matching is often shortened to just pattern matching, the qualifier structural is crucial to understanding the use cases for this feature. In this section, you’ll get a high-level overview of structural pattern matching.
What Is Pattern Matching?You can think of pattern matching as a form of syntactic sugar built on top of existing language constructs, including conditional statements and tuple unpacking. While you can absolutely live without pattern matching, it gives you new superpowers, making this feature more convenient than the conventional syntax in some situations.
Pattern matching often leads to more elegant, concise, and readable code written in a declarative style. To get a taste of it, take a quick look at the following example without trying to fully understand how it works just yet:
Python import json def log(event): match json.loads(event): case {"keyboard": {"key": {"code": code}}}: print(f"Key pressed: {code}") case {"mouse": {"cursor": {"screen": [x, y]}}}: print(f"Mouse cursor: {x=}, {y=}") case _: print("Unknown event type") Copied!The match statement takes a subject, which can be any valid Python expression, such as a string literal or a function call, and compares the resulting value to one or more patterns listed in the case clauses. The first pattern that matches the given subject will trigger the corresponding case block to run. You’ll learn more about the match statement and case clauses later in this tutorial.
At first glance, the syntax of structural pattern matching in Python looks a bit like the switch statement found in the C-family programming languages if you squint your eyes:
C void log_event(enum Event event) { switch (event) { case KEYBOARD: printf("Keyboard event\n"); break; case MOUSE: printf("Mouse event\n"); break; default: printf("Unknown event\n"); } } Copied!This resemblance is deceptive, though. The classic switch statement controls the execution flow based on the exact value stored in a variable. It effectively works as a chained sequence of mutually exclusive if..elif... equality comparisons, but with a more succinct and readable syntax.
Although you can use pattern matching this way, you’d be missing out on its true power and flexibility. Structural pattern matching was designed to go beyond value comparisons. In particular, it combines conditional statements or branching based on a logical predicate with destructuring or object deconstruction, which is the inverse of object construction. You’ll see examples of destructuring in the next section.
Note: Because pattern matching does two things at once, the Python interpreter can take advantage of this to optimize the underlying bytecode with specialized opcodes, making the code run slightly faster.
The brief code snippet above merely scratches the surface of what you can achieve with pattern matching, but it already shows you its expressiveness, especially when you compare it with the traditional if...elif... statements and isinstance() checks. Here’s one of the many ways you can implement the equivalent logic using standard Python:
Python import json def log(event): parsed_event = json.loads(event) if ( "keyboard" in parsed_event and "key" in parsed_event["keyboard"] and "code" in parsed_event["keyboard"]["key"] ): code = parsed_event["keyboard"]["key"]["code"] print(f"Key pressed: {code}") elif ( "mouse" in parsed_event and "cursor" in parsed_event["mouse"] and "screen" in parsed_event["mouse"]["cursor"] ): screen = parsed_event["mouse"]["cursor"]["screen"] if isinstance(screen, list) and len(screen) == 2: x, y = screen print(f"Mouse cursor: x={x}, y={y}") else: print("Unknown event type") else: print("Unknown event type") Copied!This code is functionally identical to the previous version but is longer and has more indentation levels than before. Additionally, it looks more verbose and imperative in style, describing not only what to do but also how to perform the individual steps. Granted, you could try making it slightly shorter by using the Walrus operator and following the EAFP principle without explicit checks, but it’d remain somewhat convoluted.
It’s worth noting that structural pattern matching first emerged in compiled functional languages with static typing. The attempt to implement it in Python, which is a dynamic language, presented completely new and unique challenges. You can read more about them in the paper entitled Dynamic Pattern Matching with Python, which was co-authored by Guido van Rossum and published in the proceedings of the Dynamic Languages Symposium in 2020.
Now that you’ve seen the most basic form of pattern matching in Python, it’s time to unravel the meaning of a structural pattern.
What Is a Structural Pattern? Read the full article at https://realpython.com/structural-pattern-matching/ »[ 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 ]
LN Webworks: Top 10 Benefits Of Using Drupal For Your Website Development
If you are searching for the best content management system or CMS, then Drupal is the one that can power your website. In case you have not looked into Drupal before this, then you might not know its perks.
Well, do not worry, in this read, you are going to learn about the benefits of using Drupal for your website development. Whether you are an individual, agency, small business, or enterprise, with Drupal you can now create powerful websites and apps.
Top 10 Benefits Of Using Drupal For Your Website DevelopmentThere are many advantages of using Drupal for your website development. Let us delve more into it.
ClearlyDefined’s Steering and Outreach Committees Defined
We are excited to announce the newly elected leaders for the ClearlyDefined Steering and Outreach Committees!
What is ClearlyDefined?ClearlyDefined is an Open Source project dedicated to improving the clarity and transparency of Open Source licensing and security data. By harvesting, curating, and sharing essential metadata, ClearlyDefined helps developers and organizations better understand their software components, ensuring responsible and compliant use of Open Source code.
Steering Committee Election Results:Congratulations to E. Lynette Rayle (GitHub), Qing Tomlinson (SAP), and Jeff Mendoza (Kusari/GUAC) for being elected to the ClearlyDefined Steering Committee. These three community leaders will serve a one-year term starting on September 25, 2024. Following election recommendations, the Steering Committee is structured to have an odd number of members (three in this case) and a maximum of one member per company. Lynette Rayle was elected chair of the committee.
The Steering Committee is primarily responsible for setting the project’s technical direction. They oversee processes such as data harvesting, curation, and contribution, ensuring that the underlying architecture functions smoothly. Their focus is on empowering the community, supporting the contributors and maintainers, and fostering collaboration with related projects.
E. Lynette Rayle is a Senior Engineer at GitHub and has been working on ClearlyDefined as a maintainer for just over a year. GitHub is using ClearlyDefined data in several capacities and has a strong stake in ensuring successful outcomes in data quality, performance, and sustainability.
Qing Tomlinson is a Senior Developer at SAP and has been contributing to the ClearlyDefined project since November 2021. SAP has been actively engaged in the ClearlyDefined project since its inception, utilizing the data and actively contributing to its curation. The quality, performance, and long-term viability of the ClearlyDefined project are of utmost importance to SAP.
Jeff Mendoza is a Software Engineer at Kusari, a software supply chain security startup. He is a maintainer of the OpenSSF GUAC project, which consumes ClearlyDefined data. Formerly, Jeff was a full time developer on ClearlyDefined. Jeff brings experience from both the sides of the project, developer and consumer.
Outreach Committee Election Results:We are also thrilled to announce the election of Jeff Luszcz (GitHub), Alyssa Wright (Bloomberg), Brian Duran (SAP), and Nick Vidal (Open Source Initiative) to lead the ClearlyDefined Outreach Committee. They began their one-year term on October 7, 2024. Unlike the Steering Committee, the Outreach Committee has four members, following a consensus reached at the Community meeting that an even number of members is acceptable since tie-breaking votes are less likely. The elected members will select their Chair soon and may also invite other community members to participate.
The Outreach Committee focuses on promoting the project and growing its community. Their responsibilities include organizing events, creating educational materials, and managing communications across various channels, including blogs, social media, and webinars. They help ensure that more users and contributors engage with ClearlyDefined and understand its mission.
Jeff Luszcz is Staff Product Manager at GitHub. Since 2004, he has helped hundreds of software companies understand how to best use open source while complying with their license obligations and keeping on top of security issues.
Alyssa Wright helps lead Bloomberg’s Open Source Program Office in the Office of the CTO, which is the center of excellence for Bloomberg’s engagements with and consumption of open source software.
Brian Duran leads the implementation strategy for adoption of ClearlyDefined within SAP’s open source compliance teams. He has a combined 12 years of experience in open-source software compliance and data quality management.
Nick Vidal is Community Manager at the Open Source Initiative and former Outreach Chair at the Confidential Computing Consortium from the Linux Foundation. Previously, he was the Director of Community and Business Development at the Open Source Initiative and Director of Americas at the Open Invention Network.
Get Involved!We encourage everyone in the ClearlyDefined community to get involved! Whether you’re a developer, data curator, or simply passionate about Open Source software, your contributions are invaluable. Join the conversation, attend meetings, and share your ideas on how to improve and grow the project. Reach out to the newly elected committee members or participate in our upcoming community events.
Let’s work together to drive the ClearlyDefined mission forward! Stay tuned for more updates and opportunities to participate as the committees continue their important work.