Python 3.9.9 hotfix release is now available

Python 3.9.9 hotfix release is now available

Python 3.9.9 is the eighth maintenance release of the legacy 3.9 series. Python 3.10 is now the latest feature release series of Python 3. Get the latest release of 3.10.x here.

3.9.9 was released out of schedule as a hotfix for an argparse regression in Python 3.9.8 which caused complex command-line tools to fail recognizing sub-commands properly. Details in BPO-45235. There are only three other bugfixes in this release compared to 3.9.8. See the changelog for details on what changed.

Upgrading to 3.9.9 is highly recommended if you’re running Python 3.9.8.

The next Python 3.9 maintenance release will be 3.9.10, currently scheduled for 2022-01-03.

Get it here: https://www.python.org/downloads/release/python-399/

We apologize for the inconvenience

…and still hope you’ll enjoy the new release!

Your friendly release team,
Ned Deily @nad
Steve Dower @steve.dower
Łukasz Langa @ambv

What’s new in PHP 8.1

What’s new in PHP 8.1

PHP 8.1 will be released on November 25, 2021. We already know all new features, performance improvements, changes and deprecations so let’s go through them one by one.

As with every release, PHP 8.1 adds some nice new features. Keep in mind that this list will grow over the year.

 Enums RFC

Enums will be added in PHP 8.1! If you’re unsure what they can be used for, you can read about them here.

Adding enums would be a significant improvement in PHP. To give you a quick preview of what they will look like, here’s a code sample:

enum Status {
  case Pending;
  case Active;
  case Archived;
}

And this is how they will be used:\

class Post
{
    public function __construct(
        private Status $status = Status::Pending;
    ) {}

    public function setStatus(Status $status): void
    {
        // …
    }
}

$post->setStatus(Status::Active);

Fibers RFC

Fibers — aka “green threads” — are a low level mechanism to manage parallelism. You probably won’t use them directly in your applications, but frameworks like Amphp and ReactPHP will make extensive use of them.

Here’s a simple example of using fibers:

$fiber = new Fiber(function (): void {
    $valueAfterResuming = Fiber::suspend('after suspending');
    
    // … 
});
 
$valueAfterSuspending = $fiber->start();
 
$fiber->resume('after resuming');

If you want to read some more about fibers, what they can and can’t do, you can read this post.

Array unpacking with string keys RFC

Array unpacking was already allowed in PHP 7.4, but it only worked with numeric keys. The reason string keys weren’t supported before is because there wasn’t any consensus on how to merge array duplicates. The RFC cleanly solves this by following the semantics of array_merge:

$array1 = ["a" => 1];

$array2 = ["b" => 2];

$array = ["a" => 0, ...$array1, ...$array2];

var_dump($array); // ["a" => 1, "b" => 2]

Readonly properties RFC

Class properties can be marked as readonly, meaning they can only be written once.

class PostData {
    public function __construct(
        public readonly string $title,
        public readonly DateTimeImmutable $date,
    ) {}
}

Trying to change a readonly property after it has been initialized will result in an error:

$post = new Post('Title', /* … */);

$post->title = 'Other';

Error: Cannot modify readonly property Post::$title

With every release, there’s a bunch of very minor changes to the language. All of them are listed in the UPGRADING guide on GitHub and the small deprecations RFC, make sure to check it out if you want to know every little detail.

78% of the web powered by PHP

78% of the web powered by PHP

Today, PHP is used by almost 80% of all the websites whose server-side programming language we know. Popular websites such as Slack, Etsy, Wikipedia, WordPress, Mailchimp, Canva, Indeed, Investing.com, and others are powered by PHP.

However, in the coming months, many websites that fail to upgrade to the latest version of PHP 8 will be left running unsupported versions.

PHP 7 was released back in 2015, and 68% of PHP-based websites still use PHP 7. Meanwhile, PHP 8 was released in November 2020, yet only ~ 1% of PHP-based websites currently use it!

This slow uptake of PHP 8 will become a much higher priority upgrade for organizations very soon. In fact, PHP 7 loses active support next month and loses security support in one year!

Extended support for PHP 7.4 will end on November 28, 2022. After this date, applications will continue to run; however, those applications will be out of support and at risk of security vulnerabilities that remain unpatched.

In addition, after November 28, 2022, Microsoft will no longer support PHP, and mainly Unix-based distros such as Linux will be the OS supported by future versions of PHP and continued feature, quality, and security updates.

What to expect in Java 18

What to expect in Java 18

Due in March 2022, Java 18 continues to take shape, with eight feature proposals being considered for it so far. The latest feature proposals include a service-provider interface (SPI) for Internet address resolution and a second preview of pattern matching for switch statements.

The OpenJDK page for Java Development Kit (JDK) 18 lists the service-provider interface as proposed to target JDK 18 while a simple web server, a vector API, code snippets, a reimplementation of core reflection, and the UTF-8 charset officially target JDK 18 as of November 1.

A second incubation of a foreign function and memory API, which was incubated in Java 17, also is eyed for Java 18, as is another preview of pattern matching for switch. A record patterns and array patterns proposal, updated October 20 and previously anticipated for JDK 18, is not now officially targeted, although it theoretically could become part of the release.

While JDK 17, published September 14, was a long-term support (LTS) release that will receive at least eight years of support from Oracle, JDK 18, expected in March 2022, will be a short-term feature release that is supported for six months. Early-access builds of JDK 18 can be found for Linux, Windows, and MacOS at java.net.

Specifics of the JDK 18 proposals include:

  • For the Internet-address resolution SPI, the proposal is to define an SPI for host and name address resolution so that Inet.Address can make use of resolvers other than the platform’s built-in resolver. Motivations for this effort include better enablement of Project Loom, for concurrency and new programming models in Java, along with integrating new network protocols, customization, and enabling testing. The proposal does not involve developing an alternative resolver for the JDK.
  • A second preview of pattern matching for switch, in which the Java language would be enhanced with pattern matching for switch expressions and statements, along with extensions to the language of patterns. This was previewed in JDK 17. Extending pattern matching to switch allows an expression to be tested against a number of patterns, each with a specific action, so complex data-oriented queries can be expressed concisely and safely.
  • The reimplementation of core reflection with method handles would reimplement lang.reflect.MethodConstructor, and Field on top of java.lang.invoke method handles. Having method handles serve as the underlying mechanism for reflection will reduce maintenance and development costs of both the java.lang.reflect and java.lang.invoke APIs.
  • With the simple web server proposal, a command-line tool would be provided to start a minimal web server that serves static files only. No CGI or servlet-like functionality is available. The tool will be useful for prototyping, ad-hoc coding, and testing, particularly in educational contexts. Goals of the plan include offering an out-of-the-box static HTTP file server with easy setup and minimal functionality, reducing developer activation energy and making the JDK more approachable, and providing a default implementation via the command line together with a small API for programmatic creation and customization. Providing a feature-rich or commercial-grade server is not a goal of the proposal.
  • Foreign function and memory API, in which an API is introduced through which Java programs can interoperate with code and data outside of the Java runtime. By invoking foreign functions – code outside the JVM – and by safely accessing foreign memory – memory not managed by the JVM – the API lets Java programs call native libraries and process native data without the brittleness and danger of JNI (Java Native Interface). The intent is to replace JNI with a superior, pure Java development model. For JDK 18, refinements would be incorporated, based on feedback, such as support for more carriers such as Boolean and MemoryAddress in memory access var handles, and a new API to copy Java arrays to and from memory segments.
  • The vector API would be incubated for a third time in JDK 18, having previously been incubated in JDK 16 and JDK 17. This proposal would express vector computations that compile at run time to optimal vector instructions on supported CPU architectures, achieving performance superior to equivalent scalar computations. Vector operations express a degree of parallelization enabling more work to be done on a single CPU cycle, thus producing significant performance improvements. The platform-agnostic vector API aims to provide a way to write complex algorithms in Java, using the existing HotSpot auto-vectorizer but with a user model that makes vectorization more predictable. JDK 18 would also add support for the ARM Scalar Vector Extension platform and improve performance of vector operations that accept masks on architectures that support masking in hardware.
  • Specifying UTF-8 as the default charset of the standard Java APIs. UTF-8 is a variable-wide character encoding for electronic communication and is considered the web’s standard charset. Charset is character encoding capable of encoding all characters on the web. Through this change, APIs that depend on the default charset will behave consistently across all implementations, operating systems, locales, and configurations. The proposal is not intended to define new Java-standard or JDK-specific APIs. Proponents of the proposal expect that applications in many environments will see no impact from Java’s choice of UTF-8, as MacOS, many Linux distributions, and many server applications already support UTF-8. However, there is risk in other environments, the most obvious being that applications depending on the default charset will behave incorrectly when processing data produced when the default charset was unspecified. Data corruption may silently occur. The main impact is expected to be fall on users of Windows systems in Asian locales and possibly some server environments in Asian and other locales.
  • Code snippets in Java API documentation, involving the introduction of an @snippet tag for JavaDoc’s Standard Doclet, to simplify inclusion of example source code in API documentation. Among goals of the plan is facilitating the validation of source code fragments by providing API access to those fragments. While correctness is the responsibility of the author, enhanced support in JavaDoc and related tools can make it easier to achieve. Other goals include enabling modern styling, such as syntax highlighting, as well as the automatic linkage of names to declarations, and enabling better IDE support for creating and editing snippets. The proposal notes that authors of API documentation often include fragments of source code in documentation comments.
Bamboolib: One of the Most Useful Python Libraries You Have Ever Seen

Bamboolib: One of the Most Useful Python Libraries You Have Ever Seen

I love writing about Python libraries. If you have read any of my blogs, you might know I have written about multiple libraries. Before writing, I test some Python libraries, check their most remarkable features, and, if I like, I write about them. Usually, I try to include a few libraries in the same blog to make it more informative. However, once in a while, I find libraries that are so cool that deserve their own blog. That’s the case for Bamboolib!

Bamboolib is one of those libraries that makes you think: How didn’t I know this before? Yeah, it sounds a little dramatic, but believe me, you will be surprised. Bamboolib can build the code for things that take a while to write, such as complex group by clauses. Let’s jump right in because I’m very excited to show you how it works.

Bamboolib — for beginners and for pros

Bamboolib sells itself as making any person do Data Analysis in Python without becoming a programmer or googling syntax. Based on my tests, that’s true! It requires zero coding skills. However, I see how it could be handy for people running short in time or for someone who doesn’t want to type long codes for simple tasks. I can also see how people learning Python can take advantage of it. For example, if you want to learn how to do something in Python, you can use Bamboolib, check the code it generates, and learn from it.

Either way, let’s explore how you can use it, and you can decide if it can be helpful for you or not. Let’s get started!

Read the full article here

Java, microservices, Docker and Kubernetes: Learn to use them to create an efficient enterprise

Java, microservices, Docker and Kubernetes: Learn to use them to create an efficient enterprise

If companies get too far behind the curve when adapting to cloud infrastructure, they are giving competitors an u

Running on outdated, bloated systems wastes resources that companies can’t afford. And it’s unnecessary because the technology is there; it’s simply a matter of mastering it. Fortunately, the equivalent of a masterclass on the efficient use of microservices, Java, Docker and Kubernetes is found in the Microservices eBook Bundle by O’Reilly.

Microservices have been growing in popularity over the last few years as businesses have tried becoming more Agile. You’ll learn how microservices operate and how to use them to build applications in “Microservice Architecture: Aligning Principles, Practices and Culture.”

Microservices can be a little tricky unless you get them exactly right, but when you do, the impact can be significantly positive. “Production-Ready Microservices: Building Standardized Systems” teaches you how to design stable, fault-tolerant systems, as well as how to scale them and all of the steps that follow. Just the skills you’ll learn in these first two books will be enough to make you more attractive to employers, so you may want to start checking out the best resume and job interview tips.

No business can remain competitive with solutions that have just been cobbled together to adapt applications for the cloud, a whole new system that is native to the cloud is an absolute necessity. “Cloud Native Java: Designing Resilient Systems” shows you how to do that with Spring Boot, Spring Cloud and Cloud Foundry. Follow up with “Using Docker: Developing & Deploying Software with Containers” for a step-by-step guide on how to develop, test and deploy web apps using Docker.

DevOps engineers can learn how to create, manage, operate and upgrade a Kubernetes cluster, both onsite and in the cloud, in “Managing Kubernetes: Operating Kubernetes Clusters in the Real World.” Authors Brendan Burns, a co-founder of the Kubernetes platform, and Craig Tracey, who has been working on the internet’s infrastructure for the last 20 years, are supremely qualified for teaching this subject matter. And readers have shown their approval with an average rating of 4.3 out of 5 stars.

Don’t pass up this chance to learn all about microservices and so much more while the Microservices eBook Bundle by O’Reilly is available for only $9.99 (normally $230).