Provenance and caching library for functions, built for creating lightweight machine learning pipelines.
Project description
==========
provenance
==========
|version status| |build status| |docs|
.. |version status| image:: https://img.shields.io/pypi/v/provenance.svg
:target: https://pypi.python.org/pypi/provenance
:alt: Version Status
.. |build status| image:: https://travis-ci.org/bmabey/provenance.png?branch=master
:target: https://travis-ci.org/bmabey/provenance
:alt: Build Status
.. |docs| image:: https://readthedocs.org/projects/provenance/badge/?version=latest
:target: https://provenance.readthedocs.org
:alt: Documentation Status
``provenance`` is a Python library for function-level caching and provenance that aids in
creating Parsimonious Pythonic |Pipelines|. By wrapping functions in the ``provenance``
decorator computed results are cached across various tiered stores (disk, S3, SFTP) and
`provenance <https://en.wikipedia.org/wiki/Provenance>`_ (i.e. lineage) information is tracked
and stored in an artifact repository. A central artifact repository can be used to enable
production pipelines, team collaboration, and reproducible results. The library is general
purpose but was built with machine learning pipelines in mind. By leveraging the fantastic
`joblib`_ library object serialization is optimized for ``numpy`` and other PyData libraries.
What that means in practice is that you can easily keep track of how artifacts (models,
features, or any object or file) are created, where they are used, and have a central place
to store and share these artifacts. This basic plumbing is required (or at least desired!)
in any machine learning pipeline and project. ``provenance`` can be used standalone along with
a build server to run pipelines or in conjunction with more advanced workflow systems
(e.g. `Airflow`_, `Luigi`_).
.. |Pipelines| unicode:: Pipelines U+2122
.. _joblib: https://pythonhosted.org/joblib/
.. _Airflow: http://airbnb.io/projects/airflow/
.. _Luigi: https://github.com/spotify/luigi
Example
=======
For an explanation of this example please see the `Introductory Guide`_.
.. code-block:: python
import provenance as p
p.load_config(...)
import time
@p.provenance()
def expensive_add(a, b):
time.sleep(2)
return a + b
@p.provenance()
def expensive_mult(a, b):
time.sleep(2)
return a * b
a1 = expensive_add(4, 3)
a2 = expensive_add(1, 1)
result = expensive_mult(a1, a2)
vis.visualize_lineage(result)
.. image:: https://raw.githubusercontent.com/bmabey/provenance/master/docs/source/images/lineage_example.png
.. _Introductory Guide: http://provenance.readthedocs.io/en/latest/intro-guide.html
Installation
============
For the base functionality:
.. code:: bash
pip install provenance
For the visualization module (which requires ``graphviz`` to be installed):
.. code:: bash
pip install provenance[vis]
For the SFTP store:
.. code:: bash
pip install provenance[sftp]
For everything all at once:
.. code:: bash
pip install provenance[all]
Compatibility
============
``provenance`` is currently only compatible with Python 3.5 and higher. Updating it to work with Python 2.7x
should be easy, follow this `ticket`_ if you are interested in that.
.. _ticket: https://github.com/bmabey/provenance/issues/32
provenance
==========
|version status| |build status| |docs|
.. |version status| image:: https://img.shields.io/pypi/v/provenance.svg
:target: https://pypi.python.org/pypi/provenance
:alt: Version Status
.. |build status| image:: https://travis-ci.org/bmabey/provenance.png?branch=master
:target: https://travis-ci.org/bmabey/provenance
:alt: Build Status
.. |docs| image:: https://readthedocs.org/projects/provenance/badge/?version=latest
:target: https://provenance.readthedocs.org
:alt: Documentation Status
``provenance`` is a Python library for function-level caching and provenance that aids in
creating Parsimonious Pythonic |Pipelines|. By wrapping functions in the ``provenance``
decorator computed results are cached across various tiered stores (disk, S3, SFTP) and
`provenance <https://en.wikipedia.org/wiki/Provenance>`_ (i.e. lineage) information is tracked
and stored in an artifact repository. A central artifact repository can be used to enable
production pipelines, team collaboration, and reproducible results. The library is general
purpose but was built with machine learning pipelines in mind. By leveraging the fantastic
`joblib`_ library object serialization is optimized for ``numpy`` and other PyData libraries.
What that means in practice is that you can easily keep track of how artifacts (models,
features, or any object or file) are created, where they are used, and have a central place
to store and share these artifacts. This basic plumbing is required (or at least desired!)
in any machine learning pipeline and project. ``provenance`` can be used standalone along with
a build server to run pipelines or in conjunction with more advanced workflow systems
(e.g. `Airflow`_, `Luigi`_).
.. |Pipelines| unicode:: Pipelines U+2122
.. _joblib: https://pythonhosted.org/joblib/
.. _Airflow: http://airbnb.io/projects/airflow/
.. _Luigi: https://github.com/spotify/luigi
Example
=======
For an explanation of this example please see the `Introductory Guide`_.
.. code-block:: python
import provenance as p
p.load_config(...)
import time
@p.provenance()
def expensive_add(a, b):
time.sleep(2)
return a + b
@p.provenance()
def expensive_mult(a, b):
time.sleep(2)
return a * b
a1 = expensive_add(4, 3)
a2 = expensive_add(1, 1)
result = expensive_mult(a1, a2)
vis.visualize_lineage(result)
.. image:: https://raw.githubusercontent.com/bmabey/provenance/master/docs/source/images/lineage_example.png
.. _Introductory Guide: http://provenance.readthedocs.io/en/latest/intro-guide.html
Installation
============
For the base functionality:
.. code:: bash
pip install provenance
For the visualization module (which requires ``graphviz`` to be installed):
.. code:: bash
pip install provenance[vis]
For the SFTP store:
.. code:: bash
pip install provenance[sftp]
For everything all at once:
.. code:: bash
pip install provenance[all]
Compatibility
============
``provenance`` is currently only compatible with Python 3.5 and higher. Updating it to work with Python 2.7x
should be easy, follow this `ticket`_ if you are interested in that.
.. _ticket: https://github.com/bmabey/provenance/issues/32
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
provenance-0.11.0.tar.gz
(68.8 kB
view hashes)
Built Distribution
Close
Hashes for provenance-0.11.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b7875bae7b87465f6f4b605077976dcc8b2b5b7767d742323dba0a0a7bc3d42 |
|
MD5 | 3179e8bb9968c23282965cc7d7b6b9a8 |
|
BLAKE2b-256 | 525a7d190b6c79845f2905719e666ae15495e0478b22a85f9d764383422adb49 |