diff --git a/docs/changelog/1568.feature.rst b/docs/changelog/1568.feature.rst new file mode 100644 index 000000000..507a4abd5 --- /dev/null +++ b/docs/changelog/1568.feature.rst @@ -0,0 +1 @@ +Passing in the virtual environment name/path is now required (no longer defaults to ``venv``) - by :user:`gaborbernat`. diff --git a/docs/cli_interface.rst b/docs/cli_interface.rst index f3cca8062..b4d190e9a 100644 --- a/docs/cli_interface.rst +++ b/docs/cli_interface.rst @@ -10,8 +10,8 @@ CLI flags It modifies the environment variables in a shell to create an isolated Python environment, so you'll need to have a shell to run it. You can type in ``virtualenv`` (name of the application) followed by flags that control its -behaviour. All options have sensible defaults, so you'll get a working virtual environment in a ``venv`` folder even -if you don't pass any options. The default values for the command line options can be overridden via the +behaviour. All options have sensible defaults, and there's one required argument: then name/path of the virtual +environment to create. The default values for the command line options can be overridden via the :ref:`conf_file` or :ref:`env_vars`. Environment variables takes priority over the configuration file values (``--help`` will show if a default comes from the environment variable as the help message will end in this case with environment variables or the configuration file). diff --git a/src/virtualenv/create/creator.py b/src/virtualenv/create/creator.py index bcf65ec19..cf46804e6 100644 --- a/src/virtualenv/create/creator.py +++ b/src/virtualenv/create/creator.py @@ -73,7 +73,7 @@ def add_parser_arguments(cls, parser, interpreter, meta): :param meta: value as returned by :meth:`can_create` """ parser.add_argument( - "dest", help="directory to create virtualenv at", type=cls.validate_dest, default="venv", nargs="?", + "dest", help="directory to create virtualenv at", type=cls.validate_dest, ) parser.add_argument( "--clear", diff --git a/tests/unit/config/test_env_var.py b/tests/unit/config/test_env_var.py index c2b1b6167..e23b9fb49 100644 --- a/tests/unit/config/test_env_var.py +++ b/tests/unit/config/test_env_var.py @@ -19,13 +19,13 @@ def empty_conf(tmp_path, monkeypatch): def test_value_ok(monkeypatch, empty_conf): monkeypatch.setenv(str("VIRTUALENV_VERBOSE"), str("5")) - result = parse_cli([]) + result = parse_cli(["venv"]) assert result.verbosity == 5 def test_value_bad(monkeypatch, caplog, empty_conf): monkeypatch.setenv(str("VIRTUALENV_VERBOSE"), str("a")) - result = parse_cli([]) + result = parse_cli(["venv"]) assert result.verbosity == 2 assert len(caplog.messages) == 1 assert "env var VIRTUALENV_VERBOSE failed to convert" in caplog.messages[0]