Coder Social home page Coder Social logo

lambda-git's Introduction

lambda-git

A git binary installed through PyPI for AWS Lambda - inspired by the JavaScript package lambda-git.

Installation

$ pip install lambda-git

Usage

To use this, just require it and call exec_command. E.g:

import git

git.exec_command('init') # will run 'git init'

Executing commands in a specific path:

AWS Lambda give you only /tmp as working directory. This package by default will execute all commands in /tmp, but it can be overridden by passing cwd.

import git

new_repo_path = '/tmp/my-new-repo'
os.mkdir(new_repo_path)
git.exec_command('init', cwd=new_repo_path)

Executing commands with separate environment:

By default every git command will be executed with the system environment, but it can be overridden by setting env.

import git

commit_env = os.environ
commit_env['GIT_AUTHOR_NAME'] = 'My Name'
commit_env['GIT_AUTHOR_EMAIL'] = '[email protected]'
commit_env['GIT_COMMITTER_NAME'] = 'My Name'
commit_env['GIT_COMMITTER_EMAIL'] = '[email protected]'

new_repo_path = '/tmp/my-new-repo'

git.exec_command('add', '.', cwd=new_repo_path)
git.exec_command('commit', '-m "first commit"', cwd=new_repo_path, env=commit_env)

Testing

$ python -m nose

Contributing

This repository is open to contributions.

lambda-git's People

Contributors

eredi93 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.