5

Say I have a python project named myproject, that depends on mydependency. Both are maintained by me.

How can I make a setup.py for myproject so that it always tries to install a new version of mydependency, regardless of the one installed?

Say I have a setup.py for a project with

setup(
    ...
    install_requires=['mydependency'],
    dependency_links = ['url_to_mydependecy_repo@develop#egg=mydependency'],
    ....
)

The problem is that, on the second time the installation runs, mydependency will already be installed, so the installation will not fetch the repo and try to install a newer version. Since mydependecy is being actively developed (by me), I need myproject's installation to always fetch the dependency link.

I've tried using #egg=mydependency-dev for the dependency_link and 'mydependency==dev' in install_requires, with version='dev' on the setup.py of mydepency, but on the second installation 'dev' is already present, so it doesn't get fetched again.

Using a requirements.txt for myproject, with the same content of dependency_links, does exactly the same. On the following installations, the requirement is already met, so it won't be fetched again.

Note: using pip -r requirements.txt --upgrade does what I want, but I'm not installing manually, but from Openshift, so I can't really add --upgrade

1 Answer 1

1

Try to link myproject dependencies to dev-version of mydependency as you've tried already, but use a "valid" (semver?) versioning within your mydependency repo (i. e. not set version to dev). This will cause redownloading and reinstalling of a dependency (this works in my case, at least):

setup(
    ...
    install_requires=['mydependency == dev'],
    dependency_links = ['url_to_mydependecy_repo@develop#egg=mydependency-dev'],
    ....
)
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, but doing that makes it always clone the repo, but the installation stops at some point, because something like '0.1.dev1234567' does not match 'mydependency==dev' :/
@jpimentel doest it really stop? In my case I see this message, but installing process continues
It seems like it installs mydependency, but doesn't check or install mydependency's dependencies, so it's close but not there yet...
Probably you can do same trick with dependencies of mydependency :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.