Skip to main content

SDK that helps to manage dependencies directly from git repositories.

Project description

Git dependency python

A packaged used to manage dependencies in git repositories for python projects.

Prepare your project

Install script

Your projects need to contain bash installation file which looks like this:

#!/usr/bin/env bash

PYTHON=$1
ENVIRONMENT=$2
CHILD=$3
DIR_NAME=$(dirname $0)
CURRENT_PATH=$(pwd)

# Remove previous failed builds.
rm -rf *.egg-info build dist

set -e

if [[ "$ENVIRONMENT" = "dev" || "$ENVIRONMENT" = "prod" ]]
then
    echo "Running installation with python '$PYTHON' and path (script: '$DIR_NAME', pwd: $CURRENT_PATH) in '$ENVIRONMENT' environment."
    ${PYTHON} -m pip install git-dependency-installer --upgrade --force-reinstall
    ${PYTHON} $DIR_NAME/setup.py sdist
    
    if [[ "$CHILD" = "--child" ]]
    then
        ${PYTHON} -m pip install dist/* --install-option=--environment="$ENVIRONMENT" --install-option="$CHILD"
    else
        ${PYTHON} -m pip install dist/* --install-option=--environment="$ENVIRONMENT"
    fi

else
    echo "Unsupported environment!"
    exit 1
fi

# Remove build leftovers.
rm -rf *.egg-info build dist

Setup.py file

Also, you need to modify your projects' setup.py files to:

from git_dependency_installer.setup_helper import prepare_setup, install_deps

PACKAGE_VERSION = 'major.minor.bugfix'  # Example: 1.0.0.
PROJECT_NAME = '<your-project-name>'  # Example: my-cool-s3-dependency.
DESCRIPTION = '<your-project-description>'  # Example: Library used to work with S3 buckets.
PARENT_PROJECT_NAME = '<your-main(parent)-project-name>'  # Example: my-cool-project.

INTERNAL_DEPENDENCIES = [
    ['my-cool-other-dependency', '2.*.*', 'my-team/my-cool-other-dependency'],
    ...
]

EXTERNAL_DEPENDENCIES = [
    'requests==2.18.4',
    'Django==2.0.3',
    ...
]

prepare_setup(PACKAGE_VERSION, PROJECT_NAME, DESCRIPTION, PARENT_PROJECT_NAME)
install_deps(EXTERNAL_DEPENDENCIES, INTERNAL_DEPENDENCIES)

Prepare your git

Tagging

Start git-tagging your commits. Example, for development tag your commits like this dev-2.1.0, for production tag your commits like this: 2.1.0.

Using ssh

Setup SSH file for your git repositories and start using SSH over HTTPS.

Credits

This package is a direct copy of the package git-dependency-python by Laimonas Sutkus, except pip version assertion is removed, as the asserted version (18.1) is outdated and doesn't allow installation of some newer packages.

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

git_dependency_installer-1.0.3.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_dependency_installer-1.0.3-py2.py3-none-any.whl (36.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file git_dependency_installer-1.0.3.tar.gz.

File metadata

File hashes

Hashes for git_dependency_installer-1.0.3.tar.gz
Algorithm Hash digest
SHA256 88f9c96af6ed91dfb4c1e263b85dd3e5ca68badd4890a49b47400d1fc4d72d4d
MD5 8bd00af5c6015f0381bb5c42f0516103
BLAKE2b-256 069db0c72fba82bf2a2a6600ca539588fee8dcc13fdccba99bcc39be174bd1cd

See more details on using hashes here.

File details

Details for the file git_dependency_installer-1.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for git_dependency_installer-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6b26b829ba639d8ee14c506d9a7bad5e104c09186430fe5b579aa52116186398
MD5 12861e8098a9c639f3dc29a28c9e5e0f
BLAKE2b-256 00ed9f884e9d83df90bb1b33fa9ddb52f10054e2631c7100d9d54264a6c16207

See more details on using hashes here.

Supported by

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