Debian Codegraph @

docs/pydepmanag.rst

raw
1 Python and the Management of Dependencies
2 =========================================
3
4 Python has an extensive standard library ("batteries included!"), but is
5 frequent the necessity of using other modules not included there, mostly
6 from the Python Package Index (`PyPI <https://pypi.python.org/pypi>`_).
7
8 The original way of installing those modules is at "system level"
9 (`sudo pip install foobar`), in the operating system in a general way,
10 making them available to be used by any program that is executed.
11
12 Beyond needing root or administrator level to install the dependencies in
13 that way, the first problem we find are conflicts: the typical case of two
14 programs needing two different versions of the same dependency, which can
15 not be achieved when installing the dependencies globally.
16
17 This is why is so normal in Python to use "virtual environments" (or
18 "virtualenvs"). A new virtualenv is created for each program, the needed
19 dependencies for each program are installed in the corresponding virtualenv,
20 and as stuff in a virtualenv is only accessible from inside the virtualenv,
21 there are no conflicts anymore.
22
23 At this point, however, we hit the problem of the administration of the
24 virtualenvs themselves: create them, install modules in them, activate them
25 to be uses by each program and deactivate them later, remember the names of
26 each environment for each program, etc.
27
28 To automatize this, `fades <https://fades.readthedocs.org/>`_ was born.
29
30 *fades* allows you to unleash all the power of virtualenvs without needing
31 to worry about them.
32
33 Do you want to execute a script that needs the ``foobar`` dependency?
34 ``fades -d foobar script.py``
35
36 Do you want an interactive interpreter having ``foobar`` installed as
37 dependency? ``fades -d foobar``
38
39 Do you need to execute the script but with several dependencies, one with
40 a specific version? ``fades -d foo -d bar -d baz==1.1 script.py``
41
42 Do you have all the dependencies in a requirements file?
43 ``fades -r requirements.txt script.py``
44
45 These are only simple examples of what you can do with *fades*. Virtual
46 environments are a very powerful tool, and automate and simplify their
47 use makes *fades* to have a lot of options, some that you will use
48 everyday, others that will prove useful in some specific situations.
49
50 Start to use *fades* step by step (`check the docs
51 <https://fades.readthedocs.org/en/latest/readme.html>`_) and will find
52 that it will solve the dependencies management in your programs and
53 scripts, using virtualenvs but without the complexity of having to deal
54 with them by hand.