GithubHelp home page GithubHelp logo

hroncok / arca Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pyvec/arca

0.0 1.0 0.0 250 KB

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

Home Page: https://arca.readthedocs.io/en/latest/

License: MIT License

Python 100.00%

arca's Introduction

Arca

https://img.shields.io/github/license/mikicz/arca.svg?style=flat

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

If you want to use the Docker backend:

python -m  pip install arca[docker]

Or if you want to use the Vagrant backend:

python -m pip install arca[vagrant]

Or if you wish to install the upstream version:

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

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.

Links

License

This project is licensed under the MIT License - see the LICENSE file for details.

arca's People

Contributors

mikicz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.