Tag: python

How can I install from a git subdirectory with pip?

I have a git repository with many folders, one of them being a python module installable with pip, like this: repo.git/ repo.git/folder1/ repo.git/folder2/ repo.git/mymodule/ repo.git/mymodule/__init__.py repo.git/mymodule/setup.py repo.git/mymodule/… Right now I have to do the following to install: git clone http://server/repo.git cd repo pip install mymodule cd .. rm -rf repo Is it possible to install […]

git show/log without shell escape sequences, for use with python sh

I’m using python‘s sh to script git commands. For example, I do things like import sh git = sh.git.bake(_cwd=’/some/dir/’) project_hash = git(‘rev-parse’, ‘HEAD’).stdout.strip() project_branch = git(‘rev-parse’, ‘–abbrev-ref’, ‘HEAD’).stdout.strip() project_date = git(‘log’, ‘-1’, ‘–pretty=format:%ci’).stdout.strip() and then I write the project_hash, project_branch and project_date into a database, etc. The trouble is git sometimes adds shell escape sequences […]

How to write a git hook to restrict writing to branch?

I’d like to restrict write access for the master branch to only several developers, while allowing others to pull everything and push to other non-master branches. Idea is that a developer would push to some other branch and then if code passes review, reviewer would merge it into the master branch. I’m pretty sure that […]

Deploying existing Django app on Heroku

Following the Heroku tutorial but I have already created a rather complex Django app that I want to upload. I have copied it to a fresh folder and issued git init successfully, along with adding the files to a commit. I do heroku create –stack cedar so I get a site then issue the git […]

How can I save my secret keys and password securely in my version control system?

I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it’s bad practice to keep secrets (like private keys and database passwords) in a VCS repository. But passwords–like any other setting–seem like they should be versioned. So what is the proper way […]

Recommended .gitignore file for Python projects?

I’m trying to collect some of my default settings, and one thing I realized I don’t have a standard for is .gitignore files. There’s a great thread showing a good .gitignore for Visual Studio projects, but I don’t see many recommendations for Python and related tools (PyGTK, Django). So far, I have… *.pyc *.pyo …for […]

Automatically remove *.pyc files and otherwise-empty directories when I check out a new branch

So here’s an interesting situation when using git and python, and I’m sure it happens for other situations as well. Let’s say I make a git repo with a folder /foo/. In that folder I put /foo/program.py. I run program.py and program.pyc is created. I have *.pyc in the .gitignore file, so git doesn’t track […]

Is it possible to use pip to install a package from a private github repository?

As the title suggests I am trying to install a python package from a private github repo. For a public repository I can issue the following command which works fine: pip install git+git://github.com/django/django.git However if I try this for a private repository: pip install git+git://github.com/echweb/echweb-utils.git I get the following output: Downloading/unpacking git+git://github.com/echweb/echweb-utils.git Cloning Git repository […]

pip connection failure: cannot fetch index base URL http://pypi.python.org/simple/

I run sudo pip install git-review, and get the following messages: Downloading/unpacking git-review Cannot fetch index base URL http://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement git-review No distributions at all found for git-review Storing complete log in /home/sai/.pip/pip.log Does anyone has any idea about this?

Converting a Mercurial (hg) repository to Git on Windows (7)

I’m really quite frustrated at this point. I have an existing hg repository that has months of coding history in it, and I want to get this into a private Github repository so I can work on it from there. Unfortunately I use Windows and I can’t seem to find any way to convert the […]

Git Baby is a git and github fan, let's start git clone.