Skip to content

Commit 7a54a65

Browse files
committed
add pip-tools; update site-packages info
1 parent 6e200a1 commit 7a54a65

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

docs/dev/virtualenvs.rst

+27-18
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ where they were placed, so try to follow a convention across your projects.
311311
Other Notes
312312
-----------
313313

314-
Running ``python -m venv`` with the option ``--no-site-packages`` will not
315-
include the packages that are installed globally. This can be useful
316-
for keeping the package list clean in case it needs to be accessed later.
314+
Running ``python -m venv`` with the option ``--system-site-packages`` will include
315+
the packages that are installed globally. Usually you do not want to do this so
316+
the package list remains clean in case it needs to be accessed later.
317317

318318
In order to keep your environment consistent, it's a good idea to "freeze"
319319
the current state of the environment packages. To do this, run:
@@ -343,20 +343,7 @@ control by adding it to the ignore list (see :ref:`Version Control Ignores<versi
343343
Other Tools
344344
-----------
345345

346-
tox and nox
347-
~~~~~~~~~~~
348-
349-
`tox <https://tox.readthedocs.io/en/latest/>`_ and `nox <https://nox.thea.codes/en/stable/>`_ are widely used command-line tools that automate environment setup and task execution. They are used to run tests across multiple Python versions, among other things. They do this by reading a configuration file, either ``tox.ini`` for tox, or ``noxfile.py`` for nox.
350-
351-
For example, if you have unit tests that you want to run with Python 3.6, 3.7, and 3.8, you can use one of these tools to automate virtual environment creation and test execution with all three Python versions. You can also run specific tasks like running a lint check, or publishing a new version of your package.
352-
353-
The main difference between the two tools are ``tox`` uses a custom file format for configuration, while ``nox`` uses a standard Python file for configuration.
354-
355-
356-
pipx
357-
~~~~
358-
`pipx <https://github.com/pipxproject/pipx>`_ is a tool to install system-wide command line tools, each to their own individual environment. Unlike ``pip`` which installs all packages to the same environment, ``pipx`` isolates tools in their own virtual environment, and exposes the command-line tools to your shell. ``pipx`` is used for installing command-line tools, similar to ``brew`` or ``apt``, but for Python applications. It's not used to intall libraries.
359-
346+
There are many tools to complement usage of pip and virtual environments. Here are some useful ones we like.
360347

361348
direnv
362349
~~~~~~
@@ -369,4 +356,26 @@ Install it on Mac OS X using ``brew``:
369356
370357
$ brew install direnv
371358
372-
On Linux follow the instructions at `direnv.net <https://direnv.net>`_
359+
On Linux follow the instructions at `direnv.net <https://direnv.net>`_
360+
361+
pip-tools
362+
~~~~~~~~~
363+
`pip-tools <https://github.com/jazzband/pip-tools>`_ is a suite of two tools that complement pip and virtual environments. It has similar functionaly to pipenv, and in fact pipenv uses pip-tools in its implementation. However, compared to pipenv, pip-tools lets you have a little more control over how and when operations are performed.
364+
365+
It does two things:
366+
1.) Generate a complete dependency list (lockfile, or ``requirements.txt`` file) from abstract dependencies. It does this with a full dependency resolver, which pip does not currently have, and can optionally generate the lockfile with hashes.
367+
2.) Synchronize a virtual environment to exactly match a requirements lockfile.
368+
369+
pipx
370+
~~~~
371+
`pipx <https://github.com/pipxproject/pipx>`_ is a tool to install system-wide command line tools, each to their own individual environment. Unlike ``pip`` which installs all packages to the same environment, ``pipx`` isolates tools in their own virtual environment, and exposes the command-line tools to your shell. ``pipx`` is used for installing command-line tools, similar to ``brew`` or ``apt``, but for Python applications. It's not used to install libraries.
372+
373+
374+
tox and nox
375+
~~~~~~~~~~~
376+
377+
`tox <https://tox.readthedocs.io/en/latest/>`_ and `nox <https://nox.thea.codes/en/stable/>`_ are widely used command-line tools that automate environment setup and task execution. tox and nox are often used to run tests across multiple Python versions, among other things. They do this by reading a configuration file, either ``tox.ini`` for tox, or ``noxfile.py`` for nox.
378+
379+
For example, if you have unit tests that you want to run with Python 3.6, 3.7, and 3.8, you can use one of these tools. It will create three virtual environments, one for each Python version, then install necessary dependencies, and finally run tests in each environment. You can also run specific tasks like running a lint check, or publishing a new version of your package.
380+
381+
The main difference between the two tools are ``tox`` uses a custom file format for configuration, while ``nox`` uses a standard Python file for configuration.

0 commit comments

Comments
 (0)