Skip to content

Commit 57a65d8

Browse files
authored
docs: clean up dev recipe (#862)
1 parent 40d6b49 commit 57a65d8

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

docs/cookbook.rst

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,24 @@ Enter the ``dev`` nox session:
3939

4040
.. code-block:: python
4141
42-
import os
43-
import pathlib
44-
4542
import nox
4643
44+
4745
# It's a good idea to keep your dev session out of the default list
4846
# so it's not run twice accidentally
49-
nox.options.sessions = [...] # Sessions other than 'dev'
50-
51-
# this VENV_DIR constant specifies the name of the dir that the `dev`
52-
# session will create, containing the virtualenv;
53-
# the `resolve()` makes it portable
54-
VENV_DIR = pathlib.Path('./.venv').resolve()
55-
56-
@nox.session
47+
@nox.session(default=False)
5748
def dev(session: nox.Session) -> None:
5849
"""
59-
Sets up a python development environment for the project.
60-
61-
This session will:
62-
- Create a python virtualenv for the session
63-
- Install the `virtualenv` cli tool into this environment
64-
- Use `virtualenv` to create a global project virtual environment
65-
- Invoke the python interpreter from the global project environment to install
66-
the project and all it's development dependencies.
50+
Set up a python development environment for the project at ".venv".
6751
"""
6852
6953
session.install("virtualenv")
70-
# the VENV_DIR constant is explained above
71-
session.run("virtualenv", os.fsdecode(VENV_DIR), silent=True)
7254
73-
python = os.fsdecode(VENV_DIR.joinpath("bin/python"))
55+
session.run("virtualenv", ".venv", silent=True)
7456
7557
# Use the venv's interpreter to install the project along with
7658
# all it's dev dependencies, this ensures it's installed in the right way
77-
session.run(python, "-m", "pip", "install", "-e", ".[dev]", external=True)
59+
session.run(".venv/bin/pip", "install", "-e", ".[dev]", external=True)
7860
7961
With this, a user can simply run ``nox -s dev`` and have their entire environment set up automatically!
8062

0 commit comments

Comments
 (0)