Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice to install dependencies?

I am thinking of a good way to ship my application which is a python package. Installing my package is easy making use of pythons distutils package.

The trouble comes with the dependencies my package relies on. If the dependencies are python packages I can deal with them easily again using distutils, but non python packages? Some of them even need a lot of care while building and installing them since very special compiler flags need to be set and so forth...

If I want to automate the installation procedure for the user what is the best way to go about it?

  1. Writing a make file that downloads and installs the dependencies
  2. Write a script that installs the dependencies
  3. No automation is best. simply write a manual that tells the user how to install the dependencies
  4. ???

Thx in advance for any answer or suggestion

like image 422
Woltan Avatar asked May 02 '11 09:05

Woltan


People also ask

Should you pin Python dependencies?

You should always pin your dependencies as it increases the possibility of safe, repeatable builds, even as time passes. The pinned versions are your declaration as a package maintainer that you've verified that your code works in a given environment.

Does pip install dependencies automatically?

Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI). But if packages are installed one at a time, it may lead to dependency conflicts.

What is the command used to install all dependencies for a project?

By default, npm install will install all modules listed as dependencies in package.json .


1 Answers

We have a project named Kivy ( http://kivy.org/ ), that have exactly the same issue. At the early stage, we've done a all-in-one package that include every setup of every dependencies. However the user was having a lot of "Next >" button to click... for every deps (Windows). So now, we have managed to take care ourself of the dependencies.

Except linux related (since all our deps are already packaged on "linux"), we have taken the approach of managing what we named "portable-deps" zipfile for each platform. And then, we have a script that:

  1. Download the portable-deps zip
  2. Include the latest version of our project
  3. Add launcher script in the root directory
  4. Zip the root directory, and rename the zip to project--.zip

With a special case for MacOSX, where the zip is a dmg with a little UI.

The good part is that the user don't have to care about deps, and developers know exactly what binaries are delivered with the project :)

For information, we have build_portable commands for distutils :

  • https://github.com/kivy/kivy/blob/master/kivy/tools/packaging/osx/build.py
  • https://github.com/kivy/kivy/blob/master/kivy/tools/packaging/win32/build.py
like image 52
tito Avatar answered Sep 20 '22 00:09

tito