ProgrammingPro #56: GitHub Actions with VS Code, Python 3.13 features, AI in DevEx, and Safe C++
Bite-sized actionable content, practical tutorials, and resources for programmers
Welcome to this week’s edition of ProgrammingPro!
In today’s Expert Insight, we bring you an excerpt from the recently published GitHub Actions Cookbook, which discusses using VS Code to author GitHub Actions workflows.
News Highlights: Python 3.13 debuts a JIT compiler and no-GIL build; GitHub Copilot research reveals mixed productivity views; GitKraken introduces an AI-integrated DevEx platform; and Google's Project IDX enters open beta.
My top 5 picks from today’s learning resources:
101 Python Automation Scripts - Streamlining Tasks and Boosting Productivity🤖
How Netflix Ensures Highly-Reliable Online Stateful Systems📺
Delivering Software Securely - Techniques for Building a Resilient and Secure Code Pipeline🔐
But there’s more, so dive right in.
Stay Awesome!
Divya Anne Selvaraj
Editor-in-Chief
PS: Our monthly survey is still in progress. If you haven’t yet, we invite you to take the opportunity to tell us what you think about ProgrammingPro so far, request a learning resource for future issues, tell us what you think about a recent development in the Programming world, and earn a Packt Credit each month to buy a book of your choice.
🗞️News and Analysis🔎
The best new features and fixes in Python 3.13: The version introduces significant improvements including a new JIT compiler for enhanced performance, the first "no-GIL" build allowing true multithreading, and refined error messages for better debugging. Read to learn more.
GitHub research reports high Copilot satisfaction from enterprise devs… but others doubt productivity gains: GitHub's research with Accenture developers found that using Copilot increased coding speed by 55% and enhanced satisfaction. Read to learn about all the varying opinions.
UBIO brings out low-code dev environment NodeScript: This low-code visual development environment allows developers to connect 'nodes' to build programs efficiently. Read to learn how NodeScript can streamline project workflows.
GitKraken Acquires CodeSee; Launches New DevEx Platform: This platform integrates with Google Gemini for AI-driven code assistance and supports various Git hosts and tools like Jira and Trello. Read to learn more about the tool.
Angular 18 will arrive next week: The version stabilizes features like deferrable views and declarative control flow, enhancing template efficiency and introducing built-in syntax for conditions and loops. Read to learn more.
Google Project IDX remote development environment now in open beta – but without iOS simulator: The browser-based remote development environment is missing an iOS simulator but includes several integrations like Gemini AI, Firebase hosting, Google Maps, and Cloud Run. Read to learn about more features.
🎓Tutorials and Learning Resources💡
Python
101 Python Automation Scripts - Streamlining Tasks and Boosting Productivity: This comprehensive article emphasizes Python's versatility and rich ecosystem of libraries, offering solutions for web scraping, GUI automation, data analysis, and more. Read to learn practical Python automation techniques.
How fast can you construct a small list of strings in C for Python?: Constructing a small list of strings in C for Python can be optimized using lower-level string construction functions for better performance. Read to gain insights into efficient memory and data management techniques that significantly boost performance.
For more Python resources go to PythonPro
C# and .NET
🎓Tutorial | How to work with Dapper and SQLite in ASP.NET Core: This tutorial covers setting up an ASP.NET Core Web API project, implementing a repository for CRUD operations using Dapper, and more. Read to learn how to build and manipulate databases efficiently
Localizing a .NET console or desktop application: This article explores a robust solution, focusing on translating texts in the Xecrets Ez desktop app developed with .NET 8 and Avalonia UI. Read to discover a contemporary method to manage localization in .NET.
🎓Tutorial | Mastering State Design Pattern in C# for Beginners: This article covers the pattern’s application from class diagrams to real-world examples. Read for insights into the pattern’s benefits and drawbacks.
C and C++
How to avoid one C++ foot gun: This article discusses a common issue in C++ programming where using pointers without careful management can lead to serious bugs like double-free errors. Read to learn about effective memory management in C++ and strategies to prevent common pitfalls like memory leaks.
🎥Sean Baxter: Safe C++: This talk explores the possibility of creating a safe subset of C++ with similar safety guarantees as Rust. Watch to learn about advanced techniques to enhance C++ safety and how to implement memory safety mechanisms similar to Rust.
🎓Tutorial | C-STRUCTURES: C structures are a user-defined data type in C, allowing you to group multiple variables of different types into a single unit. Read to learn the basics of defining, using, and manipulating C structures.
Java
Everything you need to know about Java 22: Java 22, released on March 19, 2024, includes 12 JDK Enhancement Proposals (JEPs) divided into standard, preview, and incubator features. Read to discover all their applications and examples.
Introducing Kilo: Kilo is a lightweight, open-source Java framework for creating and consuming RESTful and REST-like web services. Read to learn how to use Kilo for developing and consuming web services in Java, with practical examples of its core features.
💼Case Study| Server bootstrap optimization using RocksDB: Flipkart, an e-commerce company, optimized Mustang's bootstrap time by replacing Redis with RocksDB for in-memory data structure storage. Read to learn how the integration and tuning significantly improved deployment efficiency.
JavaScript and TypeScript
User-defined variables in JavaScript: Uuser-defined variables are essential for programming in environments like web browsers and Node.js. Read to learn the fundamental concepts of defining and managing variables in JavaScript.
javascript for loop over properties in an object: This article explores a JavaScript function designed to navigate through deeply nested objects to find specific properties. Read to learn how to iterate through deeply nested JavaScript objects.
Branded types for TypeScript: This article discusses branded types in TypeScript, which affix a unique tag to a type, helping ensure correct usage at compile-time. Read to learn how to implement branded types in TypeScript.
Go
Rust-Written Borgo Language Brings Algebraic Data Types and More to Go: Designed to be interoperable with Go's ecosystem, Borgo's syntax simplifies error handling and integrates seamlessly with existing Go packages. Read to learn how this resolves Go's limitations related to weak typing and more.
Using Cuelang With Go for LLM Data Extraction: This article details how Cuelang, excelling in strict data schema validation, pairs with Go to manage LLM data outputs, ensuring accuracy and relevancy. Read to learn how to leverage Cuelang and Go for precise data validation and extraction.
Rust
Translation of Rust's core and alloc crates: This article outlines the process and challenges of translating Rust's core and alloc crates to the Coq formal proof system using the coq-of-rust tool. Read to learn how complex code bases are translated and verified.
Tips For Faster Rust Compile Times: This article provides tips such as updating the compiler, using cargo check, enabling the parallel compiler frontend, and more. Read to learn practical strategies to enhance development efficiency and reduce compile times.
PHP
Reflection in PHP: Though not commonly needed in standard web development, reflection is crucial for creating PHP frameworks, tools, dependency injection containers, and for testing purposes. Read to learn how reflection in PHP can be utilized.
SQL
DuckDB - The tiny but powerful analytics database: It supports ingestion from formats like CSV, JSON, and Parquet, offering fast querying with SQL. Read to learn about DuckDB’s capabilities for analytics projects.
Ruby
Ruby 3.4, No More TypeError With **nil As It Is Treated As An Empty Hash: Ruby 3.4 introduced a change where using the double splat operator ** with nil no longer raises a TypeError. Read to learn about the practical implications of this change.
Swift
Swift sucks at web serving… or does it?: This article reviews a benchmark comparison of web servers in Swift, particularly focusing on the Vapor framework, against other languages like PHP, JavaScript, and Kotlin. Read to learn the importance of critically evaluating benchmark results.
Kotlin
Readability of Optimized Kotlin Code: This article discusses the readability of optimized Kotlin code, particularly in the context of implementing a data structure for Jetpack Compose. Read to learn how Kotlin's design facilitates readable and efficient coding.
Scala
What are All the Uses of an Underscore in Scala?: The underscore (_) in Scala serves various purposes: as a wildcard in pattern matching, to ignore parameters, in type flexibility, and in miscellaneous coding shortcuts. Read to learn how it facilitates cleaner and more concise code.
🌟Best Practices, Advice, and Case Studies🚀
Achieving Security by Design is a question of accountability: The software industry is facing a security crisis with a record number of new CVEs and widespread ineffective patching. Read to learn why a shift is necessary.
How Netflix Ensures Highly-Reliable Online Stateful Systems: Netflix has succeeded at minimizing failure probabilities, blast radius, and recovery times. Read to learn how server architecture, client interactions, and API design, are crucial for maintaining service integrity and responsiveness at scale.
Delivering Software Securely - Techniques for Building a Resilient and Secure Code Pipeline: This article details methods to fortify CI/CD pipelines, emphasizing restricted access, least privilege, data encryption, and continuous security assessments. Read to learn how to build and maintain secure software pipelines.
Democratizing software testing in the age of GenAI: Tools like GitHub Copilot are reshaping developers' approach to coding and testing, potentially leading to less engagement in basic testing. Read to learn how the new environment is fostering a culture where quality is a collective responsibility.
Take the Survey, Get a Packt credit!
🧠 Expert Insight 📚
Here’s an excerpt from “Chapter 2: Authoring and Debugging Workflows” in the GitHub Actions Cookbook by Michael Kaufmann.
Using Visual Studio Code for authoring workflows
Visual Studio Code (VS Code) is one of the most popular and widely used code editors in the world. It has gained significant popularity in the developer community due to its flexibility, extensive ecosystem of extensions, and strong community support.
VS Code has a high level of integration with GitHub. It offers features such as Git integration, the synchronization of your settings using your GitHub account, direct access to repositories, and the ability to create, edit, and manage GitHub Action workflows from within the editor using the extension provided by GitHub. This tight integration simplifies the workflow creation process and streamlines collaboration on GitHub action workflows.
In this recipe, we’ll install the VS Code extension for GitHub Actions and inspect what you can do with it.
Getting ready…
Before we begin, check that your email address and name are set correctly in Git:
$ git config --global user.email
$ git config --global user.name
Keep in mind that we work in public repositories. If you want to keep your email address private, …(apply the settings shown in Figure 2.1) here (and use the email from the part highlighted in red below)…:
Figure 2.1 – Keep your email address private in public repositories
This email address consists of your GitHub user ID and name in the users.noreply.github.com domain:
$ git config --global user.email 5276337+wulfland@users.noreply.github.com
GitHub will automatically associate your commit with your account without exposing your email address.
Then, clone your repository from Chapter 1 locally. You can find the corresponding URLs in the Code section of your repository under Code | Local (see Figure 2.2):
Figure 2.2 – Cloning your repository locally
I used SSH to authenticate, as I can manage my SSH keys in 1Password—but you can also use HTTPS and a PAT token. You can find more information on cloning repositories locally here:
How to do it…
Open VS Code. Open the extensions window by typing [Shift]+[Command]+[X] or [Ctrl]+[Shift]+[X] or by just clicking the Extension icon in the left bar (see Figure 2.3). Search for github actions and install the action from GitHub with the verified badge as seen here… Restart VS Code if necessary, and sign in with your GitHub account.
The extension provides the following features:
Managing workflows and monitoring workflow runs
Manually triggering workflows
Syntax highlighting for workflows and expressions
Integrated documentation
Validation and code completion
Smart validation
Smart validation is especially of great help. It supports code completion for referenced actions and reusable workflows, will parse parameters, inputs, and outputs for referenced actions, and provides validation, code completion, and inline documentation.
Open your locally cloned repository. There are multiple ways to do this. You could type code . (. stands for the current folder) on the command line inside the locally cloned repository folder. This will open a new instance of VS Code with the current folder open. Or use File | Open Folder in VS Code and select the folder in which you cloned the repository.
Click the GitHub Actions icon on the left side and inspect the Current Branch window. You can see all workflow runs in the current branch. Each run has the name of the workflow and the run ID with the hash. You can expand the workflow runs to see the jobs and steps. You can open the job log directly in VS Code, or you can open the step log in your browser.
The WORKFLOWS window shows all the workflows in the repository in the main branch. You can pin workflows to the top of the list, open the workflow file for editing, or run a trigger for the workflow if it has a workflow_dispatch trigger.
Open the workflow file.
Next, play around with autocomplete in the workflow file. Remove the value behind vars in line 15. Note the extension knows all your variables and secrets (see Figure 2.6):
Figure 2.6 – Autocomplete knows all your secrets and variables
It also has the complete workflow syntax. You can press [Control]+[Space] at any point in the workflow file to get a list of valid elements.
VS Code detects problems in your workflow file and provides quick fixes for it
In the SETTINGS window, you can find all the environments, secrets, and variables from your repository. You cannot create new environments, but you can add secrets and variables at the environment or repository level and edit or delete them.
How it works…
With the GitHub Actions Extension, VS Code is the perfect editor to write and execute workflows as you have everything in one place, you can work offline, and you have advanced syntax highlighting and auto-complete for workflows and expressions. That’s why we are going to use it in the rest of the book to write our workflows.
There’s more…
VS Code is not just available to install locally—you can also use it directly in the browser. In any GitHub repository, just press the dot [.] key to open the current repository in VS Code directly in your browser or press [Shift]+[>] to open it in a new tab. To open repositories directly in VS Code, you can also navigate to https://github.dev/<owner>/<repository>.
In GitHub.dev, you can work with files and Git as you do locally: first, commit your changes and then push them to GitHub. You can install extensions and you can sync your VS Code settings using your GitHub account.
However, if you need a terminal or install some frameworks, you have to do it locally or use GitHub Codespaces. Codespaces provide you with a full remote development environment running in Microsoft Azure. You have 120 hours and 15 GB storage per month for free (180 minutes and 20 GB with the GitHub Pro Plan); after that, you pay by minute and GB. A GB costs $0.07 cent per month, and the computing for the machine ranges between $0.18 per hour for a two-core machine to $2.88 per hour for a 32-core machine. For the purposes of this book, I opted for the local version so as to not burn through the free minutes, but if you have never tried Codespaces, I encourage you to do so. It’s a great way to have specialized development environments for each project you are working on.
GitHub Actions Cookbook by Michael Kaufmann was published in April 2024. You can read the entire first chapter and buy the book here! Packt library subscribers can view all the screenshots and continue reading the entire book for free here.
🛠️ Useful Tools ⚒️
surrealdb: a multi-model database that simplifies development and enhances adaptability by reducing server-side components and supporting various querying languages.
multilspy: a cross-platform library that simplifies interaction with language servers, allowing easy setup and use for static code analyses across multiple programming languages via the Language Server Protocol (LSP).
Loglayer: a tool that standardizes log definitions, context handling, metadata, and error reporting across various logging libraries, offering a consistent API for seamless integration and minimal configuration.
That’s all for today.
We have an entire range of newsletters with focused content for tech pros. Subscribe to the ones you find the most useful here. Complete ProgrammingPro archives can be found here. Complete PythonPro archives are here.
If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want to advertise with us.
If you have any feedback, leave a comment below.