Skip to main content

A library for running Python functions (callables) from git repositories in various states of isolation with integrating caching.

Project description

Arca

https://img.shields.io/travis/mikicz/arca.svg https://img.shields.io/codecov/c/github/mikicz/arca.svg https://img.shields.io/pypi/v/arca.svg https://img.shields.io/github/license/mikicz/arca.svg?style=flat https://img.shields.io/readthedocs/arca.svg

Arca is a library for running Python functions (callables) from git repositories in various states of isolation. Arca can also cache the results of these callables using dogpile.cache.

Getting started

Glossary

  • Arca - name of the library. When written as Arca, the main interface class is being referenced.

  • Task - definition of the function (callable), consists of a reference to the object and arguments.

  • Backend - a way of running tasks.

Installation

Requirements
  • Python >= 3.6

Requirements for certain backends:

Installation

To install the last stable version:

python -m pip install arca

Or if you wish to install the upstream version:

python -m pip install git+https://github.com/mikicz/arca.git#egg=arca

Example

To run a Hello World example you’ll only need the arca.Arca and arca.Task classes. Task is used for defining the task that’s supposed to be run in the repositories. Arca takes care of all the settings and provides the basic API for running the tasks.

Let’s say we have the following file, called hello_world.py, in a repository https://example.com/hello_word.git, on branch master.

def say_hello():
   return "Hello World!"

To call the function using Arca, the following example would do so:

from arca import Arca, Task

task = Task("hello_world:say_hello")
arca = Arca()

result = arca.run("https://example.com/hello_word.git", "master", task)
print(result.output)

The code would print Hello World!. result would be a arca.Result instance which currently only has one attribute, output, with the output of the function call. If the task fails, arca.exceptions.BuildError would be raised.

By default, the Current Environment Backend is used to run tasks, which uses the current Python, launching the code in a subprocess. You can learn about backends here.

Further reading

You can read the full documentation on Read The Docs.

Running tests

To run tests you’ll need the optional requirements, Docker and Vagrant. Once you have them and they can be used by the current user you just need to run:

python setup.py test

This will launch the tests and a PEP8 check. The tests will take some time since building the custom docker images is also tested and vagrant, in general, takes a long time to set up.

Contributing

I am developing this library as my bachelor thesis and will be not accepting any PRs at the moment.

Changes

0.1.1 (2018-04-23)

Updated gitpython to 2.1.9

0.1.0 (2018-04-18)

Initial release

Changes:
  • Updated PyPI description and metadata

0.1.0a0 (2018-04-13)

Initial alfa release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arca-0.1.1.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

arca-0.1.1-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file arca-0.1.1.tar.gz.

File metadata

  • Download URL: arca-0.1.1.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for arca-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8ccb034176186c54cececfa4f593b76c5c88d355709378784ba44e51ad953ab5
MD5 b08593d33db227ff8c8cd3ea60a1cef8
BLAKE2b-256 14f4826a4da2dcaaad2cfad12f28e8fd3bb2fb9a83fb10697274158ecc4bff74

See more details on using hashes here.

File details

Details for the file arca-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for arca-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32944783ab6951244ec8e917a96a84973a874b95b095a5dcca2495a1be0c3fc5
MD5 a58092c9842d956bab1c897401714599
BLAKE2b-256 710a3f60a9cbb6ac27ab99ce7b90411e2acd7a1e425e79c81ae71ab3c078eef6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page