Feeds

Tag1 Consulting: Migrating your Data from D7 to D10: Configuring text formats, editors and user roles

Planet Drupal - Mon, 2024-11-04 09:00

In the previous article, we learned to apply Drupal recipes to add configuration to our Drupal 10 site. In this article, we will continue this process to bring in more configuration related to text formats and editors, user roles, and user fields.

mauricio Mon, 11/04/2024 - 06:00
Categories: FLOSS Project Planets

Real Python: Variables in Python: Usage and Best Practices

Planet Python - Mon, 2024-11-04 09:00

In Python, variables are symbolic names that refer to objects or values stored in your computer’s memory. They allow you to assign descriptive names to data, making it easier to manipulate and reuse values throughout your code.

Understanding variables is key for Python developers because variables are essential building blocks for any Python program. Proper use of variables allows you to write clear, readable, and maintainable code.

In this tutorial, you’ll learn how to:

  • Create and assign values to variables
  • Change a variable’s data type dynamically
  • Use variables to create expressions, counters, accumulators, and Boolean flags
  • Follow best practices for naming variables
  • Create, access, and use variables in their scopes

To get the most out of this tutorial, you should be familiar with Python’s basic data types and have a general understanding of programming concepts like loops and functions.

Don’t worry if you don’t have all this knowledge yet and you’re just getting started. You won’t need this knowledge to benefit from working through the early sections of this tutorial.

Get Your Code: Click here to download the free sample code that shows you how to use variables in Python.

Take the Quiz: Test your knowledge with our interactive “Variables in Python: Usage and Best Practices” quiz. You’ll receive a score upon completion to help you track your learning progress:

Interactive Quiz

Variables in Python: Usage and Best Practices

In this quiz, you'll test your understanding of variables in Python. Variables are symbolic names that refer to objects or values stored in your computer's memory, and they're essential building blocks for any Python program.

Getting to Know Variables in Python

In Python, variables are names associated with concrete objects or values stored in your computer’s memory. By associating a variable with a value, you can refer to the value using a descriptive name and reuse it as many times as needed in your code.

Variables behave as if they were the value they refer to. To use variables in your code, you first need to learn how to create them, which is pretty straightforward in Python.

Creating Variables With Assignments

The primary way to create a variable in Python is to assign it a value using the assignment operator and the following syntax:

Python Syntax variable_name = value Copied!

In this syntax, you have the variable’s name on the left, then the assignment (=) operator, followed by the value you want to assign to the variable at hand. The value in this construct can be any Python object, including strings, numbers, lists, dictionaries, or even custom objects.

Note: To learn more about assignments, check out Python’s Assignment Operator: Write Robust Assignments.

Here are a few examples of variables:

Python >>> word = "Python" >>> number = 42 >>> coefficient = 2.87 >>> fruits = ["apple", "mango", "grape"] >>> ordinals = {1: "first", 2: "second", 3: "third"} >>> class SomeCustomClass: pass >>> instance = SomeCustomClass() Copied!

In this code, you’ve defined several variables by assigning values to names. The first five examples include variables that refer to different built-in types. The last example shows that variables can also refer to custom objects like an instance of your SomeCustomClass class.

Setting and Changing a Variable’s Data Type

Apart from a variable’s value, it’s also important to consider the data type of the value. When you think about a variable’s type, you’re considering whether the variable refers to a string, integer, floating-point number, list, tuple, dictionary, custom object, or another data type.

Python is a dynamically typed language, which means that variable types are determined and checked at runtime rather than during compilation. Because of this, you don’t need to specify a variable’s type when you’re creating the variable. Python will infer a variable’s type from the assigned object.

Note: In Python, variables themselves don’t have data types. Instead, the objects that variables reference have types.

For example, consider the following variables:

Python >>> name = "Jane Doe" >>> age = 19 >>> subjects = ["Math", "English", "Physics", "Chemistry"] >>> type(name) <class 'str'> >>> type(age) <class 'int'> >>> type(subjects) <class 'list'> Copied! Read the full article at https://realpython.com/python-variables/ »

[ 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

Golems GABB: Best Practices for REST APIs in Drupal 11

Planet Drupal - Mon, 2024-11-04 08:19
Best Practices for REST APIs in Drupal 11 Editor Mon, 11/04/2024 - 15:19

Are you worried about how to make your Drupal REST APIs efficient and secure yet fulfil today's needs? As Drupal 11 looms on the horizon, both developers and Drupal website owners are looking forward to using its benefits to create robust APIs. 
However, with much power comes great responsibility, and figuring out the best methods for creating REST API can seem very difficult. Are you prepared to use its full capability? In this article, the Golems company delves into the best practices for REST APIs in Drupal 11.

Categories: FLOSS Project Planets

Sven Hoexter: Google CloudDNS HTTPS Records with ipv6hint

Planet Debian - Mon, 2024-11-04 08:11

I naively provisioned an HTTPS record at Google CloudDNS like this via terraform:

resource "google_dns_record_set" "testv6" { name = "testv6.some-domain.example." managed_zone = "some-domain-example" type = "HTTPS" ttl = 3600 rrdatas = ["1 . alpn=\"h2\" ipv4hint=\"198.51.100.1\" ipv6hint=\"2001:DB8::1\""] }

This results in a permanent diff because the Google CloudDNS API seems to parse the record content, and stores the ipv6hint expanded (removing the :: notation) and in all lowercase as 2001:db8:0:0:0:0:0:1. Thus to fix the permanent diff we've to use it like this:

resource "google_dns_record_set" "testv6" { name = "testv6.some-domain.example." managed_zone = "some-domain-example" type = "HTTPS" ttl = 3600 rrdatas = ["1 . alpn=\"h2\" ipv4hint=\"198.51.100.1\" ipv6hint=\"2001:db8:0:0:0:0:0:1\""] }

Guess I should be glad that they already support HTTPS records natively, and not bicker too much about the implementation details.

Categories: FLOSS Project Planets

Robin Wilson: Join the GeoTAM hackathon to work out business turnovers!

Planet Python - Mon, 2024-11-04 06:04

Summary: I’m involved in organising a hackathon, and I’d love you to take part. The open-source GeoTAM hackathon focuses on estimating turnover for individual business locations in the UK, from a variety of open datasets. Please checkout the hackathon page and sign up. There are prizes of up to £2,000!


(Click image for a larger version)

I’m currently working with Rebalance Earth, a boutique asset manager who are focused on making nature an investable asset. Our aim is to mobilise investment in UK natural infrastructure – for example, by arranging investment to undertake river restoration and reduce the risk of flooding. We will do this by finding businesses at risk of flooding, designing restoration schemes that will reduce this risk, and setting up ‘Nature-as-a-Service’ contracts with businesses to pay for the restoration.

I’m the Lead Geospatial Developer at Rebalance Earth, and am leading the development of our Geospatial Predictive Analytics Platform (GPAP), which helps us assess businesses at risk of flooding and design schemes to reduce this flooding.

An important part of deciding which areas to focus on is estimating the total business value at risk from flooding. A good way of establishing this is to use an estimate of the business turnover. However, there are no openly-available datasets showing business turnover in the UK – which is where the hackathon comes in.

We’re looking for participants to bring their expertise in programming, data science, machine learning and more to take some datasets we provide, combine them with other open data and try and estimate turnover. Specifically, we’re interested in turnover of individual business locations – for example, the turnover of a specific supermarket, not the whole supermarket chain.

The hackathon runs from 20th – 26th November 2024. We’ll provide some datasets, some ideas, and a Discord server to communicate through. We’d like you to bring your expertise and see what you can produce. This is a tricky task, and we’re not expecting fully polished solutions; proof-of-concept solutions are absolutely fine. You can enter as a team or an individual.

Most importantly, there are prizes:

  • £2,000 for the First Prize
  • £1,000 for the Second Prize
  • £500 for the Third Prize

and there’s a possibility that we might even hire you to continue work on your idea!

So, please sign up and tell your friends!

Categories: FLOSS Project Planets

C++20 comparison in Qt (even with C++17🤩)

Planet KDE - Mon, 2024-11-04 04:43

In the Qt 6.7 release, we enabled support for C++20 comparison and also back-ported some of its features to C++17. This blog post will give you an overview of the comparison enhancements we are taking advantage of and offer guidance on implementing them in your custom classes.

Categories: FLOSS Project Planets

Python Bytes: #408 python-preference only-managed 3.13t

Planet Python - Mon, 2024-11-04 03:00
<strong>Topics covered in this episode:</strong><br> <ul> <li><strong><a href="https://nedbatchelder.com/blog/202410/github_action_security_zizmor.html?featured_on=pythonbytes">GitHub action security: zizmor</a></strong></li> <li><a href="https://github.blog/news-insights/octoverse/octoverse-2024/?featured_on=pythonbytes"><strong>Python is now the top language on GitHub</strong></a></li> <li><strong><a href="https://www.bitecode.dev/p/python-313-what-didnt-make-the-headlines?featured_on=pythonbytes">Python 3.13, what didn't make the headlines</a></strong></li> <li><a href="https://us.pycon.org/2025/?featured_on=pythonbytes"><strong>PyCon US 2025</strong></a></li> <li><strong>Extras</strong></li> <li><strong>Joke</strong></li> </ul><a href='https://www.youtube.com/watch?v=9pyPp5lLSfI' style='font-weight: bold;'data-umami-event="Livestream-Past" data-umami-event-episode="408">Watch on YouTube</a><br> <p><strong>About the show</strong></p> <p>Sponsored by:</p> <ul> <li><a href="https://pythonbytes.fm/scout"><strong>ScoutAPM</strong></a> - Django Application Performance Monitoring</li> <li><a href="https://pythonbytes.fm/codeium"><strong>Codeium</strong></a> - Free AI Code Completion &amp; Chat </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 <strong>Monday</strong> 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>Brian #1:</strong> <a href="https://nedbatchelder.com/blog/202410/github_action_security_zizmor.html?featured_on=pythonbytes">GitHub action security: zizmor</a></p> <ul> <li>Article: Ned Batchelder </li> <li>zizmor: William Woodruff &amp; others</li> <li>“a new tool to check your GitHub action workflows for security concerns.”</li> <li>Install with cargo or brew, then point it at workflow yml files.</li> <li>It reports security concerns.</li> </ul> <p><strong>Michael #2:</strong> <a href="https://github.blog/news-insights/octoverse/octoverse-2024/?featured_on=pythonbytes"><strong>Python is now the top language on GitHub</strong></a></p> <ul> <li>Thanks to Pat Decker for the heads up.</li> <li>A rapidly growing number of developers worldwide <ul> <li>This suggests AI isn’t just helping more people learn to write code or build software faster—it’s also attracting and helping more people become developers. First-time open source contributors continue to show wide-scale interest in AI projects. But we aren’t seeing signs that AI has hurt open source with low-quality contributions.</li> </ul></li> <li>Python is now the most used language on GitHub as global open source activity continues to extend beyond traditional software development. <ul> <li>The rise in Python usage correlates with large communities of people joining the open source community from across the STEM world rather than the traditional community of software developers.</li> </ul></li> <li>There’s a continued increase in first-time contributors to open source projects. 1.4 million new developers globally joined open source with a majority contributing to commercially backed and generative AI projects. <ul> <li>Notably, we did not see a rise in rejected pull requests. This could indicate that quality remains high despite the influx of new contributors.</li> </ul></li> </ul> <p><strong>Brian #3:</strong> <a href="https://www.bitecode.dev/p/python-313-what-didnt-make-the-headlines?featured_on=pythonbytes">Python 3.13, what didn't make the headlines</a></p> <ul> <li>Some pretty cool updates to pdb : the command line Python debugger <ul> <li>multiline editing</li> <li>code completion </li> </ul></li> <li>pathlib has a bunch of performance updates</li> <li>python -m venv adds a .gitignore file that auto ignores the venv.</li> </ul> <p><strong>Michael #4:</strong> <a href="https://us.pycon.org/2025/?featured_on=pythonbytes"><strong>PyCon US 2025</strong></a></p> <ul> <li>Site is live with CFP and dates</li> <li><a href="https://us.pycon.org/2025/about/health-safety-guidelines/?featured_on=pythonbytes">Health code</a> is finally reasonable: “Masks are Encouraged but not Required”</li> <li>PyCon US 2025 Dates <ul> <li>Tutorials - May 14-15, 2025</li> <li>Sponsor Presentations - May 15, 2025</li> <li>Opening Reception - May 15, 2025</li> <li><strong>Main Conference and Online - May 16-18, 2025</strong></li> <li>Job Fair - May 18, 2025</li> <li>Sprints - May 19-May 22, 2025</li> </ul></li> </ul> <p><strong>Extras</strong> </p> <p>Brian:</p> <ul> <li><a href="https://micro.webology.dev/2024/11/02/please-publish-and.html?featured_on=pythonbytes">Please publish and share more</a> - Jeff Triplett</li> </ul> <p>Michael:</p> <ul> <li><a href="https://github.com/tox-dev/pre-commit-uv?featured_on=pythonbytes">pre-commit-uv</a> <ul> <li>Just spoke with Sefanie Molin <a href="https://talkpython.fm/episodes/show/482/pre-commit-hooks-for-python-devs?featured_on=pythonbytes">about pre-commit hooks on Talk Python</a></li> </ul></li> <li><a href="https://blog.omnivore.app/p/omnivore-is-joining-elevenlabs?featured_on=pythonbytes">Curse you Omnivore</a>!</li> <li>We have moved to <a href="https://www.hetzner.com/cloud/?featured_on=pythonbytes">hetzner</a> </li> <li><a href="https://typora.io?featured_on=pythonbytes">Typora markdown app</a></li> <li>free-threaded Python is now available via <a href="https://docs.astral.sh/uv?featured_on=pythonbytes">uv</a> <pre><code>uv self update uv python install --python-preference only-managed 3.13t </code></pre></li> </ul> <p><strong>Joke:</strong> <a href="https://devhumor.com/media/coding-chair-vs-debugging-chair?featured_on=pythonbytes">Debugging char</a></p>
Categories: FLOSS Project Planets

Zato Blog: Meaningful automation in Python

Planet Python - Mon, 2024-11-04 03:00
Meaningful automation in Python 2024-11-04, by Dariusz Suchojad

This article is an introduction to meaningful automation, integrations and interoperability with Zato, service-oriented thinking and Python.

Zato is a convenient and secure, Python-based, open-source, service-oriented platform for automation, integrations and interoperability. It is used to connect distributed systems or data sources and to build API-focused, middleware and backend applications.

The platform is designed and built specifically with Python users in mind - often working in, and for, industries such as telecommunications, defense, health care and others that require automation, integrations and interoperability of multiple systems and processes.

Sample real-world, mission-critical Zato environments include:

  • Systems for telecommunication operators integrating CRM, ERP, Charging Systems, Billing and other OSS/BSS applications internal or external to the operators, including network automation of packet brokers and other network visibility and cybersecurity tools from Keysight

  • Enterprise services buses for government, helping in the digital transformation of legacy systems and processes towards modern capabilities

  • AI, ML and data science systems that analyze and improve acquisition and supply chain activities in government processes

  • Applied observability automation that enables meaningful decision making through the orchestration and coordination of the collection, distribution and presentation of data spread across a pool of independent systems

  • Platforms for health care and public administration systems, helping to achieve data interoperability through the integration of independent data sources, databases and health information exchanges (HIE)

  • Global IoT platforms for hybrid integrations of medical devices and software both in the cloud and on premises

  • Cybersecurity automation, including IT/OT hardware and software assets

  • Robotic process automation (RPA) of message flows and events produced by early warning systems

Zato offers connectors to all the popular technologies and vendors, such as REST, Cloud, task scheduling, Microsoft 365, Salesforce, Atlassian, SAP, Odoo, SQL, HL7, FHIR, AMQP, IBM MQ, LDAP, Redis, MongoDB, WebSockets, SOAP, Caching and many more.

Running in the cloud, on premises, or under Docker, Kubernetes and other container technologies, Zato services are optimized for high performance and security - it is easily possible to run hundreds and thousands of services on typical server instances as offered by Amazon, Google Cloud, Azure or other cloud providers.

Zato servers offer high availability and no-downtime deployment. Servers form clusters that are used to scale systems both horizontally and vertically.

The product is commercial open-source software with training, professional services and enterprise 24x7x365 support available.

A platform and language for interesting, reusable and atomic services

Zato promotes the design of, and helps you build, solutions composed of services that are interesting, reusable and atomic (IRA).

What does it really mean in practice that something is interesting, reusable and atomic? In particular, how do we define what is interesting?

Each interesting service should make its users want to keep using it more and more. People should immediately see the value of using the service in their processes. An interesting service strikes everyone as immediately useful in wider contexts, preferably with few or no conditions, prerequisites and obligations.

An interesting service is aesthetically pleasing, both in terms of its technical usage as well as its relevance to, and potential applicability in, fields broader than originally envisioned. If people check the service and say "I know, we will definitely use it" or "Why don't we use it" you know that the service is interesting. If they say "Oh no, not this one again" or "No, thanks, but no" then it is the opposite.

Note that focus here is on the value that the service brings for the user. You constantly need to keep in mind that people generally want to use services only if they allow them to fulfill their plans or execute some bigger ideas. Perhaps they already have them in mind and they are only looking for technical means of achieving that or perhaps it is your services that will make a person realize that something is possible at all, but the point is the same, your service should serve a grander purpose.

This mindset, of wanting to build things that are useful and interesting is not specific to Python or, indeed, to software and technology. Even if you are designing and implementing services for your own purposes, you need to act as if you were a consultant that can always see a bigger vision, a bigger architecture, and who can envision results that are still ahead in the future while at the same time not forgetting that it is always a series of small interesting actions, that everyone can relate to, that lead to success.

A curious observation can be made, particularly when you consider all the various aspects of the digital transformation that companies and organizations go through, is that many people to whom the services are addressed, or who sponsor their development, are surprised when they see what automation and integrations are capable.

Put differently, many people can only begin to visualize bigger designs once they see in practice smaller, practical results that further their missions, careers and otherwise help them at work. This is why, again, the focus on being interesting is essential.

At the same, it can be at times advantageous to you that people will not see automation or integrations coming. That lets you take the lead and build a center of such a fundamental shift around yourself. This is a great position to be in, a blue ocean of possibilities, because it means little to no competition inside an organization that you are a part of.

If you are your own audience, that is, if you build services for your own purposes, the same principles apply and it is easy to observe that thinking in services lets you build a toolbox of reusable, complementary capabilities, a portfolio, that you can take with you as you progress in your career. For instance, your services, and your work, can concentrate on a particular vendor and with a set of services that automate their products, you will be always able to put that into use, shorting your own development time, no matter who employs you and in what way.

Regardless of who the clients that you build the solutions for are, observe that automation and integrations with services are evolutionary and incremental in their nature, at least initially. Yes, the resulting value can often be revolutionary but you do not intend to incur any massive changes until there are clear, interesting results available. Trying to integrate and change existing systems at the same time is doable, but not trivial, and it is best left to later stages, once your automation gets the necessary buy-in from the organization.

Services should be ready to be used in different, independent processes. The processes can be strictly business ones, such as processing of orders or payments, or they can be of a deep, technical nature, e.g. automating cybersecurity hardware. What matters in either case is that reusability breeds both flexibility and stability.

There is inherent flexibility in being able to compose bigger processes out of smaller blocks with clearly defined boundaries, which can easily translate to increased competitive advantage when services are placed into more and more areas. A direct result of this is a reduction in R&D time as, over time, you are able to choose from a collection of loosely-coupled components, the services, that hide implementation details of a particular system or technology that they automate or integrate with.

Through their continued use in different processes, services can reduce overall implementation risks that are always part of any kind of software development - you will know that you can keep reusing stable functionality that has been already well tested and that is used elsewhere.

Because services are reusable, there is no need for gigantic, pure waterfall-style implementations of automation and integrations in an organization. Each individual project can contribute a smaller set of services that, as a whole, constitute the whole integrated environment. Conversely, each new project can start to reuse services delivered by the previous ones, hence allowing you to quickly, incrementally, prove the value of the investment in service-oriented thinking.

To make them reusable, services are designed in a way that hides their implementation details. Users only need to know how to invoke the service; the specific systems or processes it automates or integrates are not necessarily important for them to know as long as a specific business goal is achieved. Thanks to that, both services and what they integrate can be replaced without disrupting other parts - in reality, this is exactly what happens - systems with various kinds of data will be changed or modernized but the service will stay the same and the user will not notice anything.

Each service fulfills a single, atomic business need. Each service is deployed independently and, as a whole, they constitute an implementation of business processes taking place in your company or organization. Note that the definition of what the business need is, again, specific to your own needs. In purely market-oriented integrations, this may mean, for instance, the opening of a bank account. In IT or OT automation, on the other hand, it may mean the reconfiguration of a specific device.

That services are atomic also means that they are discrete and that their functionality is finely grained. You will recognize whether a design goes in this direction if consider the names of the services for a moment. An atomic service will invariably use a short name consisting of a single verb and noun. For instance, "Create Customer Account", "Stop Firewall", "Conduct Feasibility Study", it is easy to see that we cannot break them down into smaller part, they are atomic.

At the same time, you will keep creating composite services that invoke other services; this is natural and as expected but you will not consider services such as "Create Customer Account and Set Up a SIM Card" as atomic ones because, in that form, they will not be very reusable, and a major part of why being atomic is important is that it promotes reusability. For instance, having separate services to create customer accounts, independently of setting up their SIM cards, is that one can without difficulty foresee situations when an account is created but a SIM card is purchased at a later time and, conversely, surely one customer account should be able to potentially have multiple SIM cards. Think of it as being similar to LEGO bricks where just a few basic shapes can form millions of interesting combinations.

The point about service naming conventions is well worth remembering because this lets you maintain a vocabulary that is common to both technical and business people. A technical person will understand that such naming is akin to the CRUD convention from the web programming world while a business person will find it easy to map the meaning to a specific business function within a broader business process.

With Zato, you use Python to focus on the business logic exclusively and the platform takes care of scalability, availability communications protocols, messaging, security or routing. This lets you concentrate only on what is the very core of systems integrations - making sure their services are interesting, reusable and atomic.

Python is the perfect choice for this job because it hits the sweet spot under several key headings:

  • It is a very high level language, with a syntax close to how grammar of various spoken languages works, which makes it easy to translate business requirements into implementation

  • It is a solid, mainstream and full-featured, real programming language rather than a domain-specific one which means that it offers a great degree of flexibility and choice in expressing their needs

  • It is difficult to find universities without Python courses. Most people entering the workforce already know Python, it is a new career language. In fact, it is becoming more and more difficult to find new talent who would not prefer to use Python.

  • Yet, one does not need to be a developer or a full-time programmer to use Python. In fact, most people who use Python are not programmers at all. They are specialists in other fields who also need to use a programming language to automate or integrate their work in a meaningful way.

  • Many Python users come from backgrounds in network and cybersecurity engineering - fields that naturally require a lot of automation using a real language that is convenient and easy to get started with

  • Many Python users are scientists with a background in AI, ML and data science, applying their domain-specific knowledge in processes that, by their very nature, require them to collect and integrate data from independent sources, which again leads to automation and integrations

  • Many Python users have a strong web programming background which means that it takes little effort to take a step further, towards automation and integrations. In turn, this means that it is easy to find good people for API projects.

  • Many Python users know multiple programming languages - this is very useful in the context of integration projects where one is typically faced with dozens of technologies, vendors or integration methods and techniques.

  • Lower maintenance costs - thanks to the language's unique design, Python programmers tend to produce code that is easy to read and understand. From the perspective of multi-year maintenance, reading and analyzing code, rather than writing it, is what most programmers do most of the time, making sense to use a language that makes it easy to carry out the most common tasks.

In short, Python can be construed as executable pseudo-code with many of its users already having roots in modern server-side programming so Zato, both from a technical and strategic perspective, is a natural choice for both simple and complex, sophisticated automation, integration and interoperability solutions as a platform built in the language and designed for Python people from day one.

Next steps:

➤ Read about how to use Python to build and integrate enterprise APIs that your tests will cover
➤ Python API integration tutorial
Python Integration platform as a Service (iPaaS)
What is an Enterprise Service Bus (ESB)? What is SOA?

More blog posts
Categories: FLOSS Project Planets

James Bennett: Three Django wishes

Planet Python - Sun, 2024-11-03 20:57
<p>’Tis the season when people are posting their “Django wishlists”, for specific technical or organizational or community initiatives they’d like to see undertaken. Here are a few&nbsp;examples:</p> <ul> <li><a href="https://gist.github.com/sarahboyce/68ffaaeae24d2501cf27a914f77fb97c">Sarah&nbsp;Boyce</a></li> <li><a href="https://www.better-simple.com">Tim&nbsp;Schilling</a></li> <li><a href="https://softwarecrafts.co.uk/100-words/day-203">Andy&nbsp;Miller</a></li> <li><a href="https://emma.has-a.blog/articles/django-wishlist-explained.html">Emma&nbsp;Delescolle</a></li> </ul> <p>So, in the spirit of the season, here is my own list, which I’ve narrowed down to three wishes (in the tradition of many stories about wishes), consisting of one organizational item and two technical&nbsp;ones.</p> <h3>Pass the&nbsp;torch</h3> <p>This one requires a bit of background, so please bear with&nbsp;me.</p> <p><a href="https://www.djangoproject.com/foundation/">The Django Software Foundation</a> — usually just abbreviated “<span class="caps">DSF</span>” — is the nonprofit organization which officially “owns” Django. It’s the legal holder of all the intellectual property, including both the copyright to the original Django codebase (generously donated by the Lawrence Journal-World, where it was first developed) and the trademarks, such as the registered trademark on the name “Django” itself. The <span class="caps">DSF</span> does a lot (and could do more, with a bigger budget) to support the Django community, and offers financial support to the development of Django itself, but does <em>not</em> directly develop Django, or oversee Django’s development or technical&nbsp;direction.</p> <p>Originally, that job went to Django co-creators Adrian Holovaty and Jacob Kaplan-Moss. They granted commit permissions to a growing team of collaborators, but remained the technical leaders of the Django project until 2014, when they stepped aside and a new body, called the Technical Board, was introduced to replace them. The Technical Board was elected by the Django committers — by this point usually referred to as “Django Core” — and although the committers continued to have broad authority to make additions or changes to Django’s codebase, the Technical Board became the ultimate decision-maker for things that needed a tie-breaking vote, or that were too large for a single committer to do solo (usually via Django Enhancement Proposals, or DEPs, modeled on the processes of many other open-source projects, including Python’s&nbsp;“PEPs”).</p> <p>One thing the <span class="caps">DSF</span> <em>has</em> done is use some of its funds on <a href="https://www.djangoproject.com/fundraising/#fellowship-program">the Django Fellowship program</a>, which pays contractors (the “Django Fellows”) to carry out tasks like ticket triage, pull-request review, etc. which would otherwise rely on volunteer labor (with all the problems that&nbsp;involves).</p> <p>But the system of “Django Core” committers and Technical Board did not work out especially well. Many of the committers were either intermittently active or just completely inactive, new committers were added rarely if ever, and it was unclear what sort of path there was (or even if there <em>was</em> a path) for a motivated contributor to work their way toward committer status. About the only thing that did work well was the Fellowship program, which largely was what kept Django running as a software project toward the end of that&nbsp;era.</p> <p>This caused a lot of debates focused on the theme of what to do about “Django Core” and how to reform the project and get it back on a healthy footing. The end result of that was a Django Enhancement Proposal numbered as <span class="caps">DEP</span> 10, which I spent most of 2018 and 2019 working on. I <a href="https://www.b-list.org/weblog/2018/nov/20/core/">wrote an explanation at the time</a>, and I’ll just link it here and mention that <span class="caps">DEP</span> 10 (which passed <a href="https://www.djangoproject.com/weblog/2020/mar/12/governance/">in early 2020</a>) kept the Technical Board as a tie-breaking and oversight body, and introduced two other main roles — “Mergers” and “Releasers” — which have mostly but not exclusively been filled by the Django Fellows. The first <span class="caps">DEP</span> 10 Technical Board drafted and passed another <span class="caps">DEP</span>, <span class="caps">DEP</span> 12, renaming themselves to “Steering Council” (similar to Python’s technical governing body, but a name I’ve never liked because the Django version doesn’t meaningfully “steer” Django) and making a few&nbsp;tweaks.</p> <p>So, that brings us to the present day. Where, sadly, the <span class="caps">DEP</span> 10/12 era is looking like as much of a failure as the preceding “Django Core” + committer-elected Technical Board era. The <span class="caps">DEP</span> 10 Technical Boards/Steering Councils have been dysfunctional at best, and there’s been no influx of new people from outside the former “Django Core”. A stark example: I ran for the the Steering Council last year to try to work on fixing some of this, but the Steering Council election attracted only four total candidates for five seats, all of them former “Django Core”&nbsp;members.</p> <p>Recently there was a lot of discussion on the <span class="caps">DSF</span> members’ forum about what to do with the Steering Council, and a few attempts to take action which failed in frustrating ways. The end result was the resignation of two Steering Council members, which brought the group below quorum and has automatically triggered an election (though one that will run under the existing <span class="caps">DEP</span> 10/12 rules, since triggering an election locks the eligibility and election rules against&nbsp;changes).</p> <p>I believe the ongoing inability to develop stable technical governance and meaningful turnover of technical leadership is the single greatest threat to Django’s continued viability as a project. This is an unfortunate vindication of what I said six years ago in that blog post about developing <span class="caps">DEP</span>&nbsp;10:</p> <blockquote> <p>Django’s at risk of being badly off in the future; for some time now, the project has not managed to bring in new committers at a sufficient rate to replace those who’ve become less active or even entirely inactive, and that’s not sustainable for much&nbsp;longer.</p> </blockquote> <p>The good news is there’s a new generation of contributors who I believe are more than ready to take up the technical leadership of Django, and even a structured program — <em>not</em> run by former “Django Core”! — <a href="https://djangonaut.space">for recruiting and mentoring new contributors on an ongoing basis and helping them build familiarity with working on and contributing to Django</a>. The bad news is there’s a huge obstacle in their way: all of us old-time “Django Core” folks who keep occupying all the official leadership positions. Just recruiting people to run against such long-time well-known names in the project is difficult, and actually <em>winning</em> against us probably close to&nbsp;impossible.</p> <p>So the biggest thing I’d like for Django, right now, is for the entire former “Django Core” group — myself included! — to simply <em>get out of the way</em>. I thought I could come back last year and help fix things after stepping down post-<span class="caps">DEP</span>-10, but doing so was a mistake and only prolonged the problem. I will not be running in the upcoming Steering Council election and I <em>beg</em> my “Django Core” colleagues to all do likewise. There are qualified, motivated folks out there who should be given their chance to step up and run things, and we should collectively place Django into their capable hands. Then they can sort out the rest of the technical governance however they see&nbsp;fit.</p> <p>And honestly, I’ve been in and out of just about every formal role the Django project has for (checks calendar) seventeen years now. It’s <em>time</em>. It’s time for me, and the rest of the old guard, to give way to new folks before we do serious harm to Django by continuing to hold on to leadership&nbsp;roles.</p> <h3>Give Django a&nbsp;hint</h3> <p>Python 3.0 introduced the ability to add “annotations” to function and method declarations, and though it didn’t specify what they were to be used for, people almost immediately started developing ways to specify static type information via annotations, which came to be known as “type hints”. Python 3.5 formalized this and introduced <a href="https://docs.python.org/3/library/typing.html">the <code>typing</code> module in the standard library</a> with tools to make the type-hint use case easier, and Python 3.6 introduced the ability to annotate other names, including standalone variables and class&nbsp;attributes.</p> <p>Django has a complicated history with this feature of modern Python. There’ve been multiple efforts to add type annotations directly in Django’s own code, there’s <a href="https://pypi.org/project/django-stubs/">a third-party package</a> which provides annotations as an add-on, <a href="https://github.com/django/deps/pull/65">a proposed <span class="caps">DEP</span></a> never went anywhere because <a href="https://groups.google.com/g/django-developers/c/C_Phs05kL1Q/m/fE301y-JCQAJ">the Technical Board at the time was against it</a>, and it’s just been stuck as a frequently-requested feature ever&nbsp;since.</p> <p>Let me be absolutely clear: I don’t have any issue with statically-typed programming languages as a concept. I’ve used both statically- and dynamically-typed languages and liked and disliked examples of each. If I weren’t writing Python, personally I probably would be writing C# (statically-typed). But I also have absolutely no interest in static type checking for Python as a feature or a use&nbsp;case.</p> <p>What I <em>do</em> have an interest in is all the other use cases type hints enable. There’s a whole booming ecosystem of modern Python tools out there now which use type hints to enable all sorts of interesting <em>runtime</em> behavior. <a href="https://docs.pydantic.dev/latest/">Pydantic</a> and <a href="https://jcristharif.com/msgspec/">msgspec</a> do runtime derivation of validation and serialization/deserialization behavior from type hints. <a href="https://fastapi.tiangolo.com">FastAPI</a> and <a href="https://litestar.dev">Litestar</a> are web frameworks which use type hints to drive input/output schemas, dependency injection and more. <a href="https://www.sqlalchemy.org">SQLAlchemy</a> as of version 2.0 can use type hints to drive <span class="caps">ORM</span> class&nbsp;definitions.</p> <p>I am <em>very</em> interested in those sorts of things, and right now they’re not available from vanilla Django because Django doesn’t do type hints (you can use <a href="https://django-ninja.dev">a third-party package</a> to turn Django into something resembling one of the newer type-hint-driven frameworks, but it’s an extra package and a whole new way of doing things that doesn’t “feel like&nbsp;Django”).</p> <p>Compare, for example, this Django <span class="caps">ORM</span>&nbsp;model:</p> <div class="codehilite"><pre><span></span><code><span class="kn">from</span> <span class="nn">django.db</span> <span class="kn">import</span> <span class="n">models</span> <span class="k">class</span> <span class="nc">Person</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span> <span class="n">name</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">CharField</span><span class="p">()</span> <span class="n">date_of_birth</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">DateField</span><span class="p">()</span> </code></pre></div> <p>With its modern SQLAlchemy&nbsp;equivalent:</p> <div class="codehilite"><pre><span></span><code><span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">date</span> <span class="kn">from</span> <span class="nn">sqlalchemy.orm</span> <span class="kn">import</span> <span class="n">DeclarativeBase</span><span class="p">,</span> <span class="n">Mapped</span> <span class="n">Base</span> <span class="o">=</span> <span class="n">DeclarativeBase</span><span class="p">()</span> <span class="k">class</span> <span class="nc">Person</span><span class="p">(</span><span class="n">Base</span><span class="p">):</span> <span class="n">__tablename__</span> <span class="o">=</span> <span class="s2">&quot;person&quot;</span> <span class="n">name</span><span class="p">:</span> <span class="n">Mapped</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="n">date_of_birth</span><span class="p">:</span> <span class="n">Mapped</span><span class="p">[</span><span class="n">date</span><span class="p">]</span> </code></pre></div> <p>You <em>can</em> use SQLAlchemy’s <code>mapped_column()</code> function to be more verbose and specify a bunch more information, but for a basic column you <em>don’t have to</em>. Just write a type hint and it does the right&nbsp;thing.</p> <p>I think type hint support in Django has the potential to unlock a huge variety of useful new features and conveniences, and the lack of it is causing Django to fall well behind the current state of the art in Python web development. So if I could somehow wave a magic wand and get any single technical change instantly made to Django, type hints would be&nbsp;it.</p> <h3>More generic&nbsp;Django</h3> <p>Django includes a feature known as “generic views” (keep in mind that Django doesn’t strictly follow regular <span class="caps">MVC</span> terminology, and so a Django “view” is what most pure <span class="caps">MVC</span> implementations would call the “controller”), which are reusable implementations of common operations like “<span class="caps">CRUD</span>” (create, retrieve, update, delete operations — including both individual-result and list-of-results), date-based archives of data,&nbsp;etc.</p> <p>And basically everybody agrees Django’s generic views are too complicated. There’s a giant complex <a href="https://docs.djangoproject.com/en/5.1/ref/class-based-views/">inheritance tree of classes</a> involved, with a huge mess of different attributes and methods you can set or override to affect behavior depending on exactly which set of classes you’re inheriting from, creating a steep learning curve and requiring even experienced developers to spend a lot of time with both official and unofficial documentation (<a href="https://ccbv.co.uk">ccbv.co.uk</a> is the usual reference people are directed&nbsp;to).</p> <p>There’s a reason for this complexity: originally, Django’s generic views were <em>functions</em>, not classes, and you customized their behavior by passing arguments to them. The class-based generic views were introduced in Django 1.3 (released in 2011), and for compatibility and ease of migration at the time, were implemented in a way which <em>precisely</em> mirrored the functionality of the function-based views. Which means that for every thing you could do via an argument to the function-based views, there is a mixin class, method, or attribute on the class-based ones corresponding to&nbsp;it.</p> <p>This made some sense at the time, because it was a big migration to ask people to go through. It makes much less sense now, over 13 years later, when the complexity of Django’s hierarchy of class-based views mostly just scares people and makes them not want to use what is otherwise a pretty useful feature: class-based views are a huge reduction in repetitive/boilerplate code when you know how to use them (for example, see <a href="https://github.com/ubernostrum/b_list/blob/main/blog/views.py">the views used by this site</a> for date-based browsing of entries and detail/list views of entries by category — that really is all the code needed to provide all the backend&nbsp;logic).</p> <p>At this point the overcomplexity of Django’s generic views is basically a meme in the community, and is one of the things I see most often cited by new Django users as making their experience difficult. So if I were going to be given the magic wand a second time and allowed to make another instant technical change, it’d be to finally deprecate the complicated generic-view class hierarchy and replace it with a ground-up rewrite aimed at providing a clear, powerful <span class="caps">API</span> rather than maintaining compatibility with a set of older functions that were deprecated nearly a decade and a half&nbsp;ago.</p> <h3>What do you wish&nbsp;for?</h3> <p>Of course, there’s a lot more that <em>could</em> be done to or for Django besides the three items I’ve outlined here. I’d encourage anyone who uses Django to think about what <em>they’d</em> like to see, to post about it, and, ideally, to get involved with Django’s development. That’s not just a way to get bits of your own wishlist implemented; it’s also the way to make sure Django continues to be around for people to have wishes about, and I hope that continues for many years to&nbsp;come.</p>
Categories: FLOSS Project Planets

Michael Foord: Python Knowledge Sharing Videos Online

Planet Python - Sun, 2024-11-03 19:00
.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

I’ve been teaching Python in one hour knowledge sharing sessions, some of which I’ve put online on youtube.

This is the link to the playlist of the sessions:

The slides for each of the sessions, along with some example code, can be found in this github repository:

So far there are seven one-hour sessions (with more planned) on:

  • Python Core Object Model
    • Python objects
    • Slots
    • Attribute lookup and the MRO
    • Inheritance, multiple inheritance and super
    • Inside Python objects and classes
  • Closures and decorators (functional programming)
    • Functional programming: higher order functions and functions as objects
    • Lambdas
    • Closures: functions that build functions
    • Variable scoping: global, local and nonlocal
    • Decorators: functions wrapping functions
    • Decorator factories (decorators that take arguments)
    • Class decorators
    • Decorator order and using functools.wraps
  • Generators and Iterators
    • The iteration protocol
    • Stateful iteration with generators
    • Adding iteration support to objects
    • References, assignment and mutability
    • Identity versus equality
    • Call by object
    • Object copying
  • Unicode, Floats and regex
    • Floating point numbers
    • Unicode, encodings and strings
    • Regular expressions
  • Concurrency (async, threads, processes, the GIL)
    • The history of concurrency from AmigaOS to a multi-core world
    • Python and the Global Interpreter Lock
    • I/O bound and CPU bound tasks
    • Threads and processes
    • Async programming (green threading, coroutines)
    • Concurrency with threads
    • Concurrency with multiprocessing
    • Looking to the future (Python 3.13): optional GIL (PEP 703) and subinterpreters (PEP 554)
  • Testing with pytest
    • virtual environments and pipenv (installing pytest)
    • pytest command line for collecting and running tests
    • Simple test functions and asserts
    • Test fixtures and conftest.py
    • Testing exceptions
    • Test parameterisation for test combinations
    • Test marking for running test subsets
    • Principles of testing (unit tests versus end to end testing, building test helpers etc)
    • Mocking and patching
  • Modules and Namespaces
    • Import syntax variations
    • namespaces and variable lookups
    • sys.modules and the import cache
    • Module objects
    • Module level functionality: __dir__ and __getattr__
    • Packages and the filesystem
    • Relative import syntax
    • Module reloading (how to do it and why not to do it)
    • Circular imports, avoiding and fixing
    • Executable modules and packages
Other Talks

A selection of some of the talks and interviews I’ve given on Python and software engineering across my career.

Categories: FLOSS Project Planets

Michael Foord: Agile Alliance Scrummaster Certification

Planet Python - Sun, 2024-11-03 19:00

I’ve been a fan of Agile ever since my first programming job with Resolver Systems back in 2006. I had taught myself programming and there I really learned engineering, how to build software products whilst caring about quality. I became passionate about testing as a way to ensure a minimal level of quality and about agile processes which are able to change quickly.

My only experience of Scrum was for a year at a heavily waterfall shop which layered Scrum for project management on top of heavily waterfall software development processes. It wasn’t a fun experience but I still learned a great deal.

I’ve been working with Gigaclear, as team lead on backend API servers, including One Touch Switch, for about a year now. I enjoy our software development practises and processes; we use a combination of agile for software development, devops (devsecops of course) for software deployment and maintenance, and Scrum for project management. It’s a very effective combination.

I recently attended a course with the Agile Alliance, led by John McFadyen, and became certified as a Scrummaster.

The course was fantastic and very inspiring. At Gigaclear we’re systematically evaluating all our systems, systems architecture and processes. This process and the course have been hugely inspirational and I have an article on software development processes coming shortly…

Categories: FLOSS Project Planets

Glyph Lefkowitz: The Federation Deathmatch

Planet Python - Sun, 2024-11-03 16:49

It’s the weekend, and I have some Thoughts about federated social media. So, buckle up, I guess, it’s time to start some fights.

Recently there has been some discourse about Bluesky’s latest fundraising round. I’ve been participating in conversations about this on Mastodon, and I think I might sometimes come across as a Mastodon partisan, but my feelings are complex and I really don’t want to be boosting the ActivityPub Fediverse without qualification.

So here are some qualifications.

Bluesky Is Evil

To the extent that I am an ActivityPub partisan in the discourse between ActivityPub and ATProtocol, it is because I do not believe that Bluesky is a meaningfully decentralized social network. It is a social network, run by a company, which has a public API with some elements that might, one day, make it possible for it to be decentralized. But today, it is not, either practically or theoretically.

The Bluesky developers are putting in a ton of effort to maybe make it decentralized, hypothetically, someday. A lot of people think they will succeed. But ActivityPub (and, of course, Mastodon specifically) are already, today, meaningfully decentralized, as you can see on FediDB, there are instances with hundreds of thousands of people on them, before we even get to esoterica like the integrations Threads, Wordpress, Flipboard, and Ghost are doing.

The inciting incident for this post — that a lot of people are also angry about Bluesky raising millions of dollars from Evil Guys Doing Evil Stuff Capitalis indeed a serious concern. It lights the fuse that burns towards their eventual, inevitable incredible journey. ATProtocol is just an API, and that API will get shut off one day, whenever their funders get bored of the pretense of their network being “decentralized”.

At time of writing, it is also interesting that 3 of the 4 times that the CEO of Bluesky has even skeeted the word “blockchain” is to say “no blockchain”, to reassure users that the scam magnet of “Blockchain” is not actually near their product or protocol, which is a much harder position to maintain when your lead investor is “Blockchain Capital”.

I think these are all valid criticisms of Bluesky. But I also think that the actual engineers working on the product are aware of these issues, and are making a significant effort to address them or mitigate them in any way they can. All that work can still be easily incinerated by a slow quarter in terms of user growth numbers or a missed revenue forecast when the VCs are getting impatient, but it’s not nothing, it is a life’s work.

Really, who among us could not have our life’s ambitions trivially destroyed in an afternoon, simply because a billionaire decided that they should be? If you feel like you are safe from this, I have some bad news about how money works. So we are all doing our best in an imperfect system and maybe Bluesky is on to something here. That’s eminently possible. They’re certainly putting forth an earnest effort.

Mastodon Is Stupid

Meanwhile, not nearly as much has been made recently of Mastodon refusing funding from a variety of sources, when all indications are that funding is low, and plummeting, far below the level required to actually sustain the site, and they haven’t done a financial transparency report for over a year, and that report was already nearly a year late.

Mastodon and the fediverse are not nearly in a position to claim moral superiority over Bluesky. Sure, taking blockchain VC money might seem like a rookie mistake, but going out of business because you are spurning every possible source of funding is not that wise either.

Some might think that, sure, Mastodon the company might die but at least the Fediverse as a whole will keep going strong, right? Lots of people run their own instances! I even find elements of this argument convincing, and I think there is probably some truth to it. But to really believe this argument as claimed, that it’s a fait accompli that the fediverse will survive in some form, that all those self-run servers will be a robust network that will self-repair, requires believing some obviously false stuff. It is frankly unprofitable to run a Fediverse instance. Realistically, if you want to operate a mastodon server for yourself, it is going to cost at least $100/year once you include stuff like having a domain name, and managing the infrastructure costs is a complex problem that keeps getting harder to manage as the software itself gets slower.

Cory Doctorow has recently argued that this is all worth it, because at least on Mastodon, you’re in control, not at the whims of centralized website operators like Bluesky. In his words,

On Mastodon (and other services based on Activitypub), you can easily leave one server and go to another, and everyone you follow and everyone who follows you will move over to the new server. If the person who runs your server turns out to be imperfect in a way that you can’t endure, you can find another server, spend five minutes moving your account over, and you’re back up and running on the new server

He concludes:

Any system where users can leave without pain is a system whose owners have high switching costs and whose users have none

(Emphasis mine).

This is a beautiful vision. It is, however, an incorrect assessment of the state of the Fediverse as it stands today. It’s not true in two important ways:

First, if you look at any account of a user’s fediverse account migration, like this one from Steve Bate or this one from the Ente project or this one from Erin Kissane, you will see that it is “painful for the foreseeable future” or “wasn’t as seamless as advertised”, and that “the best time to […] migrate instances […] is never”. This language does not presage a pleasant experience, as Doctorow puts it, “without pain”.

Second, migration is an active process that requires engagement from the instance that hosts you. If you have been blocked or banned, or had your account terminated, you are just out of luck. You do not have control over your data or agency over your online identity unless you’ve shelled out the relatively exorbitant amount of money to actually operate your own instance.

In short, ActivityPub is no panacea. A federated system is not really a “decentralized” system, as much as it is a bunch of smaller centralized systems that all talk to each other. You still need to know, and care, about your social and financial relationship to the operators of your instance. There is probably no getting away from this, like, just generally on the Internet, no matter how much peer-to-peer software we deploy, but there certainly isn’t in the incomplete mess that is ActivityPub.

JOIN, or DIE.

Neither Mastodon (or ActivityPub) nor Bluesky (or ATProtocol) has a comprehensive solution to the problem of decentralized social media. These companies, and these protocols, are both deeply flawed and if everything keeps bumping along as it is, I believe both are likely to fail. At different times, on different timelines, and for different reasons, but fail nonetheless.

However, these networks are both small and growing, and we are not yet in the phase of enshittification where margins are shrinking and audiences are captured and the screws must be tightened to juice revenue. There are stil possibilities. Mastodon is crowdfunded and what they lack in resources they make up for in flexibility and scrappiness. Bluesky has money and while there will eventually be a need to monetize somehow, they have plenty of runway to come up with that answer, and a lot of sophisticated protocol work has been done. Not enough to make a complete circut and allow users true, practical decentralization, but it’s not nothing, either.

Mastodon and Bluesky are both organizations with humans in them, and piles of data that is roughly schema-compatible even if the nuances and details are different. I know that there is a compatible model becuse thanks to both platforms being relatively open, there is a functioning ActivityPub/ATProtocol bridge in the form of Brid.gy Fed. You can use it today, and I highly recommend that you do so, so that “choice of protocol” does not fully define your audience. If you’re on bluesky, follow this account, and if you’re on Mastodon or elsewhere on the Fediverse, search for and follow @bsky.brid.gy@bsky.brid.gy.

The reality that fans of decentralized, independent social media must confront is that we are a tiny audicence right now. Whichever site we are looking at, we are talking about a few million monthly active users at best, in a world where even the pathetic husk of Twitter still has hundreds of millions and Facebook has billions. Interneceine fights are not going to get us anywhere. We need to build bridges and links and connect our networks as densely as possible. If I’m being honest, Bridgy Fed looks like a pretty janky solution, but it’s something, and we need to start doing something soon, so we do not collectively become a permanent minority that mass markets can safely ignore.

As users, we need to set an example, so that the developers of the respective platforms get their shit together and work together directly so that workarounds like Bridgy are not required. Frankly, this is mostly on the ActivityPub and Mastodon devs, as far as I can tell. Unfortunately, not a lot of this seems to be public, or at least I haven’t witnessed a lot of it directly, but I have heard repeatedly that the ActivityPub developers are prickly, and this is one high-profile public example where an ActivityPub partisan is incredibly, pointlessly hostile and borderline harrassing towards someone — Mike Masnick, a long-time staunch advocate for open protocols and open patents, someone with a Mastodon account, and thus as good a prospective ally as the ActivityPub fediverse might reasonably find — explaining some of the relative benefits of Bluesky.

Most of us are technology nerds in one way or another. In that way we can look at signifiers like “ActivityPub” and “ATProtocol”, and feel like these are hard boundaries around different all-encompassing structures for the future, and thus tribes we must join and support.

A better way to look at this, however, is to see social entities like Mastodon gGmbH and Bluesky PBC — or, more to the point, Fosstodon, SFBA Social, Hachyderm (and maybe, one day, even an instance which isn’t fully just for software development nerds), as groups that deploy these protocols to access some data that they publish, just as they might publish their website over HTTP or their newsletters over SMTP. There are technical challenges involved in bridging between mutually unintelligible domain models, but that is, like, network software's whole deal. Most software is just some kind of translation from one format or context to another. The best possible future for the fediverse is the one where users care as much about the distinction between ATProtocol and ActivityPub as they do about the distinction between POP3 and IMAP.

To both developers and users of these systems, I say: get it together. Be nice to each other. Because the rest of the social media ecosystem is sure as shit not going to be nice to us if we ever see even a hint of success and start to actually cut into their user base.

Acknowledgments

Thank you to my patrons who are supporting my writing on this blog. If you like what you’ve read here and you’d like to read more of it, or you’d like to support my various open-source endeavors, you can support my work as a sponsor!

Categories: FLOSS Project Planets

Mike Herchel's Blog: Session submission open and featured speakers announced for Florida DrupalCamp 2025

Planet Drupal - Sun, 2024-11-03 16:45
Session submission open and featured speakers announced for Florida DrupalCamp 2025 mherchel Sun, 11/03/2024 - 16:45
Categories: FLOSS Project Planets

#! code: DrupalCamp Scotland 2024

Planet Drupal - Sun, 2024-11-03 13:39

DrupalCamp Scotland returned after a small hiatus of 5 years on the 25th October 2024, and saw nearly 50 people attend the university of Edinburgh Paterson's Land building for a day of talks and sessions. I had the honor of being invited to speak at the conference, which was the first physical speaking session I've had since 2019.

I arrived early to the conference on a sunny Friday morning after driving up the night before. After a cup of coffee and a lovely chat with the organisers and the first few attendees to arrive we started the conference.

The opening talk was from Billy Wardrop, who is Web Development Team Manager in University of Edinburgh. In his talk, A 7 year journey from Drupal 7 to Drupal 10 and what we learned migrating over 600 websites, he went through the lessons he had learned in that migration. This was a fascinating run through of all of the challenges that a web master faces and the history of the migration to Drupal 10 for the University of Edinburgh. It also highlighted the challenges of migrating hundreds of websites from different university departments away from their random systems and into a decent managed Drupal environment. Of particular interest was the talk about deployments as I have faced similar challenges with just 20 sites in the same system.

Next on the agenda was me! I have been writing a lot about the Batch API recently so I decided that I should probably conclude this series of articles with a talk on An Introduction to the Drupal Batch API. Thankfully, I had the week before the conference off, which gave me some time to prepare both the talk and the accompanying code examples.

Read more

Categories: FLOSS Project Planets

Real Python: The Python Square Root Function

Planet Python - Sun, 2024-11-03 09:00

The Python square root function, sqrt(), is part of the math module and is used to calculate the square root of a given number. To use it, you import the math module and call math.sqrt() with a non-negative number as an argument. For example, math.sqrt(9) returns 3.0.

This function works with both integers and floats and is essential for mathematical operations like solving equations and calculating geometric properties. In this tutorial, you’ll learn how to effectively use the square root function in Python.

By the end of this tutorial, you’ll understand how:

  • Python’s sqrt() function calculates square roots using Python’s math.sqrt() for quick and accurate results in your programs.
  • math.sqrt() calculates the square root of positive numbers and zero but raises an error for negative inputs.
  • Python’s square root function can be used to solve real-world problems like calculating distances using the Pythagorean theorem.

Time to dive in!

Python Pit Stop: This tutorial is a quick and practical way to find the info you need, so you’ll be back to your project in no time!

Free Bonus: Click here to get our free Python Cheat Sheet that shows you the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.

Square Roots in Mathematics

In algebra, a square, x, is the result of a number, n, multiplied by itself: x = n²

You can calculate squares using Python:

Python >>> n = 5 >>> x = n**2 >>> x 25 Copied!

The Python ** operator is used for calculating the power of a number. In this case, 5 squared, or 5 to the power of 2, is 25.

The square root, then, is the number n, which when multiplied by itself yields the square, x.

In this example, n, the square root of 25, is 5.

25 is an example of a perfect square. Perfect squares are the squares of integer values:

Python >>> 1**2 1 >>> 2**2 4 >>> 3**2 9 Copied!

You might have memorized some of these perfect squares when you learned your multiplication tables in an elementary algebra class.

If you’re given a small perfect square, it may be straightforward enough to calculate or memorize its square root. But for most other squares, this calculation can get a bit more tedious. Often, an estimation is good enough when you don’t have a calculator.

Read the full article at https://realpython.com/python-square-root-function/ »

[ 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

Steinar H. Gunderson: Ultimate rules as a service

Planet Debian - Sun, 2024-11-03 05:48

Since WFDF changed their ultimate rules web site to be less-than-ideal (in the name of putting everything into Wordpress…), I made my own, at urules.org. It was a fun journey; I've never fiddled with PWAs before, and I was a bit surprised how low-level it all was. I assumed that since my page is just a bunch of HTML files and ~100 lines of JS, I could just bundle that up—but no, that is something they expect a framework to do for you.

The only primitive you get is seemingly that you can fire up your own background service worker (JS running in its own, locked-down context) and that gets to peek at every HTTP request done and possibly intercept it. So you can use a Web Cache (seemingly a separate concept from web local storage?), insert stuff into that, and then query it to intercept requests. It doesn't feel very elegant, perhaps?

It is a bit neat that I can use this to make my own bundling, though. All the pages and images (painfully converted to SVG to save space and re-flow for mobile screens, mostly by simply drawing over bitmaps by hand in Inkscape) are stuck into a JSON dictionary, compressed using the slowest compressor I could find and then downloaded as a single 159 kB bundle. It makes the site actually sort of weird to navigate; since it pretty quickly downloads the bundle in the background, everything goes offline and the speed of loading new pages just feels… off somehow. As if it's not a Serious Web Page if there's no load time.

Of course, this also means that I couldn't cache PNGs, because have you ever tried to have non-UTF-8 data in a JSON sent through N layers of JavaScript? :-)

Categories: FLOSS Project Planets

Guido Günther: Free Software Activities October 2024

Planet Debian - Sun, 2024-11-03 05:17

Another short status update of what happened on my side last month. Besides a phosh bugfix release improving text input and selection was a prevalent pattern again resulting in improvements in the compositor, the OSK and some apps.

phosh
  • Install gir (MR). Needed for e.g. Debian to properly package the Rust bindings.
  • Try harder to find an app icon when showing notifications (MR)
  • Add a simple Pomodoro timer plugin (MR)
  • Small screenshot manager fixes (MR)
  • Tweak portals configuration (MR)
  • Consistent focus style on lock screen and settings (MR). Improves the visual appearance as the dotted focus frame doesn't match our otherwise colored focus frames
  • Don't focus buttons in settings (MR). Improves the visual appearance as attention isn't drawn to the button focus.
  • Close Phosh's settings when activating a Settings panel (MR)
phoc
  • Improve cursor and cursor theme handling, hide mouse pointer by default (MR)
  • Don't submit empty preedit (MR)
  • Fix flickering selection bubbles in GTK4's text input fields (MR)
  • Backport two more fixes and release 0.41.1 (MR)
phosh-mobile-settings
  • Allow to select default text completer (MR, MR)
  • Don't crash when we fail to load a pref plugin (MR)
libphosh-rs
  • Update with current gir and allow to use status pages (MR)
  • Expose screenshot manager and build without warnings (MR). (Improved further by a follow up MR from Sam)
  • Fix clippy warnings and add clippy to CI (MR)
phosh-osk-stub
  • presage: Always set predictors (MR). Avoids surprises with unwanted predictors.
  • Install completer information (MR)
  • Handle overlapping touch events (MR). This should improve fast typing.
  • Allow plain ctrl and alt in the shortcuts bar (MR
  • Use Adwaita background color to make the OSK look more integrated (MR)
  • Use StyleManager to support accent colors (MR)
  • Fix emoji section selection in RTL locales (MR)
  • Don't submit empty preedit (MR). Helps to better preserve text selections.
phosh-osk-data
  • Add scripts to build word corpus from Wikipedia data (MR) See here for the data.
xdg-desktop-portal-phosh
  • Release 0.42~rc1 (MR)
  • Fix HighContrast (MR)
Debian
  • Collect some of the QCom workarounds in a package (MR). This is not meant to go into Debian proper but it's nicer than doing all the mods by hand and forgetting which files were modified.
  • q6voiced: Fix service configuration (MR)
  • chatty: Enable clock test again (MR), and then unbreak translations (MR)
  • phosh: Ship gir for libphosh-rs (MR)
  • phoc: Backport input method related fix (MR)
  • Upload initial package of phosh-osk-data: Status in NEW
  • Upload initial package of xdg-desktop-portal-pohsh: Status in NEW
  • Backport phosh-osk-stub abbrev fix (MR
  • phoc: Update to 0.42.1 (MR
  • mobile-tweaks: Enable zram on Librem 5 and PP (MR)
ModemManager
  • Some further work on the Cell Broadcast to address comments MR)
Calls
  • Further improve daemon mode (MR) (mentioned last month already but got even simpler)
GTK
  • Handle Gtk{H,V}Separator when migrating UI files to GTK4 (MR)
feedbackd
  • Modernize README a bit (MR)
Chatty
  • Use special event for SMS (MR)
  • Another QoL fix when using OSK (MR)
  • Fix printing time diffs on 32bit architectures (MR)
libcmatrix
  • Use endpoints for authenticated media (MR). Needed to support v1.11 servers.
phosh-ev
  • Switch to GNOME 47 runtime (MR)
git-buildpackage
  • Don't use deprecated pkg-resources (MR)
Unified push specification
  • Expand on DBus activation a bit (MR)
swipeGuess
  • Small build improvement and mention phosh-osk-stub (Commit)
wlr-clients
  • Fix -o option and add help output (MR)
iotas (Note taking app)
  • Don't take focus with header bar buttons (MR). Makes typing faster (as the OSK won't hide) and thus using the header bar easier
Flare (Signal app)
  • Don't take focus when sending messages, adding emojis or attachments (MR). Makes typing faster (as the OSK won't hide) and thus using those buttons easier
xdg-desktop-portal
  • Use categories that work for both xdg-spec and the portal (MR)
Reviews

This is not code by me but reviews on other peoples code. The list is fairly incomplete, hope to improve on this in the upcoming months:

  • phosh-tour: add first login mode (MR)
  • phosh: Animate swipe closing notifications (MR)
  • iio-sensor-proxy: Report correct value on claim (MR)
  • iio-sensor-proxy: face-{up,down} (MR)
  • phosh-mobile-settings: Squeekboad scaling (MR)
  • libcmatrix: Misc cleanups/fixes (MR)
  • phosh: Notification separator improvements (MR
  • phosh: Accent colors (MR
Help Development

If you want to support my work see donations. This includes a list of hardware we want to improve support for. Thanks a lot to all current and past donors.

Categories: FLOSS Project Planets

Junichi Uekawa: Doing more swimming in everyday life for the past few months.

Planet Debian - Sun, 2024-11-03 04:24
Doing more swimming in everyday life for the past few months. Seems like I am keeping that up.

Categories: FLOSS Project Planets

This Week in KDE Apps

Planet KDE - Sun, 2024-11-03 03:20
Dolphin's accessibility, Itinerary's travelling aids, and a bunch of new upcoming KDE apps

Welcome to a new issue of "This Week in KDE Apps"! Every week we cover as much as possible of what's happening in the world of KDE apps.

In this issue we discover what developers have been doing to make Dolphin, KDE's most popular (but not only!) file explorer, more accessible. We also take a look at all the new services now integrated into Itinerary that will help you on your travels, the new features for Kate that programmers will enjoy, improvements to Kleopatra to help you manage your certificates and the encryption of your messages, and the flurry of new applications that will soon be available in KDE's software catalog.

This week, we also kicked off our 2024 end-of-year fundraiser just in time for Halloween! Any monetary contribution, however small, will help us cover operational costs, salaries, travel expenses for contributors and in general just keep KDE bringing Free Software to the world. So consider doing a donation today!

Let's dig in!

Dolphin Manage your files

We improved the keyboard navigation of Dolphin, as pressing Ctrl+L multiple times will switch back and forth between focusing and selecting the location bar path and focusing the view. Pressing Escape in the location bar, will now move the focus to the active view (Felix Ernst, 24.12.0. Link).

Speaking of accessibility, the accessibility of the main view of Dolphin was completely overhauled to make it work with screen readers. This work was funded by NGI0 Entrust Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme (Felix Ernst, 24.12.0. Link).

Another change is that Dolphin will now store its view properties inside the extended file attributes instead of creating hidden .directory files when possible (Méven Car, 24.12.0. Link).

digiKam Photo Management Program

digiKam is KDE's powerful photo management software for both professional and aficionado photographers.

Michael Miller fixed an issue where faces from the facial recognition feature were not deleted when a user untagged or deleted a face (Michael Miller. Link).

Elisa Play music and listen to online radio stations

Jack Hill fixed a few issues related to the lyrics feature. Clicking on the Lyrics button now takes you to the correct lyric and not the previous one, and the last line of the lyrics is not displayed completely (Jack Hill, 24.12.0. Link).

Jack also reworked the metadata dialogs to be more intuitive and correct some bugs (Jack Hill, 24.12.0. Link).

GCompris Educational game for children

GCompris, the educational software suite, got a new activity: Sketch! This fun tool lets children express their creativity and draw beautiful artworks (Timothée Giet. Link).

KDE Itinerary Digital travel assistant

Itinerary now supports extracting reservations from planway.com, flight tickets from VietJet Air and train tickets from the Thai state railway. Additionally, dates from day-specific train tickets from NS (Nederlandse Spoorwegen) are now correctly parsed (Volker Krause, 24.08.3. Link 1, link 2, link 3), and, while on an NS intercity train, you can also access the live journey information provided by the onboard WiFi (Carl Schwan, 24.12.0. Link).

Kate Advanced Text Editor

Kate continues to become more and more developer friendly with the changes made by Christoph Cullmann where the order of the tabs is correctly restored when restoring a previous session (Christoph Cullmann, 24.08.3. Link), and the options of the LSP Symbols are more easily discoverable as they are not only available via a context menu, but also within a menu button at the top (Waqar Ahmed, 24.12.0. Link).

Benjamin Port fixed the Appium UI tests and reenabled them on the CI (Benjamin Port, 28.03.0. Link).

Kdenlive Video editor

Kdenlive is KDE's full-featured video editor, which now lets you resize multiple items on the timeline at the same time. (Jean-Baptiste Mardelle, 24.12.0 Link).

Kleopatra Certificate manager and cryptography app

We redesigned Kleopatra's notepad and sign encrypt dialog. In the notepad, the text editor and the recipients view are also now side by side (Carl Schwan, 24.12.0. Link).

Additionally, Tobias worked on the notepad's result messages and error dialogs to make them clearer. (Tobias Fella, 24.12.0 Link 1, link 2).

Tobias also fixed a crash on non-kwin Wayland compositors (Tobias Fella, 24.08.3. Link), and Kleopatra has a new website (Carl Schwan. Link).

Kongress Conference companion

Kongress is an app which helps you navigate conferences and events.

The newest version will display more information about events in the event list. This includes whether the event is in your bookmarked events and the locations within the event (e.g. the rooms) (cah fof pai, 24.12.0. Link).

Speaking of conferences, multiple KDE people will be at the Chaos Communication Congress (38c3) in Hamburg this December! Come by and say hello!

KStars Desktop Planetarium

KStars is KDE's stargazing app that also helps you control your telescope for astrophotography.

We removed the "Simulate Eyepiece View" feature and stripped down EyepieceField. The reason is the offerings of the eyepiece view feature have already been superseded by two more powerful and easier-to-use features in KStars: the HiPS Overlay and the "Views" feature (Akarsh Simha, 3.7.4. Link).

Kwave Sound editor

Mark Penner wrote a blog post about his work on KWave.

LabPlot Interactive Data Visualization and Analysis

LabPlot is KDE's complete suite of data analysis and visualisation tools.

The LabPlot developers added the RAND_MAX programming constants for GSL (GNU Scientific Library) support. (Martin Marmsoler Link), and rewrote the AsciiFilter to increase the parsing speed, like when parsing livedata from an mqtt feed (Martin Marmsoler. Link).

Kuntal Bar also fixed various issues with HiDPI screens (Kuntal Bar, Link).

Marknote Write down your thoughts

Marknote lets you create rich text notes and easily organise them into notebooks.

The icons in the app are now correctly displayed when running Marknote on other platforms, like Windows (Gary Wang, Link).

Ruqola Rocket Chat Client

Ruqola, KDE's Rocket Chat client, received various fixes for its login, logout and network disconnection features (David Faure & Andras Mantia Link 1, link 2, link 3 and link 4), and the unread message bar now uses buttons instead of more subtle links (Joshua Goins. Link).

Spectacle Screenshot Capture Utility

Spectacle is the utility for taking screenshots and screencasts of your desktop and apps. We fixed an issue where Spectacle would take a screenshot of itself (Noah Davis, 24.08.3. Link).

Other Stuff

The FormCard components used by most Kirigami application are now more compact on the desktop (Carl Schwan, Kirigami Addons 1.6.0 Link).

Before After

The About Page provided by the FormCard component now displays more information about the components used by the application (e.g. Qt, KDE Frameworks) (Carl Schwan, Kirigami Addons 1.6.0. Link).

Playground

This section contains news about non released applications.

Arkade

Arkade, a collection of games written in QML, was updated to Qt6 (Carl Schwan. Link).

Whale

Claudio Cambra ported Whale, a QML based file manager and explorer, to Qt6 (Claudio Cambra. Link). Claudio also added a miller columns view to Whale (Claudio Cambra. Link), and implemented navigation history (Claudio Cambra. Link).

And all this too...

Justin Zobel fixed various appstream files to use the new way of declaring the developer's name (Justin Zobel, KRuler, Gwenview, KEuroCalc, ...).

We ported various projects to use declarative QML declaration for better maintainance and performance (Carl Schwan, Koko, Francis, Kalk).

... And Everything Else

This blog only covers the tip of the iceberg! If you’re hungry for more, check out Nate's blog about Plasma and be sure not to miss his This Week in Plasma series, where every Saturday he covers all the work being put into KDE's Plasma desktop environment.

For a complete overview of what's going on, visit KDE's Planet, where you can find all KDE news unfiltered directly from our contributors.

Get Involved

The KDE organization has become important in the world, and your time and contributions have helped us get there. As we grow, we're going to need your support for KDE to become sustainable.

You can help KDE by becoming an active community member and getting involved. Each contributor makes a huge difference in KDE — you are not a number or a cog in a machine! You don’t have to be a programmer either. There are many things you can do: you can help hunt and confirm bugs, even maybe solve them; contribute designs for wallpapers, web pages, icons and app interfaces; translate messages and menu items into your own language; promote KDE in your local community; and a ton more things.

You can also help us by donating. Any monetary contribution, however small, will help us cover operational costs, salaries, travel expenses for contributors and in general just keep KDE bringing Free Software to the world.

To get your application mentioned here, please ping us in invent or in Matrix.

Categories: FLOSS Project Planets

Jaldhar Vyas: Sal Mubarak 2081!

Planet Debian - Sat, 2024-11-02 23:53

Best wishes to the entire Debian and Free Software world for a happy and prosperous Gujarati New Year Vikram Samvat 2081 named Anala.

A fun fact: Although Diwali was on Thursday, because it was a vrddha tithi (a lunar day that spans more than one sunrise,) there was a leap day and that's why the new year didn't start till today.

I haven't posted to this blog for almost exactly three years. I had decided that I wasn't going to until I revamped the blog engine to force myself to actually do it and still managed to drag my feet for this long. This post was supposed to be the first public test of the new version but something has gone unexpectedly gone wrong so this is actually a manually uploaded placeholder until I figure out what happened. I have been regularly taking part in the Perl & Raku Weekly Challenge and I write a little about my solutions with yet another half-finished blog engine.

What else have I been up to? Not a lot Debianwise. I voted a couple of times, sponsored a package and (hopefully) assisted one person in becoming a Debian developer. There's the challenge I mentioned which atleast gets me writing some Perl and Raku every week. I did the 7DRL Game Jam again this year and actually produced a playable game. It needs to be polished though (and open sourced.)

This is my major problem; I have all kinds of things which I've started and left incomplete. It's time to do something about it. In the coming months I am going to do a comprehensive review of all the bits of software I've written or contributed to and either complete them, clean them up or properly abandon them. I shall call this Project 2025.

Categories: FLOSS Project Planets

Pages