diff --git a/.copier-answers.yml b/.copier-answers.yml
new file mode 100644
index 0000000000000000000000000000000000000000..6c5b45eea60f0c66dfc62ba6f4d7f9548ea8571b
--- /dev/null
+++ b/.copier-answers.yml
@@ -0,0 +1,11 @@
+# Changes here will be overwritten by Copier
+_commit: v0.1.5
+_src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git
+description: Software Heritage datastore scrubber
+distribution_name: swh-scrubber
+have_cli: true
+have_workers: false
+package_root: swh/scrubber
+project_name: swh.scrubber
+python_minimal_version: '3.7'
+readme_format: rst
diff --git a/.gitignore b/.gitignore
index cc95929693b78ba92ea85b4eabd6f3208a9a451d..035b13951e98580e45e6b453c2bb6fa9aef9a59f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,12 @@
 *.egg-info/
 *.pyc
-*.sw?
-*~
 .coverage
 .eggs/
+.hypothesis
 .mypy_cache
 .tox
 __pycache__
 build/
 dist/
-version.txt
-.mypy_cache/
-.vscode/
-/.hypothesis/
+docs/README.rst
+docs/README.md
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2831385a0ad3e44368b637252c8f184249b60c98..44882702188264afb4d255160c59b98cc4f25d85 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,50 +1,41 @@
 repos:
-- repo: https://github.com/pre-commit/pre-commit-hooks
-  rev: v4.3.0
-  hooks:
-  - id: trailing-whitespace
-  - id: check-json
-  - id: check-yaml
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.4.0
+    hooks:
+      - id: trailing-whitespace
+      - id: check-json
+      - id: check-yaml
 
-- repo: https://github.com/pycqa/flake8
-  rev: 5.0.4
-  hooks:
-  - id: flake8
-    additional_dependencies: [flake8-bugbear==22.9.23]
+  - repo: https://github.com/python/black
+    rev: 23.1.0
+    hooks:
+      - id: black
 
-- repo: https://github.com/codespell-project/codespell
-  rev: v2.2.2
-  hooks:
-  - id: codespell
-    args: [-L mor]
+  - repo: https://github.com/PyCQA/isort
+    rev: 5.12.0
+    hooks:
+      - id: isort
 
-- repo: local
-  hooks:
-  - id: mypy
-    name: mypy
-    entry: mypy
-    args: [swh]
-    pass_filenames: false
-    language: system
-    types: [python]
+  - repo: https://github.com/pycqa/flake8
+    rev: 6.0.0
+    hooks:
+      - id: flake8
+        additional_dependencies: [flake8-bugbear==22.9.23]
 
-# unfortunately, we are far from being able to enable this...
-# - repo: https://github.com/PyCQA/pydocstyle.git
-#   rev: 4.0.0
-#   hooks:
-#   - id: pydocstyle
-#     name: pydocstyle
-#     description: pydocstyle is a static analysis tool for checking compliance with Python docstring conventions.
-#     entry: pydocstyle --convention=google
-#     language: python
-#     types: [python]
+  - repo: https://github.com/codespell-project/codespell
+    rev: v2.2.2
+    hooks:
+      - id: codespell
+        name: Check source code spelling
+        stages: [commit]
 
-- repo: https://github.com/PyCQA/isort
-  rev: 5.11.5
-  hooks:
-  - id: isort
+  - repo: local
+    hooks:
+      - id: mypy
+        name: mypy
+        entry: mypy
+        args: [swh]
+        pass_filenames: false
+        language: system
+        types: [python]
 
-- repo: https://github.com/python/black
-  rev: 22.10.0
-  hooks:
-  - id: black
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 25320bc4859baa585477b3bb9b25570d38d585fd..0000000000000000000000000000000000000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,6 +0,0 @@
-include Makefile
-include requirements*.txt
-include version.txt
-include README.md
-recursive-include swh py.typed
-recursive-include swh/scrubber/sql *
diff --git a/docs/Makefile b/docs/Makefile
index c30c50ab01ec91da18f0718b7cfd052f046c2e44..85f23e85cc509781d834a056f103238fda40693e 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1 +1 @@
-include ../../swh-docs/Makefile.sphinx
+include swh-docs/Makefile.sphinx
diff --git a/mypy.ini b/mypy.ini
index 5fb4be64252ec6cdc92ce6130e7ba298f739c300..676925ac58e65a726e0e9bdc3bc77dd855f578b4 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -1,8 +1,9 @@
 [mypy]
 namespace_packages = True
 warn_unused_ignores = True
-install_types = True
-non_interactive = True
+explicit_package_bases = True
+# ^ Needed for mypy to detect py.typed from swh packages installed
+# in editable mode
 
 # 3rd party libraries without stubs (yet)
 
@@ -18,8 +19,5 @@ ignore_missing_imports = True
 [mypy-psycopg2.*]
 ignore_missing_imports = True
 
-[mypy-pytest.*]
-ignore_missing_imports = True
-
 # [mypy-add_your_lib_here.*]
 # ignore_missing_imports = True
diff --git a/pyproject.toml b/pyproject.toml
index 69b8f4dd830abf638e624eeea85dbc580c862538..887be95303a6d3c8362645c36c88c96238e08ee5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,47 @@
+[project]
+name = "swh.scrubber"
+authors = [
+    {name="Software Heritage developers", email="swh-devel@inria.fr"},
+]
+
+description = "Software Heritage datastore scrubber"
+readme = {file = "README.rst", content-type = "text/x-rst"}
+requires-python = ">=3.7"
+classifiers = [
+    "Programming Language :: Python :: 3",
+    "Intended Audience :: Developers",
+    "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+    "Operating System :: OS Independent",
+    "Development Status :: 3 - Alpha",
+]
+dynamic = ["version", "dependencies", "optional-dependencies"]
+
+[tool.setuptools.packages.find]
+include = ["swh.*"]
+
+[tool.setuptools.dynamic]
+dependencies = {file = ["requirements.txt", "requirements-swh.txt"]}
+
+[tool.setuptools.dynamic.optional-dependencies]
+testing = {file = ["requirements-test.txt"]}
+
+[project.entry-points."swh.cli.subcommands"]
+"swh.scrubber" = "swh.scrubber.cli"
+
+[project.urls]
+"Homepage" = "https://gitlab.softwareheritage.org/swh/devel/swh-scrubber"
+"Bug Reports" = "https://gitlab.softwareheritage.org/swh/devel/swh-scrubber/-/issues"
+"Funding" = "https://www.softwareheritage.org/donate"
+"Documentation" = "https://docs.softwareheritage.org/devel/swh-scrubber/"
+"Source" = "https://gitlab.softwareheritage.org/swh/devel/swh-scrubber.git"
+
+[build-system]
+requires = ["setuptools", "setuptools-scm"]
+build-backend = "setuptools.build_meta"
+
+[tool.setuptools_scm]
+fallback_version = "0.0.1"
+
 [tool.black]
 target-version = ['py37']
 
diff --git a/setup.py b/setup.py
deleted file mode 100755
index be63d80d9d948075d0b633fb8354e324c6b9fdb5..0000000000000000000000000000000000000000
--- a/setup.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (C) 2019-2021  The Software Heritage developers
-# See the AUTHORS file at the top-level directory of this distribution
-# License: GNU General Public License version 3, or any later version
-# See top-level LICENSE file for more information
-
-from io import open
-from os import path
-
-from setuptools import find_packages, setup
-
-here = path.abspath(path.dirname(__file__))
-
-# Get the long description from the README file
-with open(path.join(here, "README.rst"), encoding="utf-8") as f:
-    long_description = f.read()
-
-
-def parse_requirements(*names):
-    requirements = []
-    for name in names:
-        if name:
-            reqf = "requirements-%s.txt" % name
-        else:
-            reqf = "requirements.txt"
-
-        if not path.exists(reqf):
-            return requirements
-
-        with open(reqf) as f:
-            for line in f.readlines():
-                line = line.strip()
-                if not line or line.startswith("#"):
-                    continue
-                requirements.append(line)
-    return requirements
-
-
-setup(
-    name="swh.scrubber",  # example: swh.loader.pypi
-    description="Software Heritage Datastore Scrubber",
-    long_description=long_description,
-    long_description_content_type="text/x-rst",
-    python_requires=">=3.7",
-    author="Software Heritage developers",
-    author_email="swh-devel@inria.fr",
-    url="https://forge.softwareheritage.org/diffusion/swh-scrubber",
-    packages=find_packages(),  # packages's modules
-    install_requires=parse_requirements(None, "swh"),
-    tests_require=parse_requirements("test"),
-    setup_requires=["setuptools-scm"],
-    use_scm_version=True,
-    extras_require={"testing": parse_requirements("test")},
-    include_package_data=True,
-    entry_points="""
-        [swh.cli.subcommands]
-        scrubber=swh.scrubber.cli
-    """,
-    classifiers=[
-        "Programming Language :: Python :: 3",
-        "Intended Audience :: Developers",
-        "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
-        "Operating System :: OS Independent",
-        "Development Status :: 3 - Alpha",
-    ],
-    project_urls={
-        "Bug Reports": "https://forge.softwareheritage.org/maniphest",
-        "Funding": "https://www.softwareheritage.org/donate",
-        "Source": "https://forge.softwareheritage.org/source/swh-scrubber",
-        "Documentation": "https://docs.softwareheritage.org/devel/swh-scrubber/",
-    },
-)
diff --git a/swh/__init__.py b/swh/__init__.py
deleted file mode 100644
index b36383a61027f0875a3cb103edc8f2a4528a3289..0000000000000000000000000000000000000000
--- a/swh/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from pkgutil import extend_path
-
-__path__ = extend_path(__path__, __name__)
diff --git a/tox.ini b/tox.ini
index fc2bbbb71a0d6a1cce43e27d6e6408a17a62f2ec..8225659a565e9866d644d100f3147a63fe09e7cb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,10 @@
 [tox]
-minversion=4
-envlist=black,flake8,mypy,py3
+minversion = 4
+envlist =
+  black
+  flake8
+  mypy
+  py3
 
 [testenv]
 passenv =
@@ -12,9 +16,15 @@ deps =
   pytest-cov
 commands =
   pytest --doctest-modules \
-         {envsitepackagesdir}/swh/scrubber \
+         --import-mode importlib \
+         --rootdir {envsitepackagesdir} \
          --cov={envsitepackagesdir}/swh/scrubber \
-         --cov-branch {posargs}
+         --cov-branch \
+         {envsitepackagesdir}/swh/scrubber \
+         {posargs}
+# --rootdir and --import-mode are required to make tests that depends
+# on the test file to be a proper submodule of the swh namespace after
+# migration to PEP420 (implicit namespace).
 
 [testenv:black]
 skip_install = true
@@ -45,32 +55,14 @@ commands =
 # breaking doc build
 [testenv:sphinx]
 allowlist_externals = make
-usedevelop = true
-extras =
-  testing
-deps =
-  # fetch and install swh-docs in develop mode
-  -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
-  SPHINXOPTS = -W
-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]
-allowlist_externals = make
-usedevelop = true
 extras =
   testing
 deps =
-  # install swh-docs in develop mode
-  -e ../swh-docs
+  # fetch and install swh-docs
+  git+https://gitlab.softwareheritage.org/swh/devel/swh-docs.git\#egg=swh.docs
 setenv =
   SWH_PACKAGE_DOC_TOX_BUILD = 1
   # turn warnings into errors
   SPHINXOPTS = -W
 commands =
-  make -I ../.tox/sphinx-dev/src/swh-docs/swh/ -C docs
+  make -I {env_dir}/share/ -C docs