Skip to content

Commit

Permalink
Update License and bump version (#257)
Browse files Browse the repository at this point in the history
* update license information

* bump version

* update README.md

* update README.md

* update README.md

* update README.md

* add type hints
  • Loading branch information
PythonFZ authored Mar 16, 2022
1 parent 2745f62 commit 3e77134
Show file tree
Hide file tree
Showing 25 changed files with 296 additions and 523 deletions.
528 changes: 251 additions & 277 deletions LICENSE

Large diffs are not rendered by default.

56 changes: 30 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/f25e119bbd5d5ec74e2c/maintainability)](https://codeclimate.com/github/zincware/ZnTrack/maintainability)
![PyTest](https://github.com/zincware/ZnTrack/actions/workflows/pytest.yaml/badge.svg)
[![PyPI version](https://badge.fury.io/py/zntrack.svg)](https://badge.fury.io/py/zntrack)
[![License](https://img.shields.io/badge/License-EPL-purple.svg?style=flat)](https://www.eclipse.org/legal/epl-2.0/faq.php)
[![code-style](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black/)
[![Documentation](https://readthedocs.org/projects/zntrack/badge/?version=latest)](https://zntrack.readthedocs.io/en/latest/?badge=latest)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/zincware/ZnTrack/HEAD)
Expand All @@ -12,23 +11,24 @@

# Parameter Tracking for Python

ZnTrack [zɪŋk træk] is an easy-to-use package for tracking parameters in your Python
ZnTrack [zɪŋk træk] is an easy-to-use package for tracking parameters and creating computational graphs for your Python
projects.
What is a parameter? Anything set by a user in your code, for example, the number of
layers in a neural network layer or the window size of a moving average.
layers in a neural network or the window size of a moving average.
ZnTrack works by storing the values of parameters in Python classes and functions and
monitoring how they change for several different runs.
These changes can then be compared graphically to see what effect they had on your
workflow.
Beyond the standard tracking of parameters in a project, ZnTrack can be used to deploy
jobs with a set of different parameter values, avoid the re-running of components of code
where parameters have not changed, and to identify computational bottlenecks in your
code.
jobs with a set of different parameter values, avoid the re-running of code components
where parameters have not changed, and to identify computational bottlenecks.

## Example

ZnTrack is based on [DVC](https://dvc.org).
With ZnTrack a DVC Node on the computational graph can be written as a Python class.
DVC Options, such as parameters, input dependencies and output files are class attributes.
DVC Options, such as parameters, input dependencies and output files are defined as class attributes.

The following example shows a Node to compute a random number between 0 and a user defined maximum.

````python
from zntrack import Node, zn
Expand All @@ -38,35 +38,32 @@ from random import randrange
class HelloWorld(Node):
"""Define a ZnTrack Node"""
# parameter to be tracked
max_number = zn.params()
max_number: int = zn.params()
# parameter to store as output
random_number = zn.outs()

def __init__(self, max_number=None, **kwargs):
"""Pass tracked arguments"""
super().__init__(**kwargs)
self.max_number = max_number

random_number: int = zn.outs()

def run(self):
"""Command to be run by DVC"""
self.random_number = randrange(self.max_number)
````


This Node can then be saved as a DVC stage
This Node can then be put on the computational graph (writing the `dvc.yaml` and `params.yaml` files) by calling `write_graph()`.
The graph can then be executed e.g., through `dvc repro`.

````python
HelloWorld(max_number=512).write_graph()
````

which builds the DVC stage and can be used e.g., through `dvc repro`.
The results can then be accessed easily via `HelloWorld.load().random_number`.

More detailed examples and further information can be found in the [ZnTrack Documentation](https://zntrack.readthedocs.io/en/latest/).
Once `dvc repro` is called, the results, i.e. the random number can be accessed directly by the Node object.
```python
hello_world = HelloWorld.load()
print(hello_world.random_numer)
```
An overview of all the ZnTrack features as well as more detailed examples can be found in the [ZnTrack Documentation](https://zntrack.readthedocs.io/en/latest/).

## Wrap Python Functions
ZnTrack also provides tools to convert a Python function into a DVC stage.
This approach is much more lightweight than the class-based approach with only a reduced set of functionality.
ZnTrack also provides tools to convert a Python function into a DVC Node.
This approach is much more lightweight compared to the class-based approach with only a reduced set of functionality.
Therefore, it is recommended for smaller nodes that do not need the additional toolset that the class-based approach provides.

````python
Expand All @@ -78,6 +75,8 @@ def write_text(cfg: NodeConfig):
cfg.outs.write_text(
cfg.params.text
)
# build the DVC graph
write_text()
````

The ``cfg`` dataclass passed to the function provides access to all configured files
Expand All @@ -99,20 +98,25 @@ For more information on DVC visit their [homepage](https://dvc.org/doc).
Installation
============

Simply run:
Install the stable version from PyPi via

````shell
pip install zntrack
````

Or you can install from source with:
or install the latest development version from source with:

````shell
git clone https://github.com/zincware/ZnTrack.git
cd ZnTrack
pip install .
````

Copyright
=========

This project is distributed under the [Apache License Version 2.0](https://github.com/zincware/ZnTrack/blob/main/LICENSE).

## Similar Tools
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.

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="zntrack",
version="0.3.5",
version="0.4.0",
author="zincwarecode",
author_email="[email protected]",
description="A Python package for parameter and data version control with DVC",
Expand All @@ -20,7 +20,7 @@
classifiers=[
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
python_requires=">=3.7",
Expand Down
13 changes: 1 addition & 12 deletions zntrack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Standard python init file for the main directory
"""

import logging
import sys

Expand Down Expand Up @@ -39,7 +28,7 @@
"getdeps",
]

__version__ = "0.3.5"
__version__ = "0.4.0"

logger = logging.getLogger(__name__)
logger.setLevel(config.log_level)
Expand Down
10 changes: 0 additions & 10 deletions zntrack/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Standard python init file for the core directory
"""
from zntrack.core.base import Node
from zntrack.core.zntrackoption import ZnTrackOption

Expand Down
10 changes: 0 additions & 10 deletions zntrack/core/base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description:
"""
from __future__ import annotations

import inspect
Expand Down
8 changes: 0 additions & 8 deletions zntrack/core/functions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
"""
11 changes: 1 addition & 10 deletions zntrack/core/functions/decorator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Function decorator for ZnTrack
"""
"""Function decorator for ZnTrack"""
import copy
import dataclasses
import logging
Expand Down
11 changes: 1 addition & 10 deletions zntrack/core/zntrackoption.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Node parameter
"""
"""Node parameter"""
from __future__ import annotations

import copy
Expand Down
10 changes: 1 addition & 9 deletions zntrack/dvc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Collection of DVC options
"""Collection of DVC options
Based on ZnTrackOption python descriptors this gives access to them being used
to define e.g. dependencies
Expand Down
11 changes: 1 addition & 10 deletions zntrack/interface/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Some basic interface functionality
"""
"""Some basic interface functionality"""

from .base import DVCInterface

Expand Down
10 changes: 0 additions & 10 deletions zntrack/interface/base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description:
"""
import copy
import dataclasses
import json
Expand Down
11 changes: 1 addition & 10 deletions zntrack/metadata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: meta data collections such as execution times
"""
"""meta data collections such as execution times"""
from .base import MetaData
from .decorators import TimeIt

Expand Down
11 changes: 0 additions & 11 deletions zntrack/metadata/base.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description:
"""

import re
from abc import ABC, abstractmethod
from functools import partial
Expand Down
11 changes: 0 additions & 11 deletions zntrack/metadata/decorators.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description:
"""

from time import time

from .base import MetaData
Expand Down
11 changes: 1 addition & 10 deletions zntrack/project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Providing a project class that can run experiments
"""
"""Providing a project class that can run experiments"""
from .zntrack_project import ZnTrackProject

__all__ = ["ZnTrackProject"]
11 changes: 1 addition & 10 deletions zntrack/project/zntrack_project.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: The class for the ZnTrackProject
"""
"""The class for the ZnTrackProject"""
import logging
import subprocess
from datetime import datetime
Expand Down
11 changes: 1 addition & 10 deletions zntrack/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Standard python init file for the utils directory
"""
"""Standard python init file for the utils directory"""

from zntrack.utils import exceptions, file_io
from zntrack.utils.config import Files, config
Expand Down
11 changes: 1 addition & 10 deletions zntrack/utils/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description: Configuration File for ZnTrack
"""
"""Description: Configuration File for ZnTrack"""
import dataclasses
import logging
from pathlib import Path
Expand Down
10 changes: 0 additions & 10 deletions zntrack/utils/decorators.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
"""
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zincware Project.
Description:
"""
from functools import wraps
from inspect import signature

Expand Down
Loading

0 comments on commit 3e77134

Please sign in to comment.