DataLens: The Data Tool That Refused to pip install Anything
The Day We Had to Build a Neural Network Without NumPy Somewhere in the DataLens build, my teammate and I hit the wall every "zero-dependency" project eventually hits: the anomaly detector needed a neural net, and the rulebook said no third-party packages. No NumPy. No pandas. No scikit-learn. Just Python 3.14's standard library. Our first reaction was denial. You cannot build an ANN without a…
Somewhere in the DataLens build, a team encountered a roadblock while trying to create a neural network using only Python's standard library. The anomaly detector required a neural network, but the project had to adhere to the rule of using zero-dependency packages. This meant no NumPy, pandas, or scikit-learn could be utilized.
The team's initial response was disbelief, as they believed it was impossible to build an artificial neural network (ANN) without a matrix library. They spent considerable time convincing themselves that some obscure math submodule could handle vectorized linear algebra, but to their dismay, they discovered that there was no shortcut.
To perform matrix multiplication in pure standard library Python, they had to resort to writing nested for loops and deal with it. In a typical scenario, installing NumPy would have been a quick two-second decision, allowing them to import it and proceed with their work. However, neither teammate had ever had to think about how A @ B works under the hood, as they had never had to write it themselves.
Constructing an autoencoder required various components, including matrix multiplication, transpose, element-wise activation functions (sigmoid, ReLU), and gradient computation for backpropagation. Without NumPy, each of these elements needed to be hand-rolled as separate functions operating on nested Python lists. The forward pass, which would typically be a single .dot() call, turned into a small file of helper functions for matrix multiplication, transpose, adding bias, and sigmoid activation and its derivative.
The most challenging aspect was not the mathematics but rather the performance. Pure Python loops over lists of lists proved to be slow, and profiling a dataset with a few thousand rows through an even small autoencoder made this evident. To optimize performance, they leaned heavily on Python's array module instead of using plain lists for weight matrices.
This approach minimized memory overhead and improved numeric access speed, as the array module stores a single primitive type contiguously instead of boxing every float as a Python object. This "zero dependency" NumPy array, which neither of them knew existed up until this project, proved to be the closest thing the standard library had to a no dependency NumPy array.
An unexpected revelation was sqlite3. Initially, the team thought of it as the toy database module, suitable only for quick local caching. However, it turned out to be a fully capable SQL engine embedded in the standard library, capable of running in-memory mode with joins, aggregates, and indexes, all without any setup. They ended up building DataLens's entire SQL analytics layer on top of sqlite3, which felt like a cheat in the best way.
The team learned that while the documentation for array made it seem like a drop-in replacement for lists with a type constraint, it only supports primitive numeric types and does not allow for nested structures. To represent a 2D matrix, they either had to flatten it into a 1D array and perform manual index math (row * width + col) or nest arrays inside a list, sacrificing the contiguous-memory benefit they had initially sought.
They chose the flattening approach, and every matrix operation had to be rewritten around this indexing scheme. Although it worked and was fast, debugging became genuinely painful. A transpose bug three layers into backpropagation looked like the model wasn't learning, not like your index math was wrong. It took significant effort and line-by-line comparison between the two of them to uncover the issue.
Initially, the constraint of using no external packages seemed arbitrary. After all, NumPy would make everything trivial and safe. However, by writing the matrix operations by hand, the team gained a deeper understanding of what a forward pass and backward pass were doing numerically, instead of relying on a black box. The deployment story of DataLens was even more compelling.
The project compiled down to a single portable .py file that ran on any machine with Python 3.14, without the need for pip install, dependency resolution, or supply-chain risk. For a data quality tool meant to run in locked-down or air-gapped environments, this lack of dependency was not just a nice-to-have but the whole point. Ultimately, the "zero dependency" limitation turned out not to be a limitation at all.
Instead, it served as a forcing function that pushed the team to genuinely learn the concepts they would have otherwise outsourced, and it provided a compelling justification to argue about whose indexing bug was responsible.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.