Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ZnTrack zɪŋk træk
is a lightweight and easy-to-use package for tracking
parameters in your Python projects using DVC. With ZnTrack, you can define
parameters in Python classes and monitor how they change over time. This
information can then be used to compare the results of different runs, identify
computational bottlenecks, and avoid the re-running of code components where
parameters have not changed.
To get started with ZnTrack, you can install it via pip: pip install zntrack
Next, you can start using ZnTrack to track parameters, outputs and metrics in
your Python code. Here's an example of how to use ZnTrack to track the value of
a parameter in a Python class. Start in an empty directory and run git init
and dvc init
for preparation.
Then put the following into a python file called hello_world.py
and call it
with python hello_world.py
.
import zntrack
from random import randrange
class HelloWorld(zntrack.Node):
"""Define a ZnTrack Node"""
# parameter to be tracked
max_number: int = zntrack.params()
# parameter to store as output
random_number: int = zntrack.outs()
def run(self):
"""Command to be run by DVC"""
self.random_number = randrange(self.max_number)
if __name__ == "__main__":
# Write the computational graph
with zntrack.Project() as project:
hello_world = HelloWorld(max_number=512)
project.run()
This will create a DVC stage HelloWorld
. The workflow is
defined in dvc.yaml
and the parameters are stored in params.yaml
.
This will run the workflow with dvc repro
automatically. Once the graph is
executed, the results, i.e. the random number can be accessed directly by the
Node object.
hello_world.load()
print(hello_world.random_number)
Tip
You can easily load a Node directly from a repository.
import zntrack node = zntrack.from_rev( "ParamsToMetrics", remote="https://github.com/PythonFZ/zntrack-examples", rev="8d0c992" )
Try accessing the
params
parameter andmetrics
output. All Nodes from this and many other repositories can be loaded like this.
An overview of all the ZnTrack features as well as more detailed examples can be found in the ZnTrack Documentation.
On a fundamental level the ZnTrack package provides an easy-to-use interface for
DVC directly from Python. It handles all the computational overhead of reading
config files, defining outputs in the dvc.yaml
as well as in the script and
much more.
For more information on DVC visit their homepage.
If you use ZnTrack in your research and find it helpful please cite us.
@misc{zillsZnTrackDataCode2024,
title = {{{ZnTrack}} -- {{Data}} as {{Code}}},
author = {Zills, Fabian and Sch{\"a}fer, Moritz and Tovey, Samuel and K{\"a}stner, Johannes and Holm, Christian},
year = {2024},
eprint={2401.10603},
archivePrefix={arXiv},
}
This project is distributed under the Apache License Version 2.0.
The following (incomplete) list of other projects that either work together with ZnTrack or can achieve similar results with slightly different goals or programming languages.
FAQs
Create, Run and Benchmark DVC Pipelines in Python
We found that zntrack 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.