From 4b8ac12a087dd63f8288429e225d112b5e27cf1c Mon Sep 17 00:00:00 2001
From: vlorentz <vlorentz@softwareheritage.org>
Date: Thu, 28 Mar 2024 12:37:23 +0000
Subject: [PATCH] Apply copier template v0.2.0

---
 .copier-answers.yml     |  4 ++--
 .pre-commit-config.yaml | 10 ++++++++++
 pyproject.toml          |  3 ++-
 pytest.ini              |  3 +--
 tox.ini                 |  9 +++------
 5 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/.copier-answers.yml b/.copier-answers.yml
index a49f25b1..0b2e6185 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,11 +1,11 @@
 # Changes here will be overwritten by Copier
-_commit: v0.1.6
+_commit: v0.2.0
 _src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git
 description: Software Heritage core and package loaders
 distribution_name: swh-loader-core
 have_cli: true
 have_workers: true
-package_root: swh/loader/core
+package_root: swh/loader
 project_name: swh.loader.core
 python_minimal_version: '3.7'
 readme_format: rst
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4db34900..9de2dca8 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -46,3 +46,13 @@ repos:
         pass_filenames: false
         language: system
         types: [python]
+      - id: twine-check
+        name: twine check
+        description: call twine check when pushing an annotated release tag
+        entry: bash -c "ref=$(git describe) &&
+          [[ $ref =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] &&
+          (python3 -m build --sdist && twine check $(ls -t dist/* | head -1)) || true"
+        pass_filenames: false
+        stages: [pre-push]
+        language: python
+        additional_dependencies: [twine, build]
diff --git a/pyproject.toml b/pyproject.toml
index df698171..f399895f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,8 +1,9 @@
 [project]
 name = "swh.loader.core"
 authors = [
-	{name="Software Heritage developers", email="swh-devel@inria.fr"},
+    {name="Software Heritage developers", email="swh-devel@inria.fr"},
 ]
+
 description = "Software Heritage core and package loaders"
 readme = {file = "README.rst", content-type = "text/x-rst"}
 requires-python = ">=3.7"
diff --git a/pytest.ini b/pytest.ini
index eb1fb059..d7a497ca 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,8 +1,7 @@
 [pytest]
 norecursedirs = build docs .*
 asyncio_mode = strict
-addopts = "--import-mode=importlib"
-
 markers =
     db: marks tests as using a db (deselect with '-m "not db"')
     fs: marks tests as using the filesystem (deselect with '-m "not fs"')
+consider_namespace_packages = true
diff --git a/tox.ini b/tox.ini
index 9de42c15..5c7e152e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,6 +7,7 @@ envlist =
   py3
 
 [testenv]
+usedevelop = true
 extras =
   testing
 deps =
@@ -17,14 +18,10 @@ deps =
   dev: pdbpp
 commands =
   pytest --doctest-modules \
-         --rootdir {envsitepackagesdir} \
-         --cov={envsitepackagesdir}/swh/loader \
+         --cov=swh/loader \
          --cov-branch \
-         {envsitepackagesdir}/swh/loader \
+         swh/loader \
          {posargs}
-# --rootdir (with --import-mode from pytest.ini) 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
-- 
GitLab