Repository: tox-dev/tox

Issue:
tox4: Use .tox instead of .tox/4 as work directory
:+1: 

Discussion:

Patch:
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 25782875..46e0ae42 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -53,20 +53,20 @@ jobs:
                 file_handler.write('TOXENV=' + ("py" if impl == "CPython" else "pypy") + ("{}{}".format(major, minor) if impl == "CPython" else "3") + "\n")
         shell: python
       - name: Setup test suite
-        run: tox4 r -vv --notest
+        run: tox r -vv --notest
       - name: Run test suite
-        run: tox4 r --skip-pkg-install
+        run: tox r --skip-pkg-install
         env:
           PYTEST_ADDOPTS: "-vv --durations=20"
           CI_RUN: "yes"
           DIFF_AGAINST: HEAD
       - name: Rename coverage report file
         run: |
-          import os; os.rename('.tox/4/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/4/coverage.xml')
+          import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
         shell: python
       - uses: codecov/codecov-action@v1
         with:
-          file: ./.tox/4/coverage.xml
+          file: ./.tox/coverage.xml
           flags: tests
           name: ${{ matrix.py }} - ${{ matrix.os }}
 
@@ -97,7 +97,7 @@ jobs:
       - name: Install self-tox
         run: python -m pip install .
       - name: Run check for ${{ matrix.tox_env }}
-        run: tox4 r -e ${{ matrix.tox_env }}
+        run: tox r -e ${{ matrix.tox_env }}
         env:
           UPGRADE_ADVISORY: "yes"
 
diff --git a/.gitignore b/.gitignore
index c9914176..00fa1d9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,6 @@ build
 dist
 *.egg-info
 .tox
-.tox4
 /.*_cache
 .dmypy.json
 /docs/_draft.rst
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 32abb1ec..da7cd05f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -29,15 +29,15 @@ repos:
     hooks:
       - id: isort
   - repo: https://github.com/psf/black
-    rev: 21.12b0
+    rev: 22.1.0
     hooks:
       - id: black
         args: [--safe]
   - repo: https://github.com/asottile/blacken-docs
-    rev: v1.12.0
+    rev: v1.12.1
     hooks:
       - id: blacken-docs
-        additional_dependencies: [black==21.12b0]
+        additional_dependencies: [black==22.1.0]
   - repo: https://github.com/pre-commit/pygrep-hooks
     rev: v1.9.0
     hooks:
@@ -73,7 +73,7 @@ repos:
           - "@prettier/plugin-xml@1.2.0"
         args: ["--print-width=120", "--prose-wrap=always"]
   - repo: https://github.com/igorshubovych/markdownlint-cli
-    rev: v0.30.0
+    rev: v0.31.0
     hooks:
       - id: markdownlint
   - repo: local
diff --git a/docs/changelog/2344.feature.rst b/docs/changelog/2344.feature.rst
new file mode 100644
index 00000000..8235d1fc
--- /dev/null
+++ b/docs/changelog/2344.feature.rst
@@ -0,0 +1,1 @@
+Use ``tox`` console entry point name instead of ``tox4`` - by :user:`gaborbernat`.
diff --git a/docs/changelog/2346.feature.rst b/docs/changelog/2346.feature.rst
new file mode 100644
index 00000000..8b2c6c42
--- /dev/null
+++ b/docs/changelog/2346.feature.rst
@@ -0,0 +1,1 @@
+Use ``.tox`` as working directory instead of ``.tox/4`` - by :user:`gaborbernat`.
diff --git a/setup.cfg b/setup.cfg
index e6a4ecb2..1ffc4788 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -56,7 +56,7 @@ where = src
 
 [options.entry_points]
 console_scripts =
-    tox4 = tox.run:run
+    tox = tox.run:run
 
 [options.extras_require]
 docs =
diff --git a/src/tox/config/sets.py b/src/tox/config/sets.py
index 9d09882e..a7905b04 100644
--- a/src/tox/config/sets.py
+++ b/src/tox/config/sets.py
@@ -188,8 +188,7 @@ class CoreConfigSet(ConfigSet):
         )
 
         def work_dir_builder(conf: Config, env_name: str | None) -> Path:  # noqa: U100
-            # here we pin to .tox/4 to be able to use in parallel with v3 until final release
-            return (conf.work_dir if conf.work_dir is not None else cast(Path, self["tox_root"])) / ".tox" / "4"
+            return (conf.work_dir if conf.work_dir is not None else cast(Path, self["tox_root"])) / ".tox"
 
         self.add_config(
             keys=["work_dir", "toxworkdir"],


Test patch:
diff --git a/tests/session/cmd/test_sequential.py b/tests/session/cmd/test_sequential.py
index 958da14a..828abb96 100644
--- a/tests/session/cmd/test_sequential.py
+++ b/tests/session/cmd/test_sequential.py
@@ -432,7 +432,7 @@ def test_sequential_inserted_env_vars(tox_project: ToxProjectCreator, demo_pkg_i
 
     assert re.search(f"TOX_PACKAGE={re.escape(str(project.path))}.*.tar.gz{os.linesep}", result.out)
     assert f"TOX_ENV_NAME=py{os.linesep}" in result.out
-    work_dir = project.path / ".tox" / "4"
+    work_dir = project.path / ".tox"
     assert f"TOX_WORK_DIR={work_dir}{os.linesep}" in result.out
     env_dir = work_dir / "py"
     assert f"TOX_ENV_DIR={env_dir}{os.linesep}" in result.out
diff --git a/tests/test_call_modes.py b/tests/test_call_modes.py
index 026fdd1e..7f7cce08 100644
--- a/tests/test_call_modes.py
+++ b/tests/test_call_modes.py
@@ -12,4 +12,4 @@ def test_call_as_module(empty_project: ToxProject) -> None:  # noqa: U100
 
 
 def test_call_as_exe(empty_project: ToxProject) -> None:  # noqa: U100
-    subprocess.check_output([str(Path(sys.executable).parent / "tox4"), "-h"])
+    subprocess.check_output([str(Path(sys.executable).parent / "tox"), "-h"])
diff --git a/tests/tox_env/test_tox_env_api.py b/tests/tox_env/test_tox_env_api.py
index 3cdb9272..c5542dbc 100644
--- a/tests/tox_env/test_tox_env_api.py
+++ b/tests/tox_env/test_tox_env_api.py
@@ -27,7 +27,7 @@ def test_allow_list_external_fail(tox_project: ToxProjectCreator, fake_exe_on_pa
     result = prj.run("r")
 
     result.assert_failed(1)
-    out = fr".*py: failed with {fake_exe_on_path.stem} is not allowed, use allowlist_externals to allow it.*"
+    out = rf".*py: failed with {fake_exe_on_path.stem} is not allowed, use allowlist_externals to allow it.*"
     result.assert_out_err(out=out, err="", regex=True)
     execute_calls.assert_called()
 
@@ -38,7 +38,7 @@ def test_env_log(tox_project: ToxProjectCreator) -> None:
     result_first = prj.run("r")
     result_first.assert_success()
 
-    log_dir = prj.path / ".tox" / "4" / "py" / "log"
+    log_dir = prj.path / ".tox" / "py" / "log"
     assert log_dir.exists(), result_first.out
 
     filename = {i.name for i in log_dir.iterdir()}