blob: 08ba08ed2e5be56f6702e53d8b333da4b391279e [file] [log] [blame]
Éric Araujo3a9f58f2011-06-01 20:42:49 +02001.. _packaging-pysetup:
2
3================
4Pysetup Tutorial
5================
6
7Getting started
8---------------
9
10Pysetup is a simple script that supports the following features:
11
12- install, remove, list, and verify Python packages;
13- search for available packages on PyPI or any *Simple Index*;
14- verify installed packages (md5sum, installed files, version).
15
16
17Finding out what's installed
18----------------------------
19
20Pysetup makes it easy to find out what Python packages are installed::
21
22 $ pysetup search virtualenv
23 virtualenv 1.6 at /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info
24
25 $ pysetup search --all
26 pyverify 0.8.1 at /opt/python3.3/lib/python3.3/site-packages/pyverify-0.8.1.dist-info
27 virtualenv 1.6 at /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info
28 wsgiref 0.1.2 at /opt/python3.3/lib/python3.3/wsgiref.egg-info
29 ...
30
31
32Installing a distribution
33-------------------------
34
35Pysetup can install a Python project from the following sources:
36
37- PyPI and Simple Indexes;
38- source directories containing a valid :file:`setup.py` or :file:`setup.cfg`;
39- distribution source archives (:file:`project-1.0.tar.gz`, :file:`project-1.0.zip`);
40- HTTP (http://host/packages/project-1.0.tar.gz).
41
42
43Installing from PyPI and Simple Indexes::
44
45 $ pysetup install project
46 $ pysetup install project==1.0
47
48Installing from a distribution source archive::
49
50 $ pysetup install project-1.0.tar.gz
51
52Installing from a source directory containing a valid :file:`setup.py` or
53:file:`setup.cfg`::
54
55 $ cd path/to/source/directory
56 $ pysetup install
57
58 $ pysetup install path/to/source/directory
59
60Installing from HTTP::
61
62 $ pysetup install http://host/packages/project-1.0.tar.gz
63
64
65Retrieving metadata
66-------------------
67
68You can gather metadata from two sources, a project's source directory or an
69installed distribution. The `pysetup metadata` command can retrieve one or
70more metadata fields using the `-f` option and a metadata field as the
71argument. ::
72
73 $ pysetup metadata virtualenv -f version -f name
74 Version:
75 1.6
76 Name:
77 virtualenv
78
Éric Araujofb639292011-08-29 22:03:46 +020079 $ pysetup metadata virtualenv
Éric Araujo3a9f58f2011-06-01 20:42:49 +020080 Metadata-Version:
81 1.0
82 Name:
83 virtualenv
84 Version:
85 1.6
86 Platform:
87 UNKNOWN
88 Summary:
89 Virtual Python Environment builder
90 ...
91
92.. seealso::
93
94 There are three metadata versions, 1.0, 1.1, and 1.2. The following PEPs
95 describe specifics of the field names, and their semantics and usage. 1.0
96 :PEP:`241`, 1.1 :PEP:`314`, and 1.2 :PEP:`345`
97
98
99Removing a distribution
100-----------------------
101
102You can remove one or more installed distributions using the `pysetup remove`
103command::
104
105 $ pysetup remove virtualenv
106 removing 'virtualenv':
107 /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info/dependency_links.txt
108 /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info/entry_points.txt
109 /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info/not-zip-safe
110 /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info/PKG-INFO
111 /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info/SOURCES.txt
112 /opt/python3.3/lib/python3.3/site-packages/virtualenv-1.6-py3.3.egg-info/top_level.txt
113 Proceed (y/n)? y
114 success: removed 6 files and 1 dirs
115
116The optional '-y' argument auto confirms, skipping the conformation prompt::
117
118 $ pysetup remove virtualenv -y
119
120
121Getting help
122------------
123
124All pysetup actions take the `-h` and `--help` options which prints the commands
125help string to stdout. ::
126
127 $ pysetup remove -h
128 Usage: pysetup remove dist [-y]
129 or: pysetup remove --help
130
131 Uninstall a Python package.
132
133 positional arguments:
134 dist installed distribution name
135
136 optional arguments:
137 -y auto confirm package removal
138
139Getting a list of all pysetup actions and global options::
140
141 $ pysetup --help
142 Usage: pysetup [options] action [action_options]
143
144 Actions:
145 run: Run one or several commands
146 metadata: Display the metadata of a project
147 install: Install a project
148 remove: Remove a project
149 search: Search for a project
150 graph: Display a graph
151 create: Create a Project
152
153 To get more help on an action, use:
154
155 pysetup action --help
156
157 Global options:
158 --verbose (-v) run verbosely (default)
159 --quiet (-q) run quietly (turns verbosity off)
160 --dry-run (-n) don't actually do anything
161 --help (-h) show detailed help message
162 --no-user-cfg ignore pydistutils.cfg in your home directory
163 --version Display the version