diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34f2c97018..20688e9f6c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ exclude: | test-recipes | test-skeleton )/ | - .*\.(patch|diff) | + .*\.(patch|diff) ) repos: # generic verification and formatting diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py index 92d5ba0678..25ecc9cef9 100644 --- a/conda_build/conda_interface.py +++ b/conda_build/conda_interface.py @@ -11,9 +11,8 @@ from conda.auxlib.packaging import ( # noqa: F401 _get_version_from_git_tag as get_version_from_git_tag, ) -from conda.base.context import context, determine_target_prefix +from conda.base.context import context, determine_target_prefix, reset_context from conda.base.context import non_x86_machines as non_x86_linux_machines # noqa: F401 -from conda.base.context import reset_context from conda.core.package_cache import ProgressiveFetchExtract # noqa: F401 from conda.exceptions import ( # noqa: F401 CondaError, @@ -24,15 +23,12 @@ PaddingError, UnsatisfiableError, ) -from conda.exports import ArgumentParser # noqa: F401 -from conda.exports import CondaSession # noqa: F401 -from conda.exports import EntityEncoder # noqa: F401 -from conda.exports import VersionOrder # noqa: F401 -from conda.exports import _toposort # noqa: F401 -from conda.exports import get_index # noqa: F401 from conda.exports import ( # noqa: F401 + ArgumentParser, # noqa: F401 Channel, Completer, + CondaSession, # noqa: F401 + EntityEncoder, # noqa: F401 FileMode, InstalledPackages, MatchSpec, @@ -43,12 +39,15 @@ TemporaryDirectory, TmpDownload, Unsatisfiable, + VersionOrder, # noqa: F401 + _toposort, # noqa: F401 add_parser_channels, add_parser_prefix, display_actions, download, execute_actions, execute_plan, + get_index, # noqa: F401 handle_proxy_407, hashsum_file, human_bytes, diff --git a/conda_build/metadata.py b/conda_build/metadata.py index 47f3166727..0681bcf90c 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -1752,18 +1752,20 @@ def has_prefix_files(self): def ignore_prefix_files(self): ret = self.get_value("build/ignore_prefix_files", False) - if type(ret) not in (list, bool): + if not isinstance(ret, (list, bool)): raise RuntimeError( "build/ignore_prefix_files should be boolean or a list of paths " "(optionally globs)" ) if sys.platform == "win32": - if type(ret) is list and any("\\" in i for i in ret): + if isinstance(ret, list) and any("\\" in i for i in ret): raise RuntimeError( "build/ignore_prefix_files paths must use / " "as the path delimiter on Windows" ) - return expand_globs(ret, self.config.host_prefix) if type(ret) is list else ret + return ( + expand_globs(ret, self.config.host_prefix) if isinstance(ret, list) else ret + ) def always_include_files(self): files = ensure_list(self.get_value("build/always_include_files", [])) @@ -1782,18 +1784,20 @@ def ignore_verify_codes(self): def binary_relocation(self): ret = self.get_value("build/binary_relocation", True) - if type(ret) not in (list, bool): + if not isinstance(ret, (list, bool)): raise RuntimeError( "build/binary_relocation should be boolean or a list of paths " "(optionally globs)" ) if sys.platform == "win32": - if type(ret) is list and any("\\" in i for i in ret): + if isinstance(ret, list) and any("\\" in i for i in ret): raise RuntimeError( "build/binary_relocation paths must use / " "as the path delimiter on Windows" ) - return expand_globs(ret, self.config.host_prefix) if type(ret) is list else ret + return ( + expand_globs(ret, self.config.host_prefix) if isinstance(ret, list) else ret + ) def include_recipe(self): return self.get_value("build/include_recipe", True) diff --git a/conda_build/utils.py b/conda_build/utils.py index a62d6700be..af5678247e 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -73,15 +73,15 @@ from conda_build.exceptions import BuildLockError # noqa from conda_build.os_utils import external # noqa -from .conda_interface import Dist # noqa -from .conda_interface import StringIO # noqa -from .conda_interface import cc_conda_build # noqa -from .conda_interface import context # noqa from .conda_interface import ( # noqa CondaHTTPError, + Dist, # noqa MatchSpec, + StringIO, # noqa TemporaryDirectory, VersionOrder, + cc_conda_build, # noqa + context, # noqa download, get_conda_channel, hashsum_file, diff --git a/pyproject.toml b/pyproject.toml index 93522bca6a..39cd67a674 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,8 +99,7 @@ line-length = 180 # E, W = pycodestyle errors and warnings # F = pyflakes # I = isort -# D = pydocstyle -select = ["E", "W", "F", "I", "D1"] +select = ["E", "W", "F", "I"] # E402 module level import not at top of file # E722 do not use bare 'except' # E731 do not assign a lambda expression, use a def @@ -121,15 +120,15 @@ addopts = [ "--cov-report=xml", "--durations=16", "--junitxml=junit.xml", - "--splitting-algorithm=least_duration", - "--store-durations", + # "--splitting-algorithm=least_duration", # not available yet + # "--store-durations", # not available yet "--strict-markers", "--tb=native", "-vv", ] markers = [ - "serial: execute test serially (to avoid race conditions)", - "slow: execute the slow tests if active", - "sanity: execute the sanity tests", - "no_default_testing_config: used internally to disable monkeypatching for testing_config", + "serial: execute test serially (to avoid race conditions)", + "slow: execute the slow tests if active", + "sanity: execute the sanity tests", + "no_default_testing_config: used internally to disable monkeypatching for testing_config", ]