Skip to content

Commit dc767e1

Browse files
author
Kenneth Reitz
committed
packaging
1 parent cebc44c commit dc767e1

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

docs/contents.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ instructions for web development with Flask.
1212
installation
1313
useful-tools
1414
tutorial/index
15+
packaging
1516
templating
1617
testing
1718
errorhandling

docs/packaging.rst

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Packaging Your Code
2+
==========================
3+
4+
For PyPi
5+
::::::::
6+
7+
If you're writing an open source Python module, PyPi, more properly known as *The Cheeseshop*, is the place to host it.
8+
9+
Package Manager
10+
---------------
11+
12+
While Snow Leopard comes with a large number of UNIX utilities, those
13+
familiar with Linux systems will notice one key component missing: a
14+
package manager. Mxcl's *Homebrew* is the answer.
15+
16+
To install Homebrew, simply run: ::
17+
18+
$ ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
19+
20+
21+
It's basic commands are **update**, **install**, and **remove**.
22+
23+
.. man brew
24+
25+
26+
27+
Python Interpreter
28+
------------------
29+
30+
And we can now install Python 2.7: ::
31+
32+
$ brew install python --framework
33+
34+
35+
The ``--framework`` option tells Homebrew to compile a Framework-style Python build, rather than a UNIX-style build. The outdated version of Python that Snow Leopard comes packaged with
36+
is built as a Framework, so this helps avoid some future module installation
37+
bugs.
38+
39+
*Don't forget to update your environment PATH.*
40+
41+
42+
Distribute & Pip
43+
----------------
44+
45+
*Distribute* is a fantastic drop-in replacement for *easy_install* and
46+
*setuptools*. It allows you to install and manage python packages from
47+
pypi.python.org, amongst a few other sources. It also plays well with
48+
*virtualenv* and user-enviornments.
49+
50+
**easy_install** is considered by many to be a deprecated system, so we
51+
will install it's replacement: **pip**. Pip allows for uninstallation
52+
of packages, and is actively maintained, unlike setuptool's easy_install.
53+
54+
To install *pip* and Distribute's *easy_install*:
55+
56+
If you have homebrew: ::
57+
58+
$ brew install pip
59+
60+
...And, if you're a masochist: ::
61+
62+
$ curl -O http://python-distribute.org/distribute_setup.py
63+
$ python distribute_setup.py
64+
65+
$ easy_install pip
66+
67+
68+
69+
To install ``pip``: ::
70+
71+
Hopefully you'll never have to use **easy_install** again.
72+
73+
74+
Updating Python
75+
---------------
76+
77+
Homebrew makes it simple. ::
78+
79+
$ brew update
80+
$ brew install --force python
81+
82+
83+
Windows
84+
:::::::
85+
86+
87+
88+
Prerequisites:
89+
--------------
90+
91+
* Python2.7 (x86) from Python.org
92+
* Microsoft Visual Studio
93+
94+
95+
Step 1: Install Distribute & Pip
96+
--------------------------------
97+
98+
**Distribute** is a fantastic drop-in replacement for **easy_install** and **setuptools**. It allows you to install and manage python packages from PyPi, amongst a few other sources.
99+
100+
To install it, run the python script available here:
101+
<http://python-distribute.org/distribute_setup.py>
102+
103+
Make sure that ```C:\Python27\```, and ```C:\Python27\Scripts``` are in your PATH.
104+
105+
**easy_install** is considered by many to be a deprecated system, so we will install it's replacement: **pip**. Pip allows for uninstallation of packages, and is actively maintained, unlike setuptool's easy_install.
106+
107+
To install pip, simply run: ::
108+
109+
$ easy_install pip
110+
111+
112+
Linux (Ubuntu)
113+
::::::::::::::
114+
115+
116+
117+
Linux (Manual)
118+
::::::::::::::
119+
120+
121+

0 commit comments

Comments
 (0)