@@ -100,3 +100,52 @@ To change the project's formatting, linting and test dependencies:
100100 ```
101101
1021023 . Commit everything to git and send a pull request
103+
104+ Testing Manually
105+ ----------------
106+
107+ Normally if you wanted to test a command manually in dev you'd do so through
108+ tox, for example:
109+
110+ ``` terminal
111+ $ tox -qe dev --run-command 'pip-sync-faster --help'
112+ usage: pip-sync-faster [-h] [-v]
113+
114+ options:
115+ -h, --help show this help message and exit
116+ -v, --version
117+ ```
118+
119+ But there's a problem with running ` pip-sync-faster ` commands in this way: a
120+ command like ` tox -e dev --run-command 'pip-sync-faster requirements.txt' ` will
121+ run ` pip-sync requirements.txt ` as a subprocess and ` pip-sync ` will sync the
122+ current virtualenv (` .tox/dev/ ` ) with the ` requirements.txt ` file. Everything
123+ in ` requirements.txt ` will get installed into ` .tox/dev/ ` , which you probably
124+ don't want. Even worse everything _ not_ in ` requirements.txt ` will get
125+ _ removed_ from ` .tox/dev/ ` including ` pip-sync-faster ` itself!
126+
127+ To avoid this problem run ` pip-sync-faster ` in a temporary virtualenv instead.
128+ This installs the contents of ` requirements.txt ` into the temporary venv so
129+ your ` .tox/dev/ ` env doesn't get messed up. And it does not install
130+ ` pip-sync-faster ` into the temporary venv so there's no issue with ` pip-sync `
131+ uninstalling ` pip-sync-faster ` :
132+
133+ ``` terminal
134+ # Make a temporary directory.
135+ tempdir=$(mktemp -d)
136+
137+ # Create a virtualenv in the temporary directory.
138+ python3 -m venv $tempdir
139+
140+ # Activate the virtualenv.
141+ source $tempdir/bin/activate
142+
143+ # Install pip-tools in the virtualenv (pip-sync-faster needs pip-tools).
144+ pip install pip-tools
145+
146+ # Call pip-sync-faster to install a requirements file into the temporary virtualenv.
147+ PYTHONPATH=src python3 -m pip_sync_faster /path/to/requirements.txt
148+
149+ # When you're done testing deactivate the temporary virtualenv.
150+ deactivate
151+ ```
0 commit comments