
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
knit-graphs
Advanced tools
A graph representation of knitted structures where each loop is a node and edges represent yarn and stitch relationships.
The knit-graphs packaged provides a data structure for representing knitted structures formed of loops of yarn (nodes) connected by various edge structures. Loops are connected by: floats (yarn-edges) in a yarn graph structure, stitch edges (loops pulled through loops), and crossed over each other in a wale-braid structure.
Knit graphs provide a powerful tool for representing knitted structures for digital fabrication systems such as knitting machine programming languages and design tools.
Additional details about this knit-graph construction are available in the ACM publication: "KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting"
pip install knit-graphs
The knit-graph-generators subpackage provides a library of basic knit graphs to generate such as casting on loops of a knitted structure, creating Jersey (aka Stockinette) tubes and swatches, and other basic textures. For example, to generate a swatch of knit-purl ribbing use the following:
from knit_graphs.basic_knit_graph_generators import kp_rib_swatch
width = 10
height = 10
kp_rib_swatch = kp_rib_swatch(width, height)
Additional examples of knitgraph generator usage can be found in the Knit_Graph test module.
Knitgraphs can be created without generators. We encourage users to review the generators as simple examples on creating a knit graph programmatically.
We provide simple support for visualizing knit graphs. This is primarily used to debugging simple knit graph programs.
For example, we can visualize a swatch of seed stitch (checkered knit and purl stitches) with the following code.
from knit_graphs.basic_knit_graph_generators import seed_swatch
from knit_graphs.knit_graph_visualizer.Stitch_Visualizer import visualize_stitches
width = 4
height = 4
swatch = seed_swatch(width, height)
visualize_stitches(swatch)
The visualizer shows knit stitches (loops pulled from the back of the fabric to the front) as blue edges and purl stitches (loops pulled from the front to back) (aka back-knits) as red edges. Loop nodes are circles labeled with their time-ordered index and colored to match their yarn (defaults to dark green). The yarn edges (aka floats) connecting them are made of thin edges the same color as the loop nodes.
Additional examples of using the visualizer are available in the Stitch Visualizer Tests Module
The design of this data scructure was completed by the authors of "KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting".
The inclusion of the Artin-Braide wale crossing construction was inspired by "An Artin Braid Group Representation of Knitting Machine State with Applications to Validation and Optimization of Fabrication Plans" by Jenny Lin and James McCann.
knit-graphs is distributed under the terms of the MIT license.
FAQs
A graph representation of knitted structures where each loop is a node and edges represent yarn and stitch relationships.
We found that knit-graphs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.