diff --git a/PKG-INFO b/PKG-INFO
index 849ef42ab9d4871e6b8807c9f75df4e8031a764d..027e2e19ff8cdb9c1e90878a33ca7b65d53aa0d6 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: swh.model
-Version: 6.6.2
+Version: 6.6.3
 Summary: Software Heritage data model
 Home-page: https://forge.softwareheritage.org/diffusion/DMOD/
 Author: Software Heritage developers
diff --git a/swh.model.egg-info/PKG-INFO b/swh.model.egg-info/PKG-INFO
index 849ef42ab9d4871e6b8807c9f75df4e8031a764d..027e2e19ff8cdb9c1e90878a33ca7b65d53aa0d6 100644
--- a/swh.model.egg-info/PKG-INFO
+++ b/swh.model.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: swh.model
-Version: 6.6.2
+Version: 6.6.3
 Summary: Software Heritage data model
 Home-page: https://forge.softwareheritage.org/diffusion/DMOD/
 Author: Software Heritage developers
diff --git a/swh.model.egg-info/requires.txt b/swh.model.egg-info/requires.txt
index abf94757194a7b804044ecfa8ae1c8e683477fbf..6ec0311454b071aeac7779f958b8ea90ae85a9ce 100644
--- a/swh.model.egg-info/requires.txt
+++ b/swh.model.egg-info/requires.txt
@@ -18,6 +18,7 @@ pytz
 types-python-dateutil
 types-pytz
 swh.core>=0.3
+Click
 dulwich
 
 [testing-minimal]
diff --git a/swh/model/cli.py b/swh/model/cli.py
index 622066199f3144bed63044a3a37ef8d93eb38155..abcabfe17ae2215ace4e8604fed3d19f8cab5785 100644
--- a/swh/model/cli.py
+++ b/swh/model/cli.py
@@ -69,7 +69,9 @@ def swhid_of_file_content(data) -> CoreSWHID:
     return object.swhid()
 
 
-def model_of_dir(path: bytes, exclude_patterns: Iterable[bytes] = None) -> Directory:
+def model_of_dir(
+    path: bytes, exclude_patterns: Optional[Iterable[bytes]] = None
+) -> Directory:
     from swh.model.from_disk import accept_all_directories, ignore_directories_patterns
 
     dir_filter = (
@@ -81,7 +83,9 @@ def model_of_dir(path: bytes, exclude_patterns: Iterable[bytes] = None) -> Direc
     return Directory.from_disk(path=path, dir_filter=dir_filter)
 
 
-def swhid_of_dir(path: bytes, exclude_patterns: Iterable[bytes] = None) -> CoreSWHID:
+def swhid_of_dir(
+    path: bytes, exclude_patterns: Optional[Iterable[bytes]] = None
+) -> CoreSWHID:
     obj = model_of_dir(path, exclude_patterns)
     return obj.swhid()
 
diff --git a/swh/model/model.py b/swh/model/model.py
index 29c7d6e25d017300d207b654104380ff97e6a711..3572284d6fb328520ae82c5ca86352abd4a0e94b 100644
--- a/swh/model/model.py
+++ b/swh/model/model.py
@@ -59,10 +59,6 @@ Sha1Git = bytes
 Sha1 = bytes
 
 
-KT = TypeVar("KT")
-VT = TypeVar("VT")
-
-
 def hash_repr(h: bytes) -> str:
     if h is None:
         return "None"
@@ -71,8 +67,8 @@ def hash_repr(h: bytes) -> str:
 
 
 def freeze_optional_dict(
-    d: Union[None, Dict[KT, VT], ImmutableDict[KT, VT]]  # type: ignore
-) -> Optional[ImmutableDict[KT, VT]]:
+    d: Union[None, Dict, ImmutableDict]
+) -> Optional[ImmutableDict]:
     if isinstance(d, dict):
         return ImmutableDict(d)
     else:
diff --git a/tox.ini b/tox.ini
index 38261f49afac52c64a361662b2bdb4f40bd91ba4..e042fedd23469697bcd76417ffd0c2e9f326137f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,4 +1,6 @@
 [tox]
+requires =
+  tox>4
 envlist=black,flake8,mypy,py3-{minimal,full}
 
 [testenv]
@@ -18,8 +20,8 @@ commands =
 skip_install = true
 deps = tox
 commands =
-  tox -e py3-full -- {posargs}
-  tox -e py3-minimal -- {posargs}
+  tox run -e py3-full -- {posargs}
+  tox run -e py3-minimal -- {posargs}
 
 [testenv:black]
 skip_install = true
@@ -41,7 +43,7 @@ commands =
 extras =
   testing
 deps =
-  mypy==0.942
+  mypy==1.0
 commands =
   mypy swh
 
@@ -49,14 +51,13 @@ commands =
 # git HEAD of swh-docs, is executed on CI for each diff to prevent
 # breaking doc build
 [testenv:sphinx]
-whitelist_externals = make
+allowlist_externals = make
 usedevelop = true
 extras =
   testing
 deps =
   # fetch and install swh-docs in develop mode
-  -e git+https://forge.softwareheritage.org/source/swh-docs#egg=swh.docs
-
+  -e git+https://gitlab.softwareheritage.org/swh/devel/swh-docs.git\#egg=swh.docs
 setenv =
   SWH_PACKAGE_DOC_TOX_BUILD = 1
   # turn warnings into errors
@@ -64,18 +65,16 @@ setenv =
 commands =
   make -I ../.tox/sphinx/src/swh-docs/swh/ -C docs
 
-
 # build documentation only inside swh-environment using local state
 # of swh-docs package
 [testenv:sphinx-dev]
-whitelist_externals = make
+allowlist_externals = make
 usedevelop = true
 extras =
   testing
 deps =
   # install swh-docs in develop mode
   -e ../swh-docs
-
 setenv =
   SWH_PACKAGE_DOC_TOX_BUILD = 1
   # turn warnings into errors