A package to install git in AWS Lambda.
Project description
lambda-git
A git binary installed through PyPI for AWS Lambda - inspired by the JavaScript package lambda-git and backported to Python.
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'] = 'me@email.com'
commit_env['GIT_COMMITTER_NAME'] = 'My Name'
commit_env['GIT_COMMITTER_EMAIL'] = 'me@email.com'
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.
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
lambda-git-0.1.0.tar.gz
(9.0 MB
view hashes)
Built Distribution
Close
Hashes for lambda_git-0.1.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac46aab2dea0ee25197b34b371d3e1f192f3f1408073177aeca9ef973f9a3622 |
|
MD5 | bd61c3bd95a7e29d8f3f8575b00f1e0d |
|
BLAKE2b-256 | 42d908a0902b11ac2752c3f80acd7b0086f6d784a8e1b7874183591e1a2cf778 |