RSSAmplifier

Blog

Robert Knight

Recent content on Robert Knight

robertknight.me.ukRSS feed ↗11 posts

Latest posts

RTen in 2025

RTen is a machine learning runtime for Rust that was first released in December 2023. It enables you to take models that have been trained in Python (eg. using PyTorch) and run them in Rust. It supports models in ONNX format, which you can find many of on Hugging Face or export from frameworks such as PyTorch . The project started out as a runtime for Ocrs , an OCR library and CLI tool. It has…

The RTen machine learning runtime - a 2024 retrospective

RTen is a machine learning runtime for Rust that I have been working on since mid 2022. It allows you to take models that have been trained in Python, using a framework such as PyTorch or Keras and run them in a Rust project. This includes many pre-trained models that are available on places such as Hugging Face . Models are first exported to ONNX which is a portable exchange format for models,…

Shallow rendering revisited: Better unit tests for React/Preact components

In this post I will discuss the benefits of isolating tests for React/Preact UI components from the details of child components, and the various approaches that we looked at for our frontend projects at Hypothesis . I will explain why we settled on the approach that we did and provide links if you would like to use the same tools and techniques in your projects. Why mock child components? When…

Mocking ES6 and CommonJS modules with Babel

A common need when writing unit tests is to limit the scope of the code being tested and force certain code paths to be executed by mocking imported functions / classes etc. and controlling their outputs. In an earlier post I wrote about how existing tools for mocking JavaScript modules work when using the Browserify bundler, and problems with it. In this blog post, I present the approach that we…

Keeping reviewers happy when developing larger changes

The challenge When developing a large change to a project, in a team that uses code review and frequent deployments, there is a conflict that often comes up: There is uncertainty at the outset about what exactly will need to change and the best approach to take. This tends to demand being highly iterative while working on the code. You’ll find unforeseen complexities part-way through.…

Browserify and dependency mocking

Update (2019-04-11) - After exploring various alternatives, I wrote a new Babel plugin to solve the problems outlined in this blog post. Browserify is a tool that enables a collection of Node.js-style modules (aka. CommonJS) to be bundled together into a script file that can be loaded in the browser. This post explores the structure of the JavaScript bundles that Browserify generates and how the…

Encrypting secrets in a Git repository using git-crypt

git-crypt provides a way to encrypt a subset of files in a Git repository such that only specific collaborators can decrypt them, while making it possible for everyone else to access the unencrypted files and perform standard Git operations on the repository. At Hypothesis we use this to store various secrets (API keys, passwords) in a “playbook” repository for use by developers…

Web request and database transaction integration with Pyramid and SQLAlchemy

I recently had to debug a thorny issue in Hypothesis with the integration between our web framework Pyramid and database ORM SQLAlchemy . This integration is responsible for ensuring that changes to business objects (annotations, users, groups) made when processing API requests or form submissions actually get persisted to the database. Understanding how this works from the existing documentation…

Notes on React Europe 2016

The second React Europe conference has just finished and this is a jotting-down of some thoughts on the conference and my favorite talks whilst the Parisian red wine and almond croissants clear out of my system. The organizers are kindly putting up videos on YouTube as I write this. The Conference This was a two-day conference preceded by a hackathon kindly hosted by Mozilla and a welcome event…

Optimizing Webpack build times and improving caching with DLL bundles

Webpack’s Dll and DllReference plugins are a way to split a large JavaScript project into multiple bundles which can be compiled independently. They can be used to optimize build times (both full and incremental) and improve caching for users by putting code which changes infrequently into separate “library” bundles. The term ‘Dll’ is short for Dynamically Linked…

Understanding the QWidget layout flow

When layouts in a UI are not behaving as expected or performance is poor, it can be helpful to have a mental model of the layout process in order to know where to start debugging. For web browsers there are some good resources which provide a description of the process at different levels. The layout documentation for Qt describes the various layout facilities that are available but I…