Feeds
Daniel Roy Greenfeld: TIL: Parsing messy datetimes strings
How to convert inconsistent datetime strings into datetime objects.
Recently I've been working on yet another rewrite of my blog, this time to FastHTML. Thanks to the power and ease of that framework, that took about 45 minutes to replicate all the web pages of my blog. Wahoo!
Alas, the atom/rss feeds took quite a bit longer.
For the atom/rss feeds I chose to use the venerable Feedgen library. The challenge there is that Feedgen is rightfully particular about the datetime objects it accepts. And over the years as this site has had 650 posts added the timestamps have become rather inconsistent in their format. On that issue I fully blame the author, who unfortunately is me.
In any case, I wrote a little Python function that handles it in a timezone aware way using the dateutils.parser() functon that I learned.
# Python stdlib from datetime import datetime from dateutils import parser # You'll need to install the pytz dependency import pytz def convert_dtstr_to_dt(date_str: str) -> datetime: """ Convert a naive or non-naive date/datetime string to a datetime object. Naive datetime strings are assumed to be in GMT (UTC) timezone. """ try: dt = parser.parse(date_str) if dt.tzinfo is None: # If the datetime object is naive, set it to GMT (UTC) dt = dt.replace(tzinfo=pytz.UTC) return dt except (ValueError, TypeError) as e: Raise Exception(f"Error parsing date string: {e}")Original source code here.
Note: As of publishing, this article is still on my old blog. The DNS switchover to the FastHTML version of my blog happens later this week.
Specbee: How to split configurations across different sites in Drupal 10
Akansha Tech Journal: Inside the Codebase: A Deep Dive into Drupal Rag Integration
Python Bytes: #395 pythont compatible packages
Akademy 2024 T-shirt online orders now open & in-person extended
Orders for the Akademy 2024 T-shirt for those attending online are now open till 29th September, these will be shipped after Akademy. For those attending in person the order deadline has been extended till Sunday 11th
Full details are on the Akademy 2024 T-shirt page
Mockup of Akademy 2024 T-shirt by Jens ReuterbergMike Driscoll: Create Amazing Progress Bars in Python with alive-progress
Have you ever needed a progress bar in your Python command-line application? One great way of creating a progress bar is to use the alive-progress package created by Rogério Sampaio de Almeida! Alive progress provides multiple different types of progress bars in your terminal or IPython REPL session. The alive progress package will work with any iterable, from lists to querysets, and more.
Let’s spend a little time learning how the alive-progress package works!
InstallationInstalling the alive-progress package is easy using the pip installer utility. Here is the command you should use in your terminal:
python -m pip install alive-progressPip will install the package and any dependencies it needs. The pip tool shouldn’t take very long to install alive-progress.
Example UsageThe alive-progress package comes with a great demo that you can use to see all the different types of progress bars that the package supports. Open up a Python REPL and run the following code:
from alive_progress.styles import showtime showtime()When you run this code, you will see something similar to the following:
There is another alive-progress demo that is a little different from the one above. You don’t need to use a Python REPL to run it though. Instead, you can open up your terminal application and run the following command:
python -m alive_progress.tools.demoWhen you run this command, you will see something like this:
https://www.blog.pythonlibrary.org/wp-content/uploads/2024/08/alive_demo.mp4The alive-progress GitHub page also shows several different code examples that demonstrate how to use alive-progress in your code. Here is one of the examples:
from alive_progress import alive_bar import time for x in 1000, 1500, 700, 0: with alive_bar(x) as bar: for i in range(1000): time.sleep(.005) bar()Here you loop over four different integer values and create a progress bar for each of them. Then you loop over a range of one thousand and the progress bars will run through to completion.
When you run this code in your terminal, you will see this output:
Check out the GitHub repository for more fun examples!
Wrapping UpThe alive-progress package is lots of fun. You can add progress bars to any of your regular Python scripts and see them visually in your applications. This can be especially useful for command-line utilities that you create as they will show the user how far along they are in processing the data.
Download the package and start tinkering today!
The post Create Amazing Progress Bars in Python with alive-progress appeared first on Mouse Vs Python.
KDE Plasma 6.1.4, Bugfix Release for August
Tuesday, 6 August 2024. Today KDE releases a bugfix update to KDE Plasma 6, versioned 6.1.4.
Plasma 6.1 was released in June 2024 with many feature refinements and new modules to complete the desktop experience.
This release adds three weeks' worth of new translations and fixes from KDE's contributors. The bugfixes are typically small but important and include:
- DrKonqi: Use frameworks version number from kcrash. Commit.
- KWin: Fix sticky keys for AltGr. Commit. See bug #444335
- [kcms/access] Set range for visual bell duration selector. Commit.
Trey Hunner: Quickly find the right datetime format code for your date
I often find myself with a string representing a date and time and the need to create a format string that will parse this string into a datetime object.
I decided to make a tool that solves this problem for me: https://pym.dev/strptime
Finding the code to parse a date format with strptimeHere’s how I’m now using this new tool.
I find a date string in a random spreadsheet or log file that I need to parse. For example, the string 30-Jun-2024 20:09, which I recently found in a spreadsheet.
I then paste the string into the tool and watch the format appear:
Then I click on the date format to copy-paste it. That’s it!
This tool works by cycling through a number of common formats. It also works for dates without a time, like Jul 1, 2024.
This input field works great when you’re in need of a code for the datetime class’s strptime method (which parses dates). But what if you need a code for strftime (for formatting dates)?
Finding the code to format a date with strftimeIf you don’t have a date but instead want to construct a date in a specific common format, scroll down the page a bit.
This page includes a table of common formats.
Click on the format to copy it. That’s it.
Playing with format codesWhat if you have a date format already but you’re not sure what it represents?
Paste it in the box!
For example if you’re wondering what the %B in %B %d, %Y means, paste it in to see what that represent with the current date and time:
Other featuresThere are a few other hidden features in this tool:
- After a date or date format is pasted, if it corresponds to one of the formats listed in the table of common formats, that row will be highlighted
- Hitting the Enter key anywhere on the page will select the input field
- Clicking on a date within the format table will fill that date into the input box
- The bottom of the page includes links to other useful datetime formatting/parsing tools as well as a link to the relevant Python documentation
What do you think of this tool?
Is this something you’d bookmark and use often? Is this missing a key feature that you would need for it to be valuable for your use?
Are there date and time formats you’d like to see that don’t seem to be supported yet?
Comment or email me to let me know!
Talking Drupal: Talking Drupal #462 - DrupalCon Singapore
Today we are talking about DrupalCon Singapore, What you can expect, and What’s next for Drupal in Asia with guest Mike Richardson & Surabhi Gokte. We’ll also cover Filefield Paths as our module of the week.
For show notes visit: www.talkingDrupal.com/462
Topics- When is Drupalcon Asia
- The last one was in 2016, what did it take to reprise
- How do you handle language barriers
- What are your roles in the organizing committee
- Steering committee and Drupal South
- What can attendees expect
- Any special programming
- What kind of diversity is expected from attendees
- Driving from Mumbai to Singapore is 110 hours
- Will Dries be there
- Can we expect future Drupalcon Asia's
- Planning and logistics regarding coffee
- Starshot
- DrupalCon Singapore
- Droptimes
- Drupal camp Pune
- Steering committee for Drupal South
- Linux Australia Council
- DrupalCon Singapore Sponsorship
- Email events@drupalasia.org
- Park Royal Collection Marina Bay
- Singapore Wiki
- Singapore Visa
Mike Richardson - Singapore DrupalCon richo_au Surabhi Gokte - surabhi-gokte
HostsNic Laflin - nLighteneddevelopment.com nicxvan John Picozzi - epam.com johnpicozzi Josh Miller - joshmiller
MOTW CorrespondentMartin Anderson-Clutz - mandclu.com mandclu
- Brief description:
- Have you ever wanted to use a variety of tokens to customize the directory and file names of your uploaded files? There’s a module for that.
- Module name/project name:
- Brief history
- How old: created in July 2008 by Stuart Clark (Deciphered), though recent releases are by Oleh Vehera (voleger) of Golems GABB
- Versions available: 7.x-1.2 and 8.x-1.0-beta7, the latter of which supports Drupal 9.3 or newer, and Drupal 10
- Maintainership
- Seeking co-maintainers
- Security Coverage
- Opted in, but no coverage in practice for Drupal 9 or 10
- Test coverage
- Number of open issues: 131 open issues, 50 of which are bugs against the current branch
- Usage stats:
- 34,609 sites almost 35,000 sites
- Module features and usage
- This module allows you to customize file names and paths by leveraging a variety of entity-based tokens
- It also integrates with the Pathauto module, giving you options to clean up the tokens for example by removing slashes, filtering out words or punctuation, and so on
- It can also work with the Transliteration module to convert unicode characters into US-ASCII
- Filefield Paths has options to rename and move existing files, and can retroactively rename files, effectively bulk updating and moving all your existing files
- It can also work with the Redirect module to automatically create redirects from the old path and filename to the new location, when renaming
- I’d also like to give a tip of the cap to Jim Birch of Kanopi for suggesting this module, when I was talking to a customer who was looking to achieve pretty much exactly what this module does
Drupal Association blog: How did we get to Ripple Makers? The Evolution of the Drupal Membership Program
The Drupal Association’s individual membership program has always played a crucial role in supporting the Drupal community and ensuring the ongoing success of the Drupal project. The program was initially set up as a transactional vehicle: aside from the badge and voting rights, members received access to discounts from Drupal services providers.
The individual membership program stayed on autopilot during the turmoil of the Covid pandemic as we made the difficult decision to cancel DrupalCon North America 2020. During this time, our members and other Drupal community supporters donated unprecedented unrestricted funds using the hashtag #DrupalCares.
I joined the Drupal Association about two years ago as the Development & Membership Manager. My role split my time between Drupal Certified partners and the individual membership program, however it was clear from the beginning that the individual membership program would need a lot more attention.
The membership program underwent significant transformation from 2019 through May 2023, overcoming challenges and celebrating successes along the way. Initially, we faced a decline in numbers, but through consistent effort and unprecedented generosity, we've made remarkable strides. Today, we proudly recognize 1,747 members, with 70% of them providing recurring support.
Ripple Makers: Celebrating Changemakers in our CommunityThe individual membership program rebranded as Ripple Makers in 2024. With this new name, the Drupal Association increases focus on communication, transparency, and engagement within the community. The ‘new’ program encourages sustaining donors to make monthly recurring gifts, which provide a reliable source of funding. This financial support allows the Drupal Association to plan for the future, support essential projects, and foster a dynamic and responsive community.
Membership Programs, Sustainable Giving, and NonprofitsWhy does a nonprofit organization such as the Drupal Association need a sustaining giving program? This program is vital for the sustainability and growth of the Drupal Association, and the benefit it brings to the community. It provides a stable foundation of support, ensuring that we can continue to innovate and grow. In addition, unrestricted giving in particular allows nonprofits to allocate resources where they are needed most, supporting the overall health of the Drupal project. Importantly. It also opens up direct lines of communication with the community.
Positive Impact on the Drupal CommunityThe Drupal community thrives because of several factors: open source collaboration, supportive environment, diverse participation, commitment to quality, and others. In my opinion, a supportive environment is the most important one.
By becoming a Ripple Maker, you directly support a vibrant and inclusive community of people who care for the Drupal project. Your contributions empower us to foster a sustainable ecosystem for Drupal by harnessing the collective generosity and commitment to the future of Drupal. Learn more about the program and join the wave on our sign up page.
Thank you for your ongoing support and dedication. Let's make the next chapter of our sustainable giving program the best one yet!
Real Python: Functional Programming in Python: When and How to Use It
Functional programming is a programming paradigm in which the primary method of computation is the evaluation of functions. But how does Python support functional programming?
In this tutorial, you’ll learn:
- What the functional programming paradigm entails
- What it means to say that functions are first-class citizens in Python
- How to define anonymous functions with the lambda keyword
- How to implement functional code using map(), filter(), and reduce()
Functional programming typically plays a minor role in Python code, but it’s still good to be familiar with it. You’ll probably encounter it from time to time when reading code written by others. And you may even find situations where it’s advantageous to use Python’s functional programming capabilities in your own code.
Get Your Code: Click here to download the free sample code that shows you when and how to use functional programming in Python.
What Is Functional Programming?A pure function is a function whose output value follows solely from its input values without any observable side effects. In functional programming, a program consists primarily of the evaluation of pure functions. Computation proceeds by nested or composed function calls without changes to state or mutable data.
The functional paradigm is popular because it offers several advantages over other programming paradigms. Functional code is:
- High level: You describe the result you want rather than explicitly specifying the steps required to get there. Single statements tend to be concise but pack a lot of punch.
- Transparent: The behavior of a pure function can be described by its inputs and outputs, without intermediary values. This eliminates the possibility of side effects and facilitates debugging.
- Parallelizable: Routines that don’t cause side effects can more easily run in parallel with one another.
Many programming languages support some degree of functional programming. In some languages, virtually all code follows the functional paradigm. Haskell is one such example. Python, by contrast, does support functional programming but contains features of other programming models as well.
While it’s true that an in-depth description of functional programming is somewhat complex, the goal here isn’t to present a rigorous definition but to show you what you can do by way of functional programming in Python.
How Well Does Python Support Functional Programming?To support functional programming, it’s beneficial if a function in a given programming language can do these two things:
- Take another function as an argument
- Return another function to its caller
Python plays nicely in both respects. Everything in Python is an object, and all objects in Python have more or less equal stature. Functions are no exception.
In Python, functions are first-class citizens. This means that functions have the same characteristics as values like strings and numbers. Anything you would expect to be able to do with a string or number, you can also do with a function.
For example, you can assign a function to a variable. You can then use that variable the same way you would use the function itself:
Python 1>>> def func(): 2... print("I am function func()!") 3... 4 5>>> func() 6I am function func()! 7 8>>> another_name = func 9>>> another_name() 10I am function func()! Copied!The assignment another_name = func on line 8 creates a new reference to func() named another_name. You can then call the function by either of the two names, func or another_name, as shown on lines 5 and 9.
You can display a function to the console with print(), include it as an element in a composite data object like a list, or even use it as a dictionary key:
Python >>> def func(): ... print("I am function func()!") ... >>> print("cat", func, 42) cat <function func at 0x7f81b4d29bf8> 42 >>> objects = ["cat", func, 42] >>> objects[1] <function func at 0x7f81b4d29bf8> >>> objects[1]() I am function func()! >>> d = {"cat": 1, func: 2, 42: 3} >>> d[func] 2 Copied!In this example, func() appears in all the same contexts as the values "cat" and 42, and the interpreter handles it just fine.
Note: What you can or can’t do with an object in Python depends to some extent on context. Some operations work for certain object types but not for others.
For example, you can add two integer objects or concatenate two string objects with the plus operator (+), but the plus operator isn’t defined for function objects.
For present purposes, what matters is that functions in Python satisfy the two criteria beneficial for functional programming listed above. You can pass a function to another function as an argument:
Python 1>>> def inner(): 2... print("I am function inner()!") 3... 4 5>>> def outer(function): 6... function() 7... 8 9>>> outer(inner) 10I am function inner()! Copied! Read the full article at https://realpython.com/python-functional-programming/ »[ 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 ]
Week 10
The Drop Times: Drupal 11 and Beyond
Dear Readers,
Imagine a bustling workshop filled with developers, designers, and enthusiasts collaborating to build something extraordinary. This is the scene as Drupal 11 emerges, packed with features designed to make web development more intuitive and efficient.
"In recent years, we've seen an uptick in innovation in Drupal. Drupal 11 continues this trend with many new and exciting features."
notes Dries Buytaert, Founder and Lead of Drupal.
He emphasises that Drupal 11 is designed to empower ambitious site builders to create exceptional websites and accelerate Drupal's innovation. With this release, Drupal has become more intuitive, powerful, and flexible, ensuring it remains a leader in web development and digital experience creation.
Key among these innovations are Recipes and Single-Directory Components (SDCs). Recipes act like pre-assembled kits, allowing developers to add features to their websites with ease. Meanwhile, SDCs gather all necessary code for each component into one tidy package, simplifying the workflow.
Drupal 11 boasts superior performance, running up to 50% faster on PHP 8.3 compared to its predecessors. This improvement ensures swift page loading and an overall enhanced user experience. Accessibility remains a key focus, with Drupal continuing to support over 100 languages, ensuring inclusivity and usability for a global audience. This new release is the product of a vibrant community effort, with 1,858 individuals from 590 organizations contributing their expertise and passion. It’s a shining example of what can be achieved when people come together with a common goal: to push the boundaries of what’s possible with Drupal.
But the excitement doesn’t end with Drupal 11. The community is already buzzing about the upcoming Drupal Starshot project. Starshot aims to make Drupal more accessible than ever, especially for newcomers. By integrating user-friendly tools like the Project Browser and automatic updates, Starshot promises a smooth journey from installation to launching a fully functional website. With 148 days left for the year, the community is eagerly anticipating the arrival of the initial version of Starshot.
These developments are more than just updates; they’re part of an ongoing story of innovation and collaboration. With Drupal 11 and the forthcoming Starshot project, the Drupal community is not just keeping pace with the future—they're shaping it.
Moving on to stand-out stories of the past week.
The most important and currently happening update from the Drupal Community is the announcement of candidates for Drupal Association Board Elections. This year's election will fill one at-large board seat, with candidates Albert Hughes, Will Huggins, Alejandro Moreno, Janna Malikova, Kevin Quillen, Matthew Saunders, and Dominique De Cooman vying for the position. Voting will open on 15 August, requiring active Drupal Association memberships by 14 August to participate. The election results will be ratified between 6-13 September, with the new board member announced at DrupalCon Barcelona.
Last week, Daniel Cothran, in a conversation with Kazima Abbas, sub-editor of The DropTimes, shared his journey into web development and the creation of Views CSV Source. He explained how this module not only simplifies the data presentation process but also improves the efficiency and performance of Drupal sites, making it especially valuable for projects requiring reliable and streamlined data handling. Read the full article here.
In an email conversation, I had the pleasure of interviewing Jürgen Haas, Co-Founder of LakeDrops, and the creative mind behind the ECA module. During our discussion, Jürgen delved into the development of the ECA (Event, Condition, Action) module, which he designed to modernize workflow automation within Drupal. He shared the story behind the ECA module's inception, its development path, and its potential integration with future Drupal core updates, emphasizing its value in enhancing the user experience through intuitive tools.
The second part of the Thoughts on Starshot feature revealed widespread excitement within the Drupal community, highlighting the potential of the Starshot initiative to transform the Drupal platform. With contributions from seasoned community members like Kristen Pol, Murray Woodman, Nicolas Loye, Martin Anderson-Clutz, and Tim Hestenes Lehnen, the consensus is clear: Drupal Starshot promises to streamline the user experience, foster greater collaboration, and lower the barriers to entry, making Drupal more accessible to a wider audience.
DrupalCamp Ottawa 2024, held on August 2, brought together web development enthusiasts of all skill levels for a day of learning and networking centered around the Drupal platform. Highlighting key speakers like Martin Anderson-Clutz, the event emphasized community, inclusivity, and the latest advancements in Drupal, ensuring a successful and collaborative experience for all attendees. Read here.
The Pacific Northwest Drupal Summit is set to return for its 10th event, taking place from October 11 to 13, 2024, in Seattle, Washington. Since 2009, this summit has been a key regional event for Drupal professionals in the Pacific Northwest.
The Acquia 2024 Digital Freedom Tour will make its next stop in New York City on October 24, 2024. The event aims to advance a safer, more inclusive, and accessible digital world. It will bring together prominent digital leaders who will share their expertise in creating impactful digital experiences.
Anoop Singh, Tech Lead at Valuebound, announced on LinkedIn the upcoming release of the FlexiStyle Bootstrap SCSS theme on Drupal.org. This follows the success of the original FlexiStyle Bootstrap theme and promises even greater customization and flexibility for Drupal projects.
Additionally, amazee.io has released Lagoon V2.20, a significant update to its open-source application delivery platform. This release includes enhancements in user management, security, and onboarding efficiency designed to better support business needs.
Backdrop CMS 1.28.0 has been released, bringing significant enhancements to the platform, including new options for configuration storage. Laryn Kragt Bakker, Senior Developer at Aten Design Group, detailed the update, which allows users to choose between storing their configuration data in the file system or the database.
We acknowledge that there are more stories to share. However, due to selection constraints, we must pause further exploration for now.
To get timely updates, follow us on LinkedIn, Twitter and Facebook. You can also, join us on Drupal Slack at #thedroptimes.
Thank you,
Sincerely
Alka Elizabeth
Sub-editor, The DropTimes.
Real Python: Quiz: Functional Programming in Python: When and How to Use It
In this quiz, you’ll test your understanding of Functional Programming in Python.
By working through this quiz, you’ll revisit the functional programming paradigm, the concept of functions as first-class citizens in Python, the use of the lambda keyword, and how to implement functional code using map(), filter(), and reduce().
[ 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: Ready for Drupal 11? Upgrade With LN Webworks Now!
In this digital world, it is absolutely necessary to stay up-to-date with the latest upgrades and trends. Drupal 11 is here, bringing you better security, performance, and user experience. As a pioneer in 360 Drupal services, LN Webworks is excited to help you upgrade
In this blog, we will navigate more about the intricacies of Drupal 11’s core attributes, the benefits of embracing the latest update, and how LN Webworks stands as your steadfast Drupal Certification Migration Partner for a successful migration.
ADCI Solutions: Fixing catalog data import for a Drupal online store
1xINTERNET blog: Everything you need to know about The European Accessibility Act (EAA)
The European Accessibility Act (EAA) aims to enhance the accessibility of products and services for people with disabilities and the elderly throughout the EU. With less than a year remaining to meet compliance requirements, both the public and private sectors must act now.
Zato Blog: API development workflow with Zato
Zato is an integration platform and backend application server which means that, during most of their projects, developers using Zato are interested in a few specific matters.
The platform concentrates on answering these key, everyday questions that Python backend developers routinely ask:
- How do I connect to external systems or databases to store or extract data?
- How do I map messages from one format to another?
- How do I automate my work so that it is repeatable across environments?
- How can I focus on my job instead of thinking of trivial low-level details?
- How do I debug my code?
- How can I reuse the skills and knowledge that I obtained elsewhere and how can I better myself?
- How do I manage the complexity of having to integrate at least several systems and dozens or hundreds of APIs?
-
Dashboard is a web-based administration console that lets you define all the various connection pools, security types, scheduler jobs or other integration assets that you later make use of in your Python-based API services
-
When you install Zato, it is comfortable to use its Dashboard to define resources like REST, MongoDB or SOAP connections pools because it does not require any programming, you just fill out a form and that resource is created
Python
-
All of your code is in Python - that makes it easy to manipulate any kind of data that you receive or may need to access
-
In your code, you only deal with the business logic - if your service is invoked, it means that all the security layers, serializers and other low-level parts have already completed their job and you are given a nice Python-based business object that represents your input. Based on this input information, you create output that your business logic dictates, still working purely on a high-level of Python objects, without any low-level details.
-
Static typing is encouraged through the use of dataclasses for your data models
-
Your code is hot-deployed from your IDE, no matter where your servers are, e.g. you work on Mac but the server is a remote Linux instance
-
You can debug your services from your IDE as well and, again, the server can be a remote one
Such a service can be assigned to one or more REST channels and we can invoke it now:
$ curl localhost:17010/api/v1/client -d '{"client_id":123}' {"name":"Jane Doe","email":"hello@example.com","segment":"RNZ"} $ Automation-
Using Dashboard is very handy, and, once you are satisfied with what you created using it, the resources can be exported from command line using a built-in tool called enmasse - the result is a regular YAML file that describes every resource that you created using Dashboard
-
In the next step, an emasse file can be imported in a new environment, also from command line. For instance, you can keep adding new connection definitions to the export file each day and they can be imported in a separate testing environment by CI/CD regression testing processes.
-
Thanks to the enmasse export and import cycle, you do not need to manually recreate any resources that you initially created in your development environment. Moreover, because enmasse files are simple YAML files, you can script their usage in any way required when they are being import, e.g. by filling out credentials or other details that each environment may differ by.
-
Similarly, with your Python code, you can commit your code to git and configure each environment to hot-deploy it directly from a git checkout. Alternatively, Python code can be deployed statically, which requires a server restart. The latter approach is useful when you, for instance, prepare an AWS AMI with your solution that you create new runtime instance from, because it lets you embed your entire enmasse definition and code directly in your AMIs.
-
Definitions of your services can be exported to OpenAPI
-
Note that, by default, your services can be multi-protocol - it means that you may have a service that only uses WebSockets, or perhaps is a background one that has no REST endpoint at all, and yet, you still will be able to export it to OpenAPI
-
Taken together, it means that you can use any OpenAPI-compatible tool, such as Postman, for accessing and testing your API services, no matter if they use REST or not
-
You can also generate an entire static HTML site that will include OpenAPI as well as static pages describing your APIs - this is useful, for instance when you need to share with your tech partners not only an OpenAPI definition but a pretty-looking API documentation site as well
Let's generate an OpenAPI definition for the GetClient service above:
$ zato openapi /path/to/server/server1 \ --include "client*" \ --file /tmp/openapi.yamlNow, we can import the OpenAPI definition to Postman and invoke our services from it:
Python once more-
Python is at the core of Zato and the platform allows you to leverage your already existing skills and knowledge of third-party libraries
-
For instance, the code below is a stand-alone program that connects to Redis to insert a key and read it back:
- Now, the same as a Zato-based service:
-
In both cases, it is exactly the same amount of code yet a couple of differences are notable.
- First, because the configuration was created earlier using Dashboard or enmasse, your code does not need to be concerned with where Redis is, it just makes use of it.
- Second, already at this point, your Zato code is a scalable API service that can be hot-deployed to clusters for other systems to invoke it.
- Yet, the actual business logic, the usage of Redis, is the same, which means that you can reuse what you already know and build upon it while developing with Zato.
-
Redis was but one example and the same principle applies to everything else. Be it SQL, MongoDB, ElasticSearch or any other connection type, you can take your existing code and simply embed it in Zato services.
-
This also means that it is easy to find programming examples specific to a particular system because, in the end, when you connect to such an external system through Zato, you issue requests using a library which already is widely popular among Python programmers, like redis-py in this example above.
-
Similarly, as a data scientist you may already have some Pandas or Spark code developed earlier - the same principle applies, you can embed it in your services or you can import it from your libraries, just like with regular Python code.
➤ Python API integration tutorial
➤ What is an integration platform?
➤ Python Integration platform as a Service (iPaaS)
➤ What is an Enterprise Service Bus (ESB)? What is SOA?
DrupalEasy: DrupalEasy Podcast S17E1 - Jamie Abrahams - Drupal's new AI module
We talk with Jamie Abrahams from FreelyGive about the new AI module and what it means for the future of AI modules in the Drupal ecosystem.
URLs mentioned- The new AI module
- Introductory video on the new AI module
- Press release announcing AI module
- Detailed introduction of AI module
- #AI channel in Drupal Slack workspace
- Issue queue discussion about generic "ai()" method
- LangChain
- LlamaIndex
- LM Studio
- Ollama
- Professional module development - 15 weeks, 90 hours, live, online course.
- Drupal Career Online - 12 weeks, 77 hours, live online, beginner-focused course.
We're using the machine-driven Amazon Transcribe service to provide an audio transcript of this episode.
SubscribeSubscribe to our podcast on iTunes, iHeart, Amazon, YouTube, or Spotify.
If you'd like to leave us a voicemail, call 321-396-2340. Please keep in mind that we might play your voicemail during one of our future podcasts. Feel free to call in with suggestions, rants, questions, or corrections. If you'd rather just send us an email, please use our contact page.
CreditsPodcast edited by Amelia Anello.
Freedesktop Specs Website Update
The Freedesktop.org Specifications directory contains a list of common specifications that have accumulated over the decades and define how common desktop environment functionality works. The specifications are designed to increase interoperability between desktops. Common specifications make the life of both desktop-environment developers and especially application developers (who will almost always want to maximize the amount of Linux DEs their app can run on and behave as expected, to increase their apps target audience) a lot easier.
Unfortunately, building the HTML specifications and maintaining the directory of available specs has become a bit of a difficult chore, as the pipeline for building the site has become fairly old and unmaintained (parts of it still depended on Python 2). In order to make my life of maintaining this part of Freedesktop easier, I aimed to carefully modernize the website. I do have bigger plans to maybe eventually restructure the site to make it easier to navigate and not just a plain alphabetical list of specifications, and to integrate it with the Wiki, but in the interest of backwards compatibility and to get anything done in time (rather than taking on a mega-project that can’t be finished), I decided to just do the minimum modernization first to get a viable website, and do the rest later.
So, long story short: Most Freedesktop specs are written in DocBook XML. Some were plain HTML documents, some were DocBook SGML, a few were plaintext files. To make things easier to maintain, almost every specification is written in DocBook now. This also simplifies the review process and we may be able to switch to something else like AsciiDoc later if we want to. Of course, one could have switched to something else than DocBook, but that would have been a much bigger chore with a lot more broken links, and I did not want this to become an even bigger project than it already was and keep its scope somewhat narrow.
DocBook is a markup language for documentation which has been around for a very long time, and therefore has older tooling around it. But fortunately our friends at openSUSE created DAPS (DocBook Authoring and Publishing Suite) as a modern way to render DocBook documents to HTML and other file formats. DAPS is now used to generate all Freedesktop specifications on our website. The website index and the specification revisions are also now defined in structured TOML files, to make them easier to read and to extend. A bunch of specifications that had been missing from the original website are also added to the index and rendered on the website now.
Originally, I wanted to put the website live in a temporary location and solicit feedback, especially since some links have changed and not everything may have redirects. However, due to how GitLab Pages worked (and due to me not knowing GitLab CI well enough…) the changes went live before their MR was actually merged. Rather than reverting the change, I decided to keep it (as the old website did not build properly anymore) and to see if anything breaks. So far, no dead links or bad side effects have been observed, but:
If you notice any broken link to specifications.fd.o or anything else weird, please file a bug so that we can fix it!
Thank you, and I hope you enjoy reading the specifications in better rendering and more coherent look!