python packages: how to depend on the latest version of a separate package

281 Views Asked by At

I'm developing coding a test django site, which I keep in a bitbucket repository in order to be able to deploy it easily on a remote server, and possible share development with a friend. I use hg for version control.

The site depends on a 3rd party app (django-registration), which I needed to customize for my site, so I forked the original app and created a 2nd repository for it (the idea being that this way I can keep up with updates on the original, which wouldnt be possible if I just pasted the code into my main site, plus add to my own custom code) (You can see some more details on this question)

My question is, how do I specify requirements on my setup.py file so that when I install my django site I get the latest version of my fork for the 3rd party app (I use distribute rather than setuptools in case that makes a difference)?

I have tried this:

install_requires = ['django', 'django-registration'],
dependency_links = ['https://[email protected]/myuser/django-registration#egg=django_registration']

but this gets me the latest named version on the original trunk (so not even the tip version)

Using a pip requirements file however works well:

hg+https://[email protected]/myuser/django-registration#egg=django-registration

gets me the latest version from my fork.

Is there a way to get this same behaviour directly from the setup.py file, without having to install first the code for the site, then running pip install -r requirements.txt?

This question is very informative, but seems to suggest I should depend on version 'dev' or the 3rd party package, which doesn't work (I guess there would have to be a specific version tagged as dev for that)

Also I'm a complete newbie in packaging / distribute / setuptools, so dont hold back spelling out the steps :)

Maybe I should change the setup.py file on my fork of the 3rd party app, and make sure it mentions a version number. Generally I'm curious to know what's a source distribution, as opposed to simply having my code on a public repository, and what would be a binary distribution in my case (an egg file?), and whether that would be any more practical for me when deploying remotely / have my friend deploy on his pc. And also would like to know how do I tag a version on my repository for setup.py to refer to it, is it simply a version control tag (hg in my case)?. Feel free to comment on any details you think are important for the starter packager :)

Thanks!

1

There are 1 best solutions below

0
On

put this:

dependency_links=['https://bitbucket.org/abraneo/django-registration/get/tip.tar.gz#egg=django-registration']

in the dependency_links you have to pass a download url like that one.

"abraneo" is a guy who forked this project too, replace his name by yours.