Skip to content

Commit d2cd54a

Browse files
committed
fix(venv): add prompt for virtual env directory name, default .venv
1 parent 1815969 commit d2cd54a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

incipyt/tools/venv.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import os
22

3-
from incipyt import commands, signals, tools
3+
from incipyt import commands, project, signals, tools
44

55

66
class Venv(tools.Tool):
77
"""Scripts to add virtualenv to :class:`incipyt.project._Structure`."""
88

99
def add_to_structure(self):
1010
"""Add venv configuration to `project.structure`, do nothing."""
11-
signals.vcs_ignore.emit(pattern=".env/")
11+
signals.vcs_ignore.emit(pattern="{VIRTUAL_ENV_DIRECTORY}/")
1212

1313
def pre(self, workon):
1414
"""Run `python -m venv .env`.
1515
1616
:param workon: Work-on folder.
1717
:type workon: :class:`pathlib.Path`
1818
"""
19-
env_path = workon / ".env"
19+
project.environ.setdefault("VIRTUAL_ENV_DIRECTORY", ".venv")
20+
env_path = workon / project.environ["VIRTUAL_ENV_DIRECTORY"]
2021
commands.venv([os.fspath(env_path)])
2122
commands.setenv_python_cmd(
2223
env_path.resolve() / ("Scripts" if os.name == "nt" else "bin") / "python"

0 commit comments

Comments
 (0)