Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add index benchmark #5508

Merged
merged 7 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
--file tests/requirements-${{ runner.os }}.txt
--file tests/requirements-ci.txt
python=${{ matrix.python-version }}
${{ env.CONDA_CHANNEL_LABEL }}${{ env.CONDA_VERSION }}
conda=24.7

- name: Install CodSpeed
run: pip install git+https://github.com/kenodegard/pytest-codspeed.git@fix-outerr-redirects#egg=pytest-codspeed
Expand Down
4 changes: 0 additions & 4 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2797,8 +2797,6 @@ def build(
channel_urls=m.config.channel_urls,
debug=m.config.debug,
verbose=m.config.verbose,
locking=m.config.locking,
timeout=m.config.timeout,
clear_cache=True,
omit_defaults=False,
)
Expand All @@ -2809,8 +2807,6 @@ def build(
channel_urls=m.config.channel_urls,
debug=m.config.debug,
verbose=m.config.verbose,
locking=m.config.locking,
timeout=m.config.timeout,
clear_cache=True,
omit_defaults=False,
)
Expand Down
4 changes: 0 additions & 4 deletions conda_build/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,6 @@ def get_install_actions(
channel_urls=channel_urls,
debug=debug,
verbose=verbose,
locking=locking,
timeout=timeout,
)
specs = tuple(
utils.ensure_valid_spec(spec) for spec in specs if not str(spec).endswith("@")
Expand Down Expand Up @@ -1038,8 +1036,6 @@ def create_env(
channel_urls=config.channel_urls,
debug=config.debug,
verbose=config.verbose,
locking=config.locking,
timeout=config.timeout,
)
_display_actions(prefix, precs)
if utils.on_win:
Expand Down
5 changes: 3 additions & 2 deletions conda_build/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from conda_index.index import update_index as _update_index

from . import utils
from .deprecations import deprecated
from .utils import (
get_logger,
)
Expand All @@ -29,6 +30,8 @@
# os.environ['CONDA_ADD_ANACONDA_TOKEN'] = "false"


@deprecated.argument("24.11", "25.1", "locking")
@deprecated.argument("24.11", "25.1", "timeout")
def get_build_index(
subdir,
bldpkgs_dir,
Expand All @@ -38,8 +41,6 @@ def get_build_index(
channel_urls=None,
debug=False,
verbose=True,
locking=None,
timeout=None,
):
"""
Used during package builds to create/get a channel including any local or
Expand Down
2 changes: 0 additions & 2 deletions conda_build/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ def execute_download_actions(m, precs, env, package_subset=None, require_files=F
channel_urls=m.config.channel_urls,
debug=m.config.debug,
verbose=m.config.verbose,
locking=m.config.locking,
timeout=m.config.timeout,
)

# this should be just downloading packages. We don't need to extract them -
Expand Down
20 changes: 20 additions & 0 deletions news/5508-deprecate-get_build_index-locking-timeout
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* Deprecate `conda_build.index.get_build_index(locking)`. (#5508)
* Deprecate `conda_build.index.get_build_index(timeout)`. (#5508)

### Docs

* <news item>

### Other

* <news item>
28 changes: 14 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,20 @@ doctest_optionflags = [
"ALLOW_UNICODE",
"ELLIPSIS",
]
filterwarnings = [
# elevate conda's deprecated warning to an error
"error::PendingDeprecationWarning:conda",
"error::DeprecationWarning:conda",
# elevate conda-build's deprecated warning to an error
"error::PendingDeprecationWarning:conda_build",
"error::DeprecationWarning:conda_build",
# ignore numpy.distutils error
'ignore:\s+`numpy.distutils` is deprecated:DeprecationWarning:conda_build._load_setup_py_data',
# ignore conda-index error
"ignore::PendingDeprecationWarning:conda_index",
"ignore::DeprecationWarning:conda_index",
"ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning",
]
# filterwarnings = [
# # elevate conda's deprecated warning to an error
# "error::PendingDeprecationWarning:conda",
# "error::DeprecationWarning:conda",
# # elevate conda-build's deprecated warning to an error
# "error::PendingDeprecationWarning:conda_build",
# "error::DeprecationWarning:conda_build",
# # ignore numpy.distutils error
# 'ignore:\s+`numpy.distutils` is deprecated:DeprecationWarning:conda_build._load_setup_py_data',
# # ignore conda-index error
# "ignore::PendingDeprecationWarning:conda_index",
# "ignore::DeprecationWarning:conda_index",
# "ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning",
# ]
markers = [
"serial: execute test serially (to avoid race conditions)",
"slow: execute the slow tests if active",
Expand Down
25 changes: 21 additions & 4 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
import yaml
from binstar_client.commands import remove, show
from binstar_client.errors import NotFound
from conda import __version__ as conda_version
from conda.base.context import context, reset_context
from conda.common.compat import on_linux, on_mac, on_win
from conda.exceptions import ClobberError, CondaError, CondaMultiError, LinkError
from conda.utils import url_path
from conda_index.api import update_index
from packaging.version import Version

from conda_build import __version__, api, exceptions
from conda_build.config import Config
Expand Down Expand Up @@ -69,7 +71,7 @@
)

if TYPE_CHECKING:
from pytest import FixtureRequest, MonkeyPatch
from pytest import CaptureFixture, FixtureRequest, LogCaptureFixture, MonkeyPatch
from pytest_mock import MockerFixture

from conda_build.metadata import MetaData
Expand Down Expand Up @@ -1826,7 +1828,11 @@ def test_downstream_tests(testing_config):


@pytest.mark.sanity
def test_warning_on_file_clobbering(testing_config, capfd):
def test_warning_on_file_clobbering(
testing_config: Config,
capfd: CaptureFixture,
caplog: LogCaptureFixture,
) -> None:
recipe_dir = os.path.join(metadata_dir, "_overlapping_files_warning")

api.build(
Expand All @@ -1844,8 +1850,19 @@ def test_warning_on_file_clobbering(testing_config, capfd):
config=testing_config,
)
# The clobber warning here is raised when creating the test environment for b
out, err = capfd.readouterr()
assert "ClobberWarning" in err
if Version(conda_version) >= Version("24.9.0"):
# conda >=24.9.0
clobber_warning_found = False
for record in caplog.records:
if "ClobberWarning:" in record.message:
clobber_warning_found = True
assert clobber_warning_found
else:
# before the new lazy index added in conda 24.9.0
# see https://github.com/conda/conda/commit/1984b287548a1a526e8258802a6f1fec2a11ecc3
out, err = capfd.readouterr()
assert "ClobberWarning" in err

Comment on lines +1853 to +1865
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix from #5488 that we need to get this merged

with pytest.raises((ClobberError, CondaMultiError)):
with env_var("CONDA_PATH_CONFLICT", "prevent", reset_context):
api.build(os.path.join(recipe_dir, "b"), config=testing_config)
Expand Down
25 changes: 25 additions & 0 deletions tests/test_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) 2014 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations

from typing import TYPE_CHECKING

import pytest
from conda.base.context import context

from conda_build.index import get_build_index

if TYPE_CHECKING:
from conda_build.metadata import MetaData


@pytest.mark.benchmark
def test_get_build_index(testing_metadata: MetaData) -> None:
get_build_index(
subdir=context.subdir,
bldpkgs_dir=testing_metadata.config.bldpkgs_dir,
output_folder=testing_metadata.config.output_folder,
clear_cache=True,
omit_defaults=True,
channel_urls=["local", "conda-forge", "defaults"],
)
Loading