Repository: exasol/integration-test-docker-environment (language: python)

Issue:
Add file py.typed to enable mypy to find project specific types
Create empty file `py.typed` in directory `exasol_integration_test_docker_environment` to enable mypy to find project specific types, see https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/



Discussion / hints:

Fix patch:
diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md
index ec5251007..9c207e7c8 100644
--- a/doc/changes/changelog.md
+++ b/doc/changes/changelog.md
@@ -1,5 +1,6 @@
 # Changes
 
+* [3.3.0](changes_3.3.0.md)
 * [3.2.0](changes_3.2.0.md)
 * [3.1.0](changes_3.1.0.md)
 * [3.0.0](changes_3.0.0.md)
@@ -34,6 +35,7 @@
 hidden:
 ---
 changes_3.2.0
+changes_3.3.0
 changes_3.1.0
 changes_3.0.0
 changes_2.1.0
diff --git a/doc/changes/changes_3.3.0.md b/doc/changes/changes_3.3.0.md
new file mode 100644
index 000000000..8f1aad633
--- /dev/null
+++ b/doc/changes/changes_3.3.0.md
@@ -0,0 +1,10 @@
+# Integration-Test-Docker-Environment 3.3.0, released 2024-??-??
+
+Code name:
+
+## Summary
+
+## Refactorings
+
+* #119: Refactored `pkg_resources` usage to `importlib.resources`
+* #420: Added file `py.typed` to enable mypy to find project specific types
diff --git a/pyproject.toml b/pyproject.toml
index 8e2794ede..f0a331c4a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -3,7 +3,7 @@ name = "exasol-integration-test-docker-environment"
 packages = [
     { include = "exasol_integration_test_docker_environment" },
 ]
-version = "3.2.0"
+version = "3.3.0"
 description = "Integration Test Docker Environment for Exasol"
 
 license = "MIT"
@@ -44,7 +44,7 @@ fabric = "^3.0.1"
 portalocker = "^2.7.0"
 exasol-error-reporting = "^0.4.0"
 # The current combination of dependencies for ITDE and Luigi is not compatible with projects that run on Python 3.8.
-# The latest version of docutils, version 0.21.1, is required to run on Python 3.9 or higher. 
+# The latest version of docutils, version 0.21.1, is required to run on Python 3.9 or higher.
 # As a temporary fix, until support for Python 3.8 is dropped (which is estimated to be around 6 months),
 # we are explicitly requiring a version of docutils that is less than or equal to 0.20.1 in ITDE.
 # Once support for Python 3.8 is dropped, this dependency can be removed as it is only needed as a transitive dependency.


Test patch:
diff --git a/.github/workflows/test_db_versions_all_tests.yml b/.github/workflows/test_db_versions_all_tests.yml
index e8fc600a2..34d6b06f1 100644
--- a/.github/workflows/test_db_versions_all_tests.yml
+++ b/.github/workflows/test_db_versions_all_tests.yml
@@ -32,7 +32,7 @@ jobs:
           echo "All tests activated"
           exit 0
         else
-          echo "Fail, because not all tests are deactivated"
+          echo "Fail, because not all tests are activated"
           exit 1
         fi
       env:
diff --git a/.github/workflows/test_python_version.yml b/.github/workflows/test_python_version.yml
index 6e235b90d..55401e27a 100644
--- a/.github/workflows/test_python_version.yml
+++ b/.github/workflows/test_python_version.yml
@@ -14,8 +14,8 @@ jobs:
         exasol_version:
         - "default"
         python_version:
-        - 3.8
-        - 3.9
+        - "3.9"
+        - "3.10"
     name: Run tests with Python ${{ matrix.python_version }} and Exasol ${{ matrix.exasol_version }}
     runs-on: ubuntu-latest
     steps:
diff --git a/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_container.py b/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_container.py
index 3803eec7a..3a6598e35 100644
--- a/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_container.py
+++ b/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_container.py
@@ -2,7 +2,8 @@
 
 import luigi
 import netaddr
-import pkg_resources
+import importlib_resources
+
 from docker.models.containers import Container
 from docker.transport import unixconn
 
@@ -180,12 +181,17 @@ def _remove_container(self, container_name: str):
     def register_certificates(self, test_container: Container):
         if self.certificate_volume_name is not None:
             script_name = "install_root_certificate.sh"
-            script_str = pkg_resources.resource_string(
-                PACKAGE_NAME,
-                f"certificate_resources/{script_name}")  # type: bytes
-
+            script = (
+                importlib_resources.files(PACKAGE_NAME)
+                / "certificate_resources"
+                / script_name
+            )
             script_location_in_container = f"scripts/{script_name}"
-            copy_script_to_container(script_str.decode("UTF-8"), script_location_in_container, test_container)
+            copy_script_to_container(
+                script.read_text(),
+                script_location_in_container,
+                test_container,
+            )
 
             exit_code, output = test_container.exec_run(f"bash {script_location_in_container}")
             if exit_code != 0:
diff --git a/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_database.py b/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_database.py
index 260a02a57..4799134ff 100644
--- a/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_database.py
+++ b/exasol_integration_test_docker_environment/lib/test_environment/spawn_test_database.py
@@ -5,7 +5,8 @@
 import humanfriendly
 import luigi
 import netaddr
-import pkg_resources
+import importlib_resources
+
 from docker.models.containers import Container
 from docker.models.volumes import Volume
 from docker.client import DockerClient
@@ -304,6 +305,13 @@ def _prepare_volume(
         )
         return volume, container
 
+    def _db_file(self, filename: str) -> str:
+        return (
+            importlib_resources.files(PACKAGE_NAME)
+            / self.docker_db_config_resource_name
+            / filename
+        )
+
     def _upload_init_db_files(
             self,
             container: Container,
@@ -311,11 +319,8 @@ def _upload_init_db_files(
             authorized_keys: str,
     ):
         copy = DockerContainerCopy(container)
-        init_db_script_str = pkg_resources.resource_string(
-            PACKAGE_NAME,
-            f"{self.docker_db_config_resource_name}/init_db.sh") # type: bytes
-
-        copy.add_string_to_file("init_db.sh", init_db_script_str.decode("utf-8"))
+        init_script = self._db_file("init_db.sh")
+        copy.add_string_to_file("init_db.sh", init_script.read_text())
         self._add_exa_conf(copy, db_private_network, authorized_keys)
         copy.copy("/")
 
@@ -330,10 +335,8 @@ def _add_exa_conf(
         """
         certificate_dir = CERTIFICATES_MOUNT_DIR if self.certificate_volume_name is not None \
                             else CERTIFICATES_DEFAULT_DIR
-        template_str = pkg_resources.resource_string(
-            PACKAGE_NAME,
-            f"{self.docker_db_config_resource_name}/EXAConf") # type: bytes
-        template = Template(template_str.decode("utf-8"))
+        template_file = self._db_file("EXAConf")
+        template = Template(template_file.read_text())
         additional_db_parameter_str = " ".join(self.additional_db_parameter)
         rendered_template = template.render(private_network=db_private_network,
                                             db_version=str(self.db_version),
diff --git a/exasol_integration_test_docker_environment/py.typed b/exasol_integration_test_docker_environment/py.typed
new file mode 100644
index 000000000..e69de29bb