|
| 1 | +.. _packaging-pysetup: |
| 2 | + |
| 3 | +================ |
| 4 | +Pysetup Tutorial |
| 5 | +================ |
| 6 | + |
| 7 | +Getting started |
| 8 | +--------------- |
| 9 | + |
| 10 | +Pysetup 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 | + |
| 17 | +Finding out what's installed |
| 18 | +---------------------------- |
| 19 | + |
| 20 | +Pysetup 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 | + |
| 32 | +Installing a distribution |
| 33 | +------------------------- |
| 34 | + |
| 35 | +Pysetup 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 | + |
| 43 | +Installing from PyPI and Simple Indexes:: |
| 44 | + |
| 45 | + $ pysetup install project |
| 46 | + $ pysetup install project==1.0 |
| 47 | + |
| 48 | +Installing from a distribution source archive:: |
| 49 | + |
| 50 | + $ pysetup install project-1.0.tar.gz |
| 51 | + |
| 52 | +Installing 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 | + |
| 60 | +Installing from HTTP:: |
| 61 | + |
| 62 | + $ pysetup install http://host/packages/project-1.0.tar.gz |
| 63 | + |
| 64 | + |
| 65 | +Retrieving metadata |
| 66 | +------------------- |
| 67 | + |
| 68 | +You can gather metadata from two sources, a project's source directory or an |
| 69 | +installed distribution. The `pysetup metadata` command can retrieve one or |
| 70 | +more metadata fields using the `-f` option and a metadata field as the |
| 71 | +argument. :: |
| 72 | + |
| 73 | + $ pysetup metadata virtualenv -f version -f name |
| 74 | + Version: |
| 75 | + 1.6 |
| 76 | + Name: |
| 77 | + virtualenv |
| 78 | + |
| 79 | + $ pysetup metadata virtualenv --all |
| 80 | + 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 | + |
| 99 | +Removing a distribution |
| 100 | +----------------------- |
| 101 | + |
| 102 | +You can remove one or more installed distributions using the `pysetup remove` |
| 103 | +command:: |
| 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 | + |
| 116 | +The optional '-y' argument auto confirms, skipping the conformation prompt:: |
| 117 | + |
| 118 | + $ pysetup remove virtualenv -y |
| 119 | + |
| 120 | + |
| 121 | +Getting help |
| 122 | +------------ |
| 123 | + |
| 124 | +All pysetup actions take the `-h` and `--help` options which prints the commands |
| 125 | +help 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 | + |
| 139 | +Getting 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 |
0 commit comments