Skip to content

Commit 27915ac

Browse files
committed
working on app dependencies page
1 parent d52e728 commit 27915ac

File tree

3 files changed

+111
-28
lines changed

3 files changed

+111
-28
lines changed

application-dependencies.html

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,63 @@
7474
<div class="row">
7575
<div class="col-md-8">
7676
<h1>Application Dependencies</h1>
77-
<p>Application dependencies are the Python libraries and their versions
78-
required for an application to work properly. These dependencies are
79-
installed separately from system-level packages to prevent library version
80-
conflicts.</p>
81-
<p>The most common way to install Python library dependencies is with
82-
the <a href="http://www.pip-installer.org/en/latest/">pip</a>
83-
command combined with
84-
<a href="http://www.virtualenv.org/en/latest/">virtualenv</a> to isolate the
85-
dependencies of individual applications from each other.</p>
77+
<p>Application dependencies are the libraries other than your project code
78+
that are required to create and run your application. </p>
79+
<h2>Why are application dependencies important?</h2>
80+
<p>Python web applications are built upon the work done by thousands of open
81+
source programmers. Application dependencies include not only web frameworks but
82+
also libraries for scraping, parsing, processing, analyzing, visualizing,
83+
and myriad other tasks. Python's ecosystem facilitates discovery, retrieval and
84+
installation so applications are easier for developers to create.</p>
85+
<h2>Finding libraries</h2>
86+
<p>Python libraries are stored in a central location known as the
87+
<a href="https://pypi.python.org/pypi">Python Package Index</a> (PyPi). PyPi contains
88+
search functionality with results weighted by usage and relevance based on
89+
keyword terms.</p>
90+
<h2>Isolating application dependencies</h2>
91+
<p>Dependencies are installed separately from system-level packages to prevent
92+
library version conflicts. The most common isolation method is
93+
<a href="http://www.virtualenv.org/en/latest/">virtualenv</a>. Each virtualenv is its
94+
own copy of the Python interpreter and depedencies in the site-packages
95+
directory. To use a virtualenv it must first be created with the virtualenv
96+
command and then activated.</p>
97+
<h2>Downloading and installing Python dependencies</h2>
98+
<p>The recommended way to install Python library dependencies is with the
99+
<a href="http://www.pip-installer.org/en/latest/">pip</a> command when a virtualenv
100+
is activated.</p>
86101
<p>Pip and virtualenv work together and have complementary responsibilities.
87102
Pip downloads and installs application dependencies from the central
88-
<a href="https://pypi.python.org/pypi">PyPi</a> repository. Virtualenv creates an
89-
isolated Python installation is where those dependencies are installed into.</p>
103+
<a href="https://pypi.python.org/pypi">PyPi</a> repository. </p>
90104
<h2>requirements.txt</h2>
91105
<p>The pip convention for specifying application dependencies is with a
92106
<a href="http://www.pip-installer.org/en/1.4.1/cookbook.html#requirements-files">requirements.txt</a>
93107
file. When you build a Python web application you should include a
94-
requirements.txt file with
95-
<a href="https://devcenter.heroku.com/articles/python-pip">pegged dependencies</a>.</p>
108+
requirements.txt file. </p>
109+
<h3>requirementst.txt example with pegged dependencies</h3>
110+
<p>Python projects' dependencies for a web application should be specified in the
111+
requirements.txt with
112+
<a href="https://devcenter.heroku.com/articles/python-pip">pegged dependencies</a> like
113+
the following:</p>
114+
<div class="codehilite"><pre><span class="n">django</span><span class="o">==</span><span class="mf">1.6</span>
115+
<span class="n">bpython</span><span class="o">==</span><span class="mf">0.12</span>
116+
<span class="n">django</span><span class="o">-</span><span class="n">braces</span><span class="o">==</span><span class="mf">0.2.1</span>
117+
<span class="n">django</span><span class="o">-</span><span class="n">model</span><span class="o">-</span><span class="n">utils</span><span class="o">==</span><span class="mf">1.1.0</span>
118+
<span class="n">logutils</span><span class="o">==</span><span class="mf">0.3.3</span>
119+
<span class="n">South</span><span class="o">==</span><span class="mf">0.7.6</span>
120+
<span class="n">requests</span><span class="o">==</span><span class="mf">1.2.0</span>
121+
<span class="n">stripe</span><span class="o">==</span><span class="mf">1.9.1</span>
122+
<span class="n">dj</span><span class="o">-</span><span class="n">database</span><span class="o">-</span><span class="n">url</span><span class="o">==</span><span class="mf">0.2.1</span>
123+
<span class="n">django</span><span class="o">-</span><span class="n">oauth2</span><span class="o">-</span><span class="n">provider</span><span class="o">==</span><span class="mf">0.2.4</span>
124+
<span class="n">djangorestframework</span><span class="o">==</span><span class="mf">2.3.1</span>
125+
</pre></div>
126+
127+
128+
<p>Pegged dependencies with precise version numbers or Git tags are important
129+
because otherwise the latest version of a dependency will be used. While
130+
it may sound good to stay up to date, there's no telling if your application
131+
actually works with the latest versions of all dependencies. Developers should
132+
deliberately upgrade and test to make sure there were no backwards-incompatible
133+
modifications in newer dependency library versions.</p>
96134
<h2>setup.py</h2>
97135
<p>There is another type of dependency specification for Python libraries
98136
known as

feeds/all.atom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<feed xmlns="http://www.w3.org/2005/Atom"><title>Matt Makai</title><link href="http://www.fullstackpython.com/" rel="alternate"></link><link href="http://www.fullstackpython.com/feeds/all.atom.xml" rel="self"></link><id>http://www.fullstackpython.com/</id><updated>2014-03-19T07:16:32Z</updated></feed>
2+
<feed xmlns="http://www.w3.org/2005/Atom"><title>Matt Makai</title><link href="http://www.fullstackpython.com/" rel="alternate"></link><link href="http://www.fullstackpython.com/feeds/all.atom.xml" rel="self"></link><id>http://www.fullstackpython.com/</id><updated>2014-03-20T09:27:56Z</updated></feed>

source/content/pages/09-application-dependencies/0901-application-dependencies.markdown

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,77 @@ sort-order: 09
55

66

77
# Application Dependencies
8-
Application dependencies are the Python libraries and their versions
9-
required for an application to work properly. These dependencies are
10-
installed separately from system-level packages to prevent library version
11-
conflicts.
8+
Application dependencies are the libraries other than your project code
9+
that are required to create and run your application.
1210

13-
The most common way to install Python library dependencies is with
14-
the [pip](http://www.pip-installer.org/en/latest/)
15-
command combined with
16-
[virtualenv](http://www.virtualenv.org/en/latest/) to isolate the
17-
dependencies of individual applications from each other.
11+
12+
## Why are application dependencies important?
13+
Python web applications are built upon the work done by thousands of open
14+
source programmers. Application dependencies include not only web frameworks but
15+
also libraries for scraping, parsing, processing, analyzing, visualizing,
16+
and myriad other tasks. Python's ecosystem facilitates discovery, retrieval and
17+
installation so applications are easier for developers to create.
18+
19+
## Finding libraries
20+
Python libraries are stored in a central location known as the
21+
[Python Package Index](https://pypi.python.org/pypi) (PyPi). PyPi contains
22+
search functionality with results weighted by usage and relevance based on
23+
keyword terms.
24+
25+
26+
## Isolating application dependencies
27+
Dependencies are installed separately from system-level packages to prevent
28+
library version conflicts. The most common isolation method is
29+
[virtualenv](http://www.virtualenv.org/en/latest/). Each virtualenv is its
30+
own copy of the Python interpreter and depedencies in the site-packages
31+
directory. To use a virtualenv it must first be created with the virtualenv
32+
command and then activated.
33+
34+
35+
## Downloading and installing Python dependencies
36+
The recommended way to install Python library dependencies is with the
37+
[pip](http://www.pip-installer.org/en/latest/) command when a virtualenv
38+
is activated.
1839

1940
Pip and virtualenv work together and have complementary responsibilities.
2041
Pip downloads and installs application dependencies from the central
21-
[PyPi](https://pypi.python.org/pypi) repository. Virtualenv creates an
22-
isolated Python installation is where those dependencies are installed into.
42+
[PyPi](https://pypi.python.org/pypi) repository.
2343

2444

2545
## requirements.txt
2646
The pip convention for specifying application dependencies is with a
2747
[requirements.txt](http://www.pip-installer.org/en/1.4.1/cookbook.html#requirements-files)
2848
file. When you build a Python web application you should include a
29-
requirements.txt file with
30-
[pegged dependencies](https://devcenter.heroku.com/articles/python-pip).
49+
requirements.txt file.
50+
51+
52+
### requirementst.txt example with pegged dependencies
53+
Python projects' dependencies for a web application should be specified in the
54+
requirements.txt with
55+
[pegged dependencies](https://devcenter.heroku.com/articles/python-pip) like
56+
the following:
57+
58+
django==1.6
59+
bpython==0.12
60+
django-braces==0.2.1
61+
django-model-utils==1.1.0
62+
logutils==0.3.3
63+
South==0.7.6
64+
requests==1.2.0
65+
stripe==1.9.1
66+
dj-database-url==0.2.1
67+
django-oauth2-provider==0.2.4
68+
djangorestframework==2.3.1
69+
70+
Pegged dependencies with precise version numbers or Git tags are important
71+
because otherwise the latest version of a dependency will be used. While
72+
it may sound good to stay up to date, there's no telling if your application
73+
actually works with the latest versions of all dependencies. Developers should
74+
deliberately upgrade and test to make sure there were no backwards-incompatible
75+
modifications in newer dependency library versions.
3176

3277

33-
## setup.py
78+
##setup.py
3479
There is another type of dependency specification for Python libraries
3580
known as
3681
[setup.py](http://stackoverflow.com/questions/1471994/what-is-setup-py).

0 commit comments

Comments
 (0)