Repository: conan-io/conan
Pull request #16998 (2024-09-14 04:11:59)

more easy refactors conans->conan
Changelog: Omit
Docs: Omit


Patch:
diff --git a/conan/api/conan_api.py b/conan/api/conan_api.py
index 0a922501f..604e205e8 100644
--- a/conan/api/conan_api.py
+++ b/conan/api/conan_api.py
@@ -17,15 +17,15 @@ from conan.api.subapi.remotes import RemotesAPI
 from conan.api.subapi.remove import RemoveAPI
 from conan.api.subapi.search import SearchAPI
 from conan.api.subapi.upload import UploadAPI
-from conans.client.conf.required_version import check_required_conan_version
 from conans.client.migrations import ClientMigrator
 from conans.client.userio import init_colorama
 from conans.errors import ConanException
 from conans.model.version import Version
 from conan.internal.paths import get_conan_user_home
+from conans.model.version_range import validate_conan_version
 
 
-class ConanAPI(object):
+class ConanAPI:
     def __init__(self, cache_folder=None):
 
         version = sys.version_info
@@ -59,4 +59,6 @@ class ConanAPI(object):
         self.lockfile = LockfileAPI(self)
         self.local = LocalAPI(self)
 
-        check_required_conan_version(self.config.global_conf)
+        required_range_new = self.config.global_conf.get("core:required_conan_version")
+        if required_range_new:
+            validate_conan_version(required_range_new)
diff --git a/conan/api/subapi/config.py b/conan/api/subapi/config.py
index 05d64f020..c3ba8032c 100644
--- a/conan/api/subapi/config.py
+++ b/conan/api/subapi/config.py
@@ -7,10 +7,11 @@ from jinja2 import Environment, FileSystemLoader
 
 from conan import conan_version
 from conan.api.output import ConanOutput
-from conans.client.conf import default_settings_yml
-from conan.internal.api import detect_api
+
+from conan.internal.api.detect import detect_api
 from conan.internal.cache.home_paths import HomePaths
 from conan.internal.conan_app import ConanApp
+from conan.internal.default_settings import default_settings_yml
 from conans.client.graph.graph import CONTEXT_HOST, RECIPE_VIRTUAL, Node
 from conans.client.graph.graph_builder import DepsGraphBuilder
 from conans.client.graph.profile_node_definer import consumer_definer
diff --git a/conan/api/subapi/upload.py b/conan/api/subapi/upload.py
index cc151a761..47bf8b1c3 100644
--- a/conan/api/subapi/upload.py
+++ b/conan/api/subapi/upload.py
@@ -4,8 +4,8 @@ from multiprocessing.pool import ThreadPool
 
 from conan.api.output import ConanOutput
 from conan.internal.conan_app import ConanApp
-from conan.internal.upload_metadata import gather_metadata
-from conan.internal.api.uploader import PackagePreparator, UploadExecutor, UploadUpstreamChecker
+from conan.internal.api.uploader import PackagePreparator, UploadExecutor, UploadUpstreamChecker, \
+    gather_metadata
 from conans.client.pkg_sign import PkgSignaturesPlugin
 from conans.client.rest.file_uploader import FileUploader
 from conans.errors import ConanException, AuthenticationException, ForbiddenException
diff --git a/conan/internal/api/detect/__init__.py b/conan/internal/api/detect/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/conan/internal/api/detect_api.py b/conan/internal/api/detect/detect_api.py
similarity index 99%
rename from conan/internal/api/detect_api.py
rename to conan/internal/api/detect/detect_api.py
index 0701a56b3..96879adf6 100644
--- a/conan/internal/api/detect_api.py
+++ b/conan/internal/api/detect/detect_api.py
@@ -292,7 +292,7 @@ def default_msvc_runtime(compiler):
 
 
 def detect_msvc_update(version):
-    from conans.client.conf.detect_vs import vs_detect_update
+    from conan.internal.api.detect.detect_vs import vs_detect_update
     return vs_detect_update(version)
 
 
@@ -416,7 +416,7 @@ def default_msvc_ide_version(version):
 
 
 def _detect_vs_ide_version():
-    from conans.client.conf.detect_vs import vs_installation_path
+    from conan.internal.api.detect.detect_vs import vs_installation_path
     msvc_versions = "17", "16", "15"
     for version in msvc_versions:
         vs_path = os.getenv('vs%s0comntools' % version)
diff --git a/conans/client/conf/detect_vs.py b/conan/internal/api/detect/detect_vs.py
similarity index 100%
rename from conans/client/conf/detect_vs.py
rename to conan/internal/api/detect/detect_vs.py
diff --git a/conan/internal/api/profile/detect.py b/conan/internal/api/profile/detect.py
index 9048a82be..7c2d2685d 100644
--- a/conan/internal/api/profile/detect.py
+++ b/conan/internal/api/profile/detect.py
@@ -1,5 +1,5 @@
 from conan.api.output import ConanOutput
-from conan.internal.api.detect_api import detect_os, detect_arch, default_msvc_runtime, \
+from conan.internal.api.detect.detect_api import detect_os, detect_arch, default_msvc_runtime, \
     detect_libcxx, detect_cppstd, detect_default_compiler, default_compiler_version
 
 
diff --git a/conan/internal/api/profile/profile_loader.py b/conan/internal/api/profile/profile_loader.py
index 8b36ef61f..e9047054a 100644
--- a/conan/internal/api/profile/profile_loader.py
+++ b/conan/internal/api/profile/profile_loader.py
@@ -6,7 +6,7 @@ from jinja2 import Environment, FileSystemLoader
 
 from conan import conan_version
 from conan.api.output import ConanOutput
-from conan.internal.api import detect_api
+from conan.internal.api.detect import detect_api
 from conan.internal.cache.home_paths import HomePaths
 from conan.tools.env.environment import ProfileEnvironment
 from conans.errors import ConanException
diff --git a/conan/internal/api/uploader.py b/conan/internal/api/uploader.py
index 6c56a69be..2cdf1ff2a 100644
--- a/conan/internal/api/uploader.py
+++ b/conan/internal/api/uploader.py
@@ -1,3 +1,4 @@
+import fnmatch
 import os
 import shutil
 import time
@@ -277,3 +278,37 @@ def _total_size(cache_files):
         stat = os.stat(file)
         total_size += stat.st_size
     return human_size(total_size)
+
+
+def _metadata_files(folder, metadata):
+    result = {}
+    for root, _, files in os.walk(folder):
+        for f in files:
+            abs_path = os.path.join(root, f)
+            relpath = os.path.relpath(abs_path, folder)
+            if metadata:
+                if not any(fnmatch.fnmatch(relpath, m) for m in metadata):
+                    continue
+            path = os.path.join("metadata", relpath).replace("\\", "/")
+            result[path] = abs_path
+    return result
+
+
+def gather_metadata(package_list, cache, metadata):
+    for rref, recipe_bundle in package_list.refs().items():
+        if metadata or recipe_bundle["upload"]:
+            metadata_folder = cache.recipe_layout(rref).metadata()
+            files = _metadata_files(metadata_folder, metadata)
+            if files:
+                ConanOutput(scope=str(rref)).info(f"Recipe metadata: {len(files)} files")
+                recipe_bundle.setdefault("files", {}).update(files)
+                recipe_bundle["upload"] = True
+
+        for pref, pkg_bundle in package_list.prefs(rref, recipe_bundle).items():
+            if metadata or pkg_bundle["upload"]:
+                metadata_folder = cache.pkg_layout(pref).metadata()
+                files = _metadata_files(metadata_folder, metadata)
+                if files:
+                    ConanOutput(scope=str(pref)).info(f"Package metadata: {len(files)} files")
+                    pkg_bundle.setdefault("files", {}).update(files)
+                    pkg_bundle["upload"] = True
diff --git a/conans/client/conf/__init__.py b/conan/internal/default_settings.py
similarity index 99%
rename from conans/client/conf/__init__.py
rename to conan/internal/default_settings.py
index 28f89d142..398764564 100644
--- a/conans/client/conf/__init__.py
+++ b/conan/internal/default_settings.py
@@ -150,10 +150,6 @@ build_type: [null, Debug, Release, RelWithDebInfo, MinSizeRel]
 """
 
 
-def get_default_settings_yml():
-    return default_settings_yml
-
-
 def migrate_settings_file(cache_folder):
     from conans.client.migrations import update_file
 
diff --git a/conan/internal/upload_metadata.py b/conan/internal/upload_metadata.py
deleted file mode 100644
index 0dc8c2319..000000000
--- a/conan/internal/upload_metadata.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import fnmatch
-import os
-
-from conan.api.output import ConanOutput
-
-
-def _metadata_files(folder, metadata):
-    result = {}
-    for root, _, files in os.walk(folder):
-        for f in files:
-            abs_path = os.path.join(root, f)
-            relpath = os.path.relpath(abs_path, folder)
-            if metadata:
-                if not any(fnmatch.fnmatch(relpath, m) for m in metadata):
-                    continue
-            path = os.path.join("metadata", relpath).replace("\\", "/")
-            result[path] = abs_path
-    return result
-
-
-def gather_metadata(package_list, cache, metadata):
-    for rref, recipe_bundle in package_list.refs().items():
-        if metadata or recipe_bundle["upload"]:
-            metadata_folder = cache.recipe_layout(rref).metadata()
-            files = _metadata_files(metadata_folder, metadata)
-            if files:
-                ConanOutput(scope=str(rref)).info(f"Recipe metadata: {len(files)} files")
-                recipe_bundle.setdefault("files", {}).update(files)
-                recipe_bundle["upload"] = True
-
-        for pref, pkg_bundle in package_list.prefs(rref, recipe_bundle).items():
-            if metadata or pkg_bundle["upload"]:
-                metadata_folder = cache.pkg_layout(pref).metadata()
-                files = _metadata_files(metadata_folder, metadata)
-                if files:
-                    ConanOutput(scope=str(pref)).info(f"Package metadata: {len(files)} files")
-                    pkg_bundle.setdefault("files", {}).update(files)
-                    pkg_bundle["upload"] = True
diff --git a/conan/tools/build/cppstd.py b/conan/tools/build/cppstd.py
index bf66fc624..c15bbaa71 100644
--- a/conan/tools/build/cppstd.py
+++ b/conan/tools/build/cppstd.py
@@ -1,7 +1,7 @@
 import operator
 
 from conan.errors import ConanInvalidConfiguration, ConanException
-from conan.internal.api.detect_api import default_cppstd as default_cppstd_
+from conan.internal.api.detect.detect_api import default_cppstd as default_cppstd_
 from conans.model.version import Version
 
 
diff --git a/conan/tools/microsoft/visual.py b/conan/tools/microsoft/visual.py
index 7aad2edf9..233f9c50e 100644
--- a/conan/tools/microsoft/visual.py
+++ b/conan/tools/microsoft/visual.py
@@ -2,7 +2,7 @@ import os
 import textwrap
 
 from conan.internal import check_duplicated_generator
-from conans.client.conf.detect_vs import vs_installation_path
+from conan.internal.api.detect.detect_vs import vs_installation_path
 from conan.errors import ConanException, ConanInvalidConfiguration
 from conan.tools.scm import Version
 from conan.tools.intel.intel_cc import IntelCC
diff --git a/conans/client/conf/required_version.py b/conans/client/conf/required_version.py
deleted file mode 100644
index 50c89935c..000000000
--- a/conans/client/conf/required_version.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from conans import __version__ as client_version
-from conans.errors import ConanException
-from conans.model.version import Version
-from conans.model.version_range import VersionRange
-
-
-def validate_conan_version(required_range):
-    clientver = Version(client_version)
-    version_range = VersionRange(required_range)
-    for conditions in version_range.condition_sets:
-        conditions.prerelease = True
-    if not version_range.contains(clientver, resolve_prerelease=None):
-        raise ConanException("Current Conan version ({}) does not satisfy "
-                             "the defined one ({}).".format(clientver, required_range))
-
-
-def check_required_conan_version(global_conf):
-    """ Check if the required Conan version in config file matches to the current Conan version
-
-            When required_conan_version is not configured, it's skipped
-            When required_conan_version is configured, Conan's version must matches the required
-            version
-            When it doesn't match, an ConanException is raised
-
-        :param global_conf: the global configura
-        :return: None
-    """
-    required_range_new = global_conf.get("core:required_conan_version")
-    if required_range_new:
-        validate_conan_version(required_range_new)
diff --git a/conans/client/loader.py b/conans/client/loader.py
index b355c0150..efaed1a64 100644
--- a/conans/client/loader.py
+++ b/conans/client/loader.py
@@ -14,13 +14,13 @@ from pathlib import Path
 from conan.tools.cmake import cmake_layout
 from conan.tools.google import bazel_layout
 from conan.tools.microsoft import vs_layout
-from conans.client.conf.required_version import validate_conan_version
 from conans.client.loader_txt import ConanFileTextLoader
 from conans.errors import ConanException, NotFoundException, conanfile_exception_formatter
 from conans.model.conan_file import ConanFile
 from conans.model.options import Options
 from conans.model.recipe_ref import RecipeReference
 from conan.internal.paths import DATA_YML
+from conans.model.version_range import validate_conan_version
 from conans.util.files import load, chdir, load_user_encoded
 
 
diff --git a/conans/client/migrations.py b/conans/client/migrations.py
index ddde216ac..82997ba4e 100644
--- a/conans/client/migrations.py
+++ b/conans/client/migrations.py
@@ -4,6 +4,7 @@ import textwrap
 
 from conan.api.output import ConanOutput
 from conan.api.subapi.config import ConfigAPI
+from conan.internal.default_settings import migrate_settings_file
 from conans.migrations import Migrator
 from conans.util.dates import timestamp_now
 from conans.util.files import load, save
@@ -44,7 +45,6 @@ class ClientMigrator(Migrator):
         # Migrate the settings if they were the default for that version
         # Time for migrations!
         # Update settings.yml
-        from conans.client.conf import migrate_settings_file
         migrate_settings_file(self.cache_folder)
         # Update compatibility.py, app_compat.py, and cppstd_compat.py.
         from conans.client.graph.compatibility import migrate_compatibility_files
diff --git a/conans/client/rest/file_uploader.py b/conans/client/rest/file_uploader.py
index f8635315b..025f44595 100644
--- a/conans/client/rest/file_uploader.py
+++ b/conans/client/rest/file_uploader.py
@@ -1,7 +1,8 @@
+import os
 import time
 from copy import copy
 
-from conan.api.output import ConanOutput
+from conan.api.output import ConanOutput, TimedOutput
 from conans.client.rest import response_to_str
 from conans.errors import AuthenticationException, ConanException, \
     NotFoundException, ForbiddenException, RequestErrorException, InternalErrorException
@@ -53,7 +54,7 @@ class FileUploader(object):
         return bool(response.ok)
 
     def upload(self, url, abs_path, auth=None, dedup=False, retry=None, retry_wait=None,
-               headers=None):
+               headers=None, ref=None):
         retry = retry if retry is not None else self._config.get("core.upload:retry", default=1,
                                                                  check_type=int)
         retry_wait = retry_wait if retry_wait is not None else \
@@ -69,7 +70,7 @@ class FileUploader(object):
 
         for counter in range(retry + 1):
             try:
-                return self._upload_file(url, abs_path, headers, auth)
+                return self._upload_file(url, abs_path, headers, auth, ref)
             except (NotFoundException, ForbiddenException, AuthenticationException,
                     RequestErrorException):
                 raise
@@ -82,8 +83,28 @@ class FileUploader(object):
                         self._output.info("Waiting %d seconds to retry..." % retry_wait)
                     time.sleep(retry_wait)
 
-    def _upload_file(self, url, abs_path,  headers, auth):
+    def _upload_file(self, url, abs_path, headers, auth, ref):
+        class FileProgress:  # Wrapper just to provide an upload progress every 10 seconds
+            def __init__(self, f, total_size):
+                self._f = f
+                self._total = total_size
+                self._name = os.path.basename(f.name)
+                self._t = TimedOutput(interval=10)
+                self._read = 0
+
+            def __getattr__(self, item):
+                return getattr(self._f, item)
+
+            def read(self, n=-1):
+                read_bytes = self._f.read(n)
+                self._read += len(read_bytes)
+                self._t.info(f"{ref}: Uploading {self._name}: {int(self._read*100/self._total)}%")
+                return read_bytes
+
+        filesize = os.path.getsize(abs_path)
         with open(abs_path, mode='rb') as file_handler:
+            big_file = filesize > 100000000  # 100 MB
+            file_handler = FileProgress(file_handler, filesize) if big_file else file_handler
             try:
                 response = self._requester.put(url, data=file_handler, verify=self._verify_ssl,
                                                headers=headers, auth=auth,
diff --git a/conans/client/rest/rest_client_v2.py b/conans/client/rest/rest_client_v2.py
index 2e46de8de..0002e7f05 100644
--- a/conans/client/rest/rest_client_v2.py
+++ b/conans/client/rest/rest_client_v2.py
@@ -123,14 +123,14 @@ class RestV2Methods(RestCommonMethods):
         # Direct upload the recipe
         urls = {fn: self.router.recipe_file(ref, fn)
                 for fn in files_to_upload}
-        self._upload_files(files_to_upload, urls)
+        self._upload_files(files_to_upload, urls, str(ref))
 
     def _upload_package(self, pref, files_to_upload):
         urls = {fn: self.router.package_file(pref, fn)
                 for fn in files_to_upload}
-        self._upload_files(files_to_upload, urls)
+        self._upload_files(files_to_upload, urls, str(pref))
 
-    def _upload_files(self, files, urls):
+    def _upload_files(self, files, urls, ref):
         failed = []
         uploader = FileUploader(self.requester, self.verify_ssl, self._config)
         # conan_package.tgz and conan_export.tgz are uploaded first to avoid uploading conaninfo.txt
@@ -143,7 +143,7 @@ class RestV2Methods(RestCommonMethods):
                 headers = {}
                 uploader.upload(resource_url, files[filename], auth=self.auth,
                                 dedup=self._checksum_deploy,
-                                headers=headers)
+                                headers=headers, ref=ref)
             except (AuthenticationException, ForbiddenException):
                 raise
             except Exception as exc:
diff --git a/conans/model/version_range.py b/conans/model/version_range.py
index 751683e3e..ba59e84e6 100644
--- a/conans/model/version_range.py
+++ b/conans/model/version_range.py
@@ -3,6 +3,7 @@ from typing import Optional
 
 from conans.errors import ConanException
 from conans.model.recipe_ref import Version
+from conans import __version__ as client_version
 
 
 @total_ordering
@@ -217,3 +218,13 @@ class VersionRange:
 
     def version(self):
         return Version(f"[{self._expression}]")
+
+
+def validate_conan_version(required_range):
+    clientver = Version(client_version)
+    version_range = VersionRange(required_range)
+    for conditions in version_range.condition_sets:
+        conditions.prerelease = True
+    if not version_range.contains(clientver, resolve_prerelease=None):
+        raise ConanException("Current Conan version ({}) does not satisfy "
+                             "the defined one ({}).".format(clientver, required_range))


Test patch:
diff --git a/test/conftest.py b/test/conftest.py
index bc148aabe..3d169ce35 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -6,7 +6,7 @@ from shutil import which
 
 import pytest
 
-from conans.client.conf.detect_vs import vswhere
+from conan.internal.api.detect.detect_vs import vswhere
 
 """
 To override these locations with your own in your dev machine:
diff --git a/test/functional/test_profile_detect_api.py b/test/functional/test_profile_detect_api.py
index 1bac560e8..509df1129 100644
--- a/test/functional/test_profile_detect_api.py
+++ b/test/functional/test_profile_detect_api.py
@@ -3,7 +3,7 @@ import textwrap
 
 import pytest
 
-from conan.internal.api import detect_api
+from conan.internal.api.detect import detect_api
 from conan.test.utils.tools import TestClient
 
 
diff --git a/test/functional/toolchains/cmake/cmakedeps/test_cmakedeps_custom_configs.py b/test/functional/toolchains/cmake/cmakedeps/test_cmakedeps_custom_configs.py
index 4169b5f27..3501ddbdc 100644
--- a/test/functional/toolchains/cmake/cmakedeps/test_cmakedeps_custom_configs.py
+++ b/test/functional/toolchains/cmake/cmakedeps/test_cmakedeps_custom_configs.py
@@ -5,7 +5,7 @@ import unittest
 
 import pytest
 
-from conans.client.conf import get_default_settings_yml
+from conan.internal.default_settings import default_settings_yml
 from conan.test.assets.genconanfile import GenConanfile
 from conan.test.assets.sources import gen_function_cpp
 from conan.test.utils.tools import TestClient
@@ -145,7 +145,7 @@ class CustomSettingsTest(unittest.TestCase):
 
     def setUp(self):
         self.client = TestClient(path_with_spaces=False)
-        settings = get_default_settings_yml()
+        settings = default_settings_yml
         settings = settings.replace("build_type: [null, Debug, Release, ",
                                     "build_type: [null, Debug, MyRelease, ")
         save(self.client.cache.settings_path, settings)
diff --git a/test/functional/toolchains/microsoft/test_msbuild.py b/test/functional/toolchains/microsoft/test_msbuild.py
index 073eed151..890f17e77 100644
--- a/test/functional/toolchains/microsoft/test_msbuild.py
+++ b/test/functional/toolchains/microsoft/test_msbuild.py
@@ -5,7 +5,7 @@ import textwrap
 import pytest
 
 from conan.tools.microsoft.visual import vcvars_command
-from conans.client.conf.detect_vs import vs_installation_path
+from conan.internal.api.detect.detect_vs import vs_installation_path
 from conan.test.assets.sources import gen_function_cpp
 from test.functional.utils import check_vs_runtime, check_exe_run
 from conan.test.utils.tools import TestClient
diff --git a/test/functional/util/tools_test.py b/test/functional/util/tools_test.py
index 42c14d8fb..b89fc1c58 100644
--- a/test/functional/util/tools_test.py
+++ b/test/functional/util/tools_test.py
@@ -5,7 +5,7 @@ from shutil import which
 
 import pytest
 
-from conans.client.conf.detect_vs import vswhere
+from conan.internal.api.detect.detect_vs import vswhere
 from conans.errors import ConanException
 from conan.test.utils.env import environment_update
 
diff --git a/test/integration/command/upload/upload_complete_test.py b/test/integration/command/upload/upload_complete_test.py
index f800957fd..24d6c837f 100644
--- a/test/integration/command/upload/upload_complete_test.py
+++ b/test/integration/command/upload/upload_complete_test.py
@@ -56,7 +56,6 @@ def test_upload_with_pattern():
         client.run("export . --user=frodo --channel=stable")
 
     client.run("upload hello* --confirm -r default")
-    print(client.out)
     for num in range(3):
         assert "Uploading recipe 'hello%s/1.2.1@frodo/stable" % num in client.out
 
diff --git a/test/integration/conanfile/required_conan_version_test.py b/test/integration/conanfile/required_conan_version_test.py
index d4904a2a1..3bde82da8 100644
--- a/test/integration/conanfile/required_conan_version_test.py
+++ b/test/integration/conanfile/required_conan_version_test.py
@@ -22,10 +22,10 @@ def test_required_conan_version():
     client.run("source . ", assert_error=True)
     assert f"Current Conan version ({__version__}) does not satisfy the defined one (>=100.0)" in client.out
 
-    with mock.patch("conans.client.conf.required_version.client_version", "101.0"):
+    with mock.patch("conans.model.version_range.client_version", "101.0"):
         client.run("export . --name=pkg --version=1.0")
 
-    with mock.patch("conans.client.conf.required_version.client_version", "101.0-dev"):
+    with mock.patch("conans.model.version_range.client_version", "101.0-dev"):
         client.run("export . --name=pkg --version=1.0")
 
     client.run("install --requires=pkg/1.0@", assert_error=True)
diff --git a/test/integration/configuration/conf/test_conf.py b/test/integration/configuration/conf/test_conf.py
index 66cc9ef22..d8329e09e 100644
--- a/test/integration/configuration/conf/test_conf.py
+++ b/test/integration/configuration/conf/test_conf.py
@@ -6,7 +6,7 @@ import pytest
 from mock import patch
 
 from conan import conan_version
-from conan.internal.api import detect_api
+from conan.internal.api.detect import detect_api
 from conan.test.assets.genconanfile import GenConanfile
 from conan.test.utils.test_files import temp_folder
 from conans.util.files import save, load
@@ -134,7 +134,7 @@ def test_new_config_file(client):
     assert "[conf] Either 'cache:read_only' does not exist in configuration list" in client.out
 
 
-@patch("conans.client.conf.required_version.client_version", "1.26.0")
+@patch("conans.model.version_range.client_version", "1.26.0")
 def test_new_config_file_required_version():
     client = TestClient()
     conf = textwrap.dedent("""\
diff --git a/test/integration/configuration/required_version_test.py b/test/integration/configuration/required_version_test.py
index d4a92fa11..eb69db7cb 100644
--- a/test/integration/configuration/required_version_test.py
+++ b/test/integration/configuration/required_version_test.py
@@ -11,7 +11,7 @@ from conans.util.files import save
 
 class RequiredVersionTest(unittest.TestCase):
 
-    @mock.patch("conans.client.conf.required_version.client_version", "1.26.0")
+    @mock.patch("conans.model.version_range.client_version", "1.26.0")
     def test_wrong_version(self):
         required_version = "1.23.0"
         client = TestClient()
@@ -20,21 +20,21 @@ class RequiredVersionTest(unittest.TestCase):
         self.assertIn("Current Conan version (1.26.0) does not satisfy the defined "
                       "one ({})".format(required_version), client.out)
 
-    @mock.patch("conans.client.conf.required_version.client_version", "1.22.0")
+    @mock.patch("conans.model.version_range.client_version", "1.22.0")
     def test_exact_version(self):
         required_version = "1.22.0"
         client = TestClient()
         client.save_home({"global.conf": f"core:required_conan_version={required_version}"})
         client.run("--help")
 
-    @mock.patch("conans.client.conf.required_version.client_version", "2.1.0")
+    @mock.patch("conans.model.version_range.client_version", "2.1.0")
     def test_lesser_version(self):
         required_version = "<3.0"
         client = TestClient()
         client.save_home({"global.conf": f"core:required_conan_version={required_version}"})
         client.run("--help")
 
-    @mock.patch("conans.client.conf.required_version.client_version", "1.0.0")
+    @mock.patch("conans.model.version_range.client_version", "1.0.0")
     def test_greater_version(self):
         required_version = ">0.1.0"
         client = TestClient()
diff --git a/test/integration/graph/core/graph_manager_base.py b/test/integration/graph/core/graph_manager_base.py
index 7f4ac1f73..7303cb6bc 100644
--- a/test/integration/graph/core/graph_manager_base.py
+++ b/test/integration/graph/core/graph_manager_base.py
@@ -7,7 +7,7 @@ import yaml
 from conan.api.conan_api import ConanAPI
 from conan.internal.cache.cache import PkgCache
 from conan.internal.cache.home_paths import HomePaths
-from conans.client.conf import default_settings_yml
+from conan.internal.default_settings import default_settings_yml
 from conans.model.conf import ConfDefinition
 from conans.model.manifest import FileTreeManifest
 from conans.model.options import Options
diff --git a/test/unittests/client/build/cpp_std_flags_test.py b/test/unittests/client/build/cpp_std_flags_test.py
index c57948be7..e4318082b 100644
--- a/test/unittests/client/build/cpp_std_flags_test.py
+++ b/test/unittests/client/build/cpp_std_flags_test.py
@@ -1,6 +1,6 @@
 import unittest
 
-from conan.internal.api.detect_api import default_cppstd
+from conan.internal.api.detect.detect_api import default_cppstd
 from conan.tools.build import cppstd_flag
 from conans.model.version import Version
 from conan.test.utils.mocks import MockSettings, ConanFileMock
diff --git a/test/unittests/client/conf/detect/test_gcc_compiler.py b/test/unittests/client/conf/detect/test_gcc_compiler.py
index dd8cc5e80..b7059c600 100644
--- a/test/unittests/client/conf/detect/test_gcc_compiler.py
+++ b/test/unittests/client/conf/detect/test_gcc_compiler.py
@@ -4,7 +4,7 @@ import mock
 from parameterized import parameterized
 
 
-from conan.internal.api.detect_api import detect_gcc_compiler
+from conan.internal.api.detect.detect_api import detect_gcc_compiler
 
 
 class GCCCompilerTestCase(unittest.TestCase):
@@ -12,7 +12,7 @@ class GCCCompilerTestCase(unittest.TestCase):
     @parameterized.expand([("10",), ("4.2",), ('7', )])
     def test_detect_gcc_10(self, version):
         with mock.patch("platform.system", return_value="Linux"):
-            with mock.patch("conan.internal.api.detect_api.detect_runner", return_value=(0, version)):
+            with mock.patch("conan.internal.api.detect.detect_api.detect_runner", return_value=(0, version)):
                 compiler, installed_version, compiler_exe = detect_gcc_compiler()
         self.assertEqual(compiler, 'gcc')
         self.assertEqual(installed_version, version)
diff --git a/test/unittests/client/profile_loader/compiler_cppstd_test.py b/test/unittests/client/profile_loader/compiler_cppstd_test.py
index baaaa33e0..af73239e1 100644
--- a/test/unittests/client/profile_loader/compiler_cppstd_test.py
+++ b/test/unittests/client/profile_loader/compiler_cppstd_test.py
@@ -7,8 +7,8 @@ from jinja2 import Template
 
 from conan.internal.cache.cache import PkgCache
 from conan.internal.cache.home_paths import HomePaths
-from conans.client.conf import default_settings_yml
 from conan.internal.api.profile.profile_loader import ProfileLoader
+from conan.internal.default_settings import default_settings_yml
 from conans.errors import ConanException
 from conans.model.conf import ConfDefinition
 from conans.model.settings import Settings
diff --git a/test/unittests/model/settings_test.py b/test/unittests/model/settings_test.py
index da418033c..93c9adaf0 100644
--- a/test/unittests/model/settings_test.py
+++ b/test/unittests/model/settings_test.py
@@ -3,7 +3,7 @@ import unittest
 
 import pytest
 
-from conans.client.conf import default_settings_yml
+from conan.internal.default_settings import default_settings_yml
 from conans.errors import ConanException
 from conans.model.settings import Settings, bad_value_msg, undefined_field
 
diff --git a/test/unittests/tools/build/test_cppstd.py b/test/unittests/tools/build/test_cppstd.py
index 62c617625..943a64288 100644
--- a/test/unittests/tools/build/test_cppstd.py
+++ b/test/unittests/tools/build/test_cppstd.py
@@ -1,6 +1,6 @@
 import pytest
 
-from conan.internal.api.detect_api import detect_cppstd
+from conan.internal.api.detect.detect_api import detect_cppstd
 from conan.tools.build import supported_cppstd, check_min_cppstd, valid_min_cppstd
 from conans.errors import ConanException, ConanInvalidConfiguration
 from conans.model.version import Version
diff --git a/test/unittests/tools/cmake/test_cmake_install.py b/test/unittests/tools/cmake/test_cmake_install.py
index 48308d6f2..846040606 100644
--- a/test/unittests/tools/cmake/test_cmake_install.py
+++ b/test/unittests/tools/cmake/test_cmake_install.py
@@ -1,6 +1,6 @@
+from conan.internal.default_settings import default_settings_yml
 from conan.tools.cmake import CMake
 from conan.tools.cmake.presets import write_cmake_presets
-from conans.client.conf import get_default_settings_yml
 from conans.model.conf import Conf
 from conans.model.settings import Settings
 from conan.test.utils.mocks import ConanFileMock
@@ -13,7 +13,7 @@ def test_run_install_component():
     Issue related: https://github.com/conan-io/conan/issues/10359
     """
     # Load some generic windows settings
-    settings = Settings.loads(get_default_settings_yml())
+    settings = Settings.loads(default_settings_yml)
     settings.os = "Windows"
     settings.arch = "x86"
     settings.build_type = "Release"
@@ -42,7 +42,7 @@ def test_run_install_strip():
     Issue related: https://github.com/conan-io/conan/issues/14166
     """
 
-    settings = Settings.loads(get_default_settings_yml())
+    settings = Settings.loads(default_settings_yml)
     settings.os = "Linux"
     settings.arch = "x86_64"
     settings.build_type = "Release"
@@ -71,7 +71,7 @@ def test_run_install_cli_args():
     Issue related: https://github.com/conan-io/conan/issues/14235
     """
 
-    settings = Settings.loads(get_default_settings_yml())
+    settings = Settings.loads(default_settings_yml)
     settings.os = "Linux"
     settings.arch = "x86_64"
     settings.build_type = "Release"
@@ -99,7 +99,7 @@ def test_run_install_cli_args_strip():
     Issue related: https://github.com/conan-io/conan/issues/14235
     """
 
-    settings = Settings.loads(get_default_settings_yml())
+    settings = Settings.loads(default_settings_yml)
     settings.os = "Linux"
     settings.arch = "x86_64"
     settings.build_type = "Release"
diff --git a/test/unittests/tools/cmake/test_cmake_test.py b/test/unittests/tools/cmake/test_cmake_test.py
index aab3e284e..901fb3f45 100644
--- a/test/unittests/tools/cmake/test_cmake_test.py
+++ b/test/unittests/tools/cmake/test_cmake_test.py
@@ -1,8 +1,8 @@
 import pytest
 
+from conan.internal.default_settings import default_settings_yml
 from conan.tools.cmake import CMake
 from conan.tools.cmake.presets import write_cmake_presets
-from conans.client.conf import get_default_settings_yml
 from conans.model.conf import Conf
 from conans.model.settings import Settings
 from conan.test.utils.mocks import ConanFileMock
@@ -23,7 +23,7 @@ def test_run_tests(generator, target):
     multi-config ones.
     Issue related: https://github.com/conan-io/conan/issues/11405
     """
-    settings = Settings.loads(get_default_settings_yml())
+    settings = Settings.loads(default_settings_yml)
     settings.os = "Windows"
     settings.arch = "x86"
     settings.build_type = "Release"
@@ -46,7 +46,7 @@ def test_run_tests(generator, target):
 
 
 def test_cli_args_configure():
-    settings = Settings.loads(get_default_settings_yml())
+    settings = Settings.loads(default_settings_yml)
 
     conanfile = ConanFileMock()
     conanfile.conf = Conf()
diff --git a/test/unittests/tools/cmake/test_cmaketoolchain.py b/test/unittests/tools/cmake/test_cmaketoolchain.py
index 0420540f7..25ffb1104 100644
--- a/test/unittests/tools/cmake/test_cmaketoolchain.py
+++ b/test/unittests/tools/cmake/test_cmaketoolchain.py
@@ -4,9 +4,9 @@ import pytest
 from mock import Mock
 
 from conan import ConanFile
+from conan.internal.default_settings import default_settings_yml
 from conan.tools.cmake import CMakeToolchain
 from conan.tools.cmake.toolchain.blocks import Block
-from conans.client.conf import get_default_settings_yml
 from conans.errors import ConanException
 from conans.model.conf import Conf
 from conans.model.options import Options
@@ -533,7 +533,7 @@ def test_fpic_enabled(conanfile_linux_fpic):
 def test_libcxx_abi_flag():
     c = ConanFile()
     c.settings = "os", "compiler", "build_type", "arch"
-    c.settings = Settings.loads(get_default_settings_yml())
+    c.settings = Settings.loads(default_settings_yml)
     c.settings.build_type = "Release"
     c.settings.arch = "x86_64"
     c.settings.compiler = "gcc"
@@ -581,7 +581,7 @@ def test_apple_cmake_osx_sysroot(os, os_sdk, arch, expected_sdk):
     """
     c = ConanFile()
     c.settings = "os", "compiler", "build_type", "arch"
-    c.settings = Settings.loads(get_default_settings_yml())
+    c.settings = Settings.loads(default_settings_yml)
     c.settings.os = os
     if os_sdk:
         c.settings.os.sdk = os_sdk
@@ -615,7 +615,7 @@ def test_apple_cmake_osx_sysroot_sdk_mandatory(os, arch, expected_sdk):
     """
     c = ConanFile()
     c.settings = "os", "compiler", "build_type", "arch"
-    c.settings = Settings.loads(get_default_settings_yml())
+    c.settings = Settings.loads(default_settings_yml)
     c.settings.os = os
     c.settings.build_type = "Release"
     c.settings.arch = arch
diff --git a/test/unittests/util/detect_libc_test.py b/test/unittests/util/detect_libc_test.py
index c6106d4cc..c0a8160a0 100644
--- a/test/unittests/util/detect_libc_test.py
+++ b/test/unittests/util/detect_libc_test.py
@@ -1,6 +1,6 @@
 from parameterized import parameterized
 
-from conan.internal.api.detect_api import _parse_gnu_libc, _parse_musl_libc
+from conan.internal.api.detect.detect_api import _parse_gnu_libc, _parse_musl_libc
 
 
 class TestDetectLibc:
diff --git a/test/unittests/util/detect_test.py b/test/unittests/util/detect_test.py
index 0309715e8..654a27c75 100644
--- a/test/unittests/util/detect_test.py
+++ b/test/unittests/util/detect_test.py
@@ -5,7 +5,7 @@ from unittest.mock import patch
 import pytest
 from parameterized import parameterized
 
-from conan.internal.api.detect_api import _cc_compiler
+from conan.internal.api.detect.detect_api import _cc_compiler
 from conan.internal.api.profile.detect import detect_defaults_settings
 from conans.model.version import Version
 from conan.test.utils.mocks import RedirectedTestOutput
@@ -29,7 +29,7 @@ class DetectTest(unittest.TestCase):
         with mock.patch("platform.machine", mock.MagicMock(return_value='XXXXXXXXXXXX')), \
                 mock.patch("platform.processor", mock.MagicMock(return_value=processor)), \
                 mock.patch("platform.system", mock.MagicMock(return_value='AIX')), \
-                mock.patch("conan.internal.api.detect_api._get_aix_conf", mock.MagicMock(return_value=bitness)), \
+                mock.patch("conan.internal.api.detect.detect_api._get_aix_conf", mock.MagicMock(return_value=bitness)), \
                 mock.patch('subprocess.check_output', mock.MagicMock(return_value=version)):
             result = detect_defaults_settings()
             result = dict(result)
@@ -51,7 +51,7 @@ class DetectTest(unittest.TestCase):
             result = dict(result)
             self.assertEqual(expected_arch, result['arch'])
 
-    @mock.patch("conan.internal.api.detect_api.detect_clang_compiler",
+    @mock.patch("conan.internal.api.detect.detect_api.detect_clang_compiler",
                 return_value=("clang", Version("9"), "clang"))
     def test_detect_clang_gcc_toolchain(self, _):
         output = RedirectedTestOutput()
@@ -69,7 +69,7 @@ class DetectTest(unittest.TestCase):
     ["clang version 18 (https://github.com/llvm/llvm-project.git 461274b81d8641eab64d494accddc81d7db8a09e)", "18"],
     ["cc.exe (Rev3, Built by MSYS2 project) 14", "14"],
 ])
-@patch("conan.internal.api.detect_api.detect_runner")
+@patch("conan.internal.api.detect.detect_api.detect_runner")
 def test_detect_cc_versionings(detect_runner_mock, version_return, expected_version):
     detect_runner_mock.return_value = 0, version_return
     compiler, installed_version, compiler_exe = _cc_compiler()
diff --git a/test/unittests/util/detected_architecture_test.py b/test/unittests/util/detected_architecture_test.py
index 99bed7e39..5db15b928 100644
--- a/test/unittests/util/detected_architecture_test.py
+++ b/test/unittests/util/detected_architecture_test.py
@@ -3,7 +3,7 @@ import unittest
 
 from parameterized import parameterized
 
-from conan.internal.api.detect_api import detect_arch
+from conan.internal.api.detect.detect_api import detect_arch
 
 
 class DetectedArchitectureTest(unittest.TestCase):
@@ -41,14 +41,14 @@ class DetectedArchitectureTest(unittest.TestCase):
         with mock.patch("platform.machine", mock.MagicMock(return_value='00FB91F44C00')),\
                 mock.patch("platform.processor", mock.MagicMock(return_value='powerpc')),\
                 mock.patch("platform.system", mock.MagicMock(return_value='AIX')),\
-                mock.patch("conan.internal.api.detect_api._get_aix_conf", mock.MagicMock(return_value='32')),\
+                mock.patch("conan.internal.api.detect.detect_api._get_aix_conf", mock.MagicMock(return_value='32')),\
                 mock.patch('subprocess.check_output', mock.MagicMock(return_value='7.1.0.0')):
             self.assertEqual('ppc32', detect_arch())
 
         with mock.patch("platform.machine", mock.MagicMock(return_value='00FB91F44C00')),\
                 mock.patch("platform.processor", mock.MagicMock(return_value='powerpc')),\
                 mock.patch("platform.system", mock.MagicMock(return_value='AIX')),\
-                mock.patch("conan.internal.api.detect_api._get_aix_conf", mock.MagicMock(return_value='64')),\
+                mock.patch("conan.internal.api.detect.detect_api._get_aix_conf", mock.MagicMock(return_value='64')),\
                 mock.patch('subprocess.check_output', mock.MagicMock(return_value='7.1.0.0')):
             self.assertEqual('ppc64', detect_arch())