Skip to main content

Bandsaw

pipeline status coverage report

Bandsaw is a python library that allows to split a python workflow into individual tasks that can be run separately with different python interpreters and even on different machines.

What it does

Bandsaw can be used to create distributed python scripts, that define workflows in heterogeneous environments and with conflicting dependencies. It is especially meant for building complex machine learning processes, that use different machine learning frameworks like tensorflow or pytorch in a single workflow, or need to run on multiple different computation platforms, e.g. in different regions due to data restrictions.

How it works

This works by decorating python functions with the bandsaw @task decorator:

import bandsaw

...

@bandsaw.task
def my_function(x):
    return x

This decorator gives bandsaw the opportunity to run additional code before and after the code within my_function(x) is executed. This additional code is defined in classes that fulfill the Advice protocol.

When this decorated function is called, bandsaw intercepts the call first and runs the before() methods of the configured Advices. Then the wrapped function is computed and afterwards each advice's after() method is called.

Diagram of an advised task

All callback functions receive a Session object as single argument, which is used for continuing the execution by calling its proceed() method. Advices have the possibility to conclude() this early by providing a Result on their own. This shortcuts the computation and can be used for caching results. Additionally, the session can be serialized and transferred to other python processes even on other machines using its save(stream) and restore(stream) methods.

A full explanation of this can be found in the latest user guide.

Develop

Bandsaw uses tox to build and test the library. Tox runs all tests on different python versions, can generate the documentation and run linters and style checks to improve the code quality. In order to install all the necessary python modules, please run:

pip install tox

Afterwards the tests can be run by just calling

tox

from the project directory. For this to work, you need to have multiple python interpreters installed. If you don't want to run the tests on all supported platforms just edit the tox.ini file and set

envlist = py36,py37,py38

to contain only the python version you want to use. Another option is to run tox with the additional command line argument '--skip_missing_interpreters' which skips python versions that aren't installed.

Documentation

The latest version of the documentation can always be found under https://docs.kant.ai/bandsaw/latest. The documentation is written in Markdown and is located in the docs directory of the project. It can be built into static HTML by using MkDocs. In order to manually generate the documentation we can use tox to build the HTML pages from our markdown.

tox -e docs

Release

Releasing a new package version

Releasing new versions of bandsaw is done using flit.

pip install flit

In order to be able to publish a new release, you need an account with PyPI or their respective test environment.

Add those accounts into your ~.pypirc:

[distutils]
index-servers =
  pypi
  pypitest

[pypi]
username: <my-user> 

[pypitest]
repository: https://test.pypi.org/legacy/
username: <my-test-user>

Publishing a new release to test

flit publish --repository pypitest

Releasing a new version of the documentation

The package uses mike to manage multiple versions of the documentation. The already generated documentation is kept in the docs-deployment branch and will be automatically deployed, if the branch is pushed to the repository.

In order to build a new version of the documentation, we need to use the corresponding tox environment:

VERSION_TAG='<my-version>' tox -e docs-release

The VERSION_TAG environment variable should be set to the new version in format '.'. This will build the documentation and add it as new commits to the docs-deployment branch.

By pushing the updated branch to the gitlab repository, the documentation will be automatically deployed to the official documentation website.

Metadata

Release files for bandsaw 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bandsaw 0.3
File Size Uploaded Provenance Actions
bandsaw-0.3.tar.gz 74.8 kB Without provenance Details for bandsaw-0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bandsaw 0.3
File Interpreter ABI Platform Actions
bandsaw-0.3-py3-none-any.whl Python 3 none any Details for bandsaw-0.3-py3-none-any.whl

Total release size: 116.3 kB

Release files / bandsaw-0.3.tar.gz

Download URL bandsaw-0.3.tar.gz
Size 74.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9054b67af8696afdd15248be6285716bf65d6e29ff673abe33a157d7123cad68
BLAKE2b-256 checksum
How to use checksums
92d13e59cf559f56b3a29aa970e4bdef60a2f842ed93e5ef58b7236c6b99e769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.26.0

Release files / bandsaw-0.3-py3-none-any.whl

Download URL bandsaw-0.3-py3-none-any.whl
Size 41.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1acd788b3bbdce1ab003e2b8f873219615e9f57a6a4f8fc900a4f0635da70fa9
BLAKE2b-256 checksum
How to use checksums
29eb1782ac18957c74b2a772c45793f8e8d5f15d276024eab04482bfc70b4b22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.26.0

Security for bandsaw 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page