Skip to content

Commit

Permalink
Merge branch 'main' into run_test.r
Browse files Browse the repository at this point in the history
  • Loading branch information
beeankha authored Oct 3, 2024
2 parents fc48faa + 0ef3749 commit e7277e1
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 50 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
if: github.event_name != 'pull_request'

- name: Filter Changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
Expand Down Expand Up @@ -111,13 +111,13 @@ jobs:
run: echo "HASH=${{ runner.os }}-${{ runner.arch }}-Py${{ matrix.python-version }}-${{ matrix.conda-version }}-${{ matrix.test-type }}-$(date -u "+%Y%m")" >> $GITHUB_ENV

- name: Cache Conda
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/conda_pkgs_dir
key: cache-${{ env.HASH }}

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
condarc-file: .github/condarc
run-post: false # skip post cleanup
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:

- name: Upload Test Results
if: '!cancelled()'
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.4.0
with:
name: test-results-${{ env.HASH }}
path: |
Expand Down Expand Up @@ -191,13 +191,13 @@ jobs:
run: echo "HASH=${{ runner.os }}-${{ runner.arch }}-Py${{ matrix.python-version }}-benchmark-$(date -u "+%Y%m")" >> $GITHUB_ENV

- name: Cache Conda
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/conda_pkgs_dir
key: cache-${{ env.HASH }}

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
condarc-file: .github/condarc
run-post: false # skip post cleanup
Expand All @@ -210,7 +210,6 @@ jobs:
--file tests/requirements-${{ runner.os }}.txt
--file tests/requirements-ci.txt
python=${{ matrix.python-version }}
${{ env.CONDA_CHANNEL_LABEL }}${{ env.CONDA_VERSION }}
- name: Install CodSpeed
run: pip install git+https://github.com/kenodegard/pytest-codspeed.git@fix-outerr-redirects#egg=pytest-codspeed
Expand Down Expand Up @@ -272,13 +271,13 @@ jobs:
run: echo "HASH=${{ runner.os }}-${{ runner.arch }}-Py${{ matrix.python-version }}-${{ matrix.conda-version }}-${{ matrix.test-type }}-$(date -u "+%Y%m")" >> $GITHUB_ENV

- name: Cache Conda
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/conda_pkgs_dir
key: cache-${{ env.HASH }}

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
condarc-file: .github\condarc
run-post: false # skip post cleanup
Expand Down Expand Up @@ -324,7 +323,7 @@ jobs:

- name: Upload Test Results
if: '!cancelled()'
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.4.0
with:
name: test-results-${{ env.HASH }}
path: |
Expand Down Expand Up @@ -374,15 +373,15 @@ jobs:
run: echo "HASH=${{ runner.os }}-${{ runner.arch }}-Py${{ matrix.python-version }}-${{ matrix.conda-version }}-${{ matrix.test-type }}-$(date -u "+%Y%m")" >> $GITHUB_ENV

- name: Cache Conda
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/conda_pkgs_dir
~/macosx_sdks
key: cache-${{ env.HASH }}

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
condarc-file: .github/condarc
run-post: false # skip post cleanup
Expand Down Expand Up @@ -442,7 +441,7 @@ jobs:

- name: Upload Test Results
if: '!cancelled()'
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.4.0
with:
name: test-results-${{ env.HASH }}
path: |
Expand All @@ -468,13 +467,13 @@ jobs:

- name: Upload Combined Test Results
# provides one downloadable archive of all matrix run test results for further analysis
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.4.0
with:
name: test-results-${{ github.sha }}-all
path: test-results-*

- name: Test Summary
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
with:
paths: test-results-*/test-report.xml

Expand All @@ -486,7 +485,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Determine Success
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
# permit jobs to be skipped if there are no code changes (see changes job)
allowed-skips: ${{ toJSON(needs) }}
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:
# auto format Python codes within docstrings
- id: blacken-docs
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
rev: v0.6.8
hooks:
# lint & attempt to correct failures (e.g. pyupgrade)
- id: ruff
Expand Down Expand Up @@ -87,7 +87,7 @@ repos:
tests/
)
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
rev: 0.29.3
hooks:
# verify github syntaxes
- id: check-github-workflows
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
40 changes: 27 additions & 13 deletions conda_build/index.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
# Copyright (C) 2014 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations

import logging
import os
from functools import partial
from os.path import dirname
from typing import TYPE_CHECKING

from conda.base.context import context
from conda.core.index import get_index
from conda.exceptions import CondaHTTPError
from conda.utils import url_path
from conda_index.index import update_index as _update_index

from . import utils
from .deprecations import deprecated
from .utils import (
get_logger,
)

if TYPE_CHECKING:
from conda.models.channels import Channel

try:
from conda.core.index import Index
except ImportError:
# FUTURE: remove for `conda >=24.9`
from conda.core.index import get_index

def Index(channels: tuple[str | Channel, ...] = (), *args, **kwargs) -> dict: # type: ignore[no-redef]
return get_index(channel_urls=channels, *args, **kwargs)


log = get_logger(__name__)


Expand All @@ -29,6 +45,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 +56,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 Expand Up @@ -102,26 +118,24 @@ def get_build_index(
if subdir == "noarch":
subdir = context.subdir
try:
# get_index() is like conda reading the index, not conda_index
# Index() is like conda reading the index, not conda_index
# creating a new index.
cached_index = get_index(
channel_urls=urls,
cached_index = Index(
channels=urls,
prepend=not omit_defaults,
use_local=False,
use_cache=context.offline,
platform=subdir,
use_local=False,
)
# HACK: defaults does not have the many subfolders we support. Omit it and
# try again.
except CondaHTTPError:
if "defaults" in urls:
urls.remove("defaults")
cached_index = get_index(
channel_urls=urls,
prepend=omit_defaults,
use_local=False,
use_cache=context.offline,
cached_index = Index(
channels=urls,
prepend=not omit_defaults,
platform=subdir,
use_local=False,
)

local_index_timestamp = os.path.getmtime(index_file)
Expand Down
9 changes: 7 additions & 2 deletions conda_build/inspect_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from conda.api import Solver
from conda.base.context import context
from conda.cli.common import specs_from_args
from conda.core.index import get_index
from conda.core.prefix_data import PrefixData
from conda.models.records import PrefixRecord

Expand All @@ -38,6 +37,12 @@
package_has_file,
)

try:
from conda.core.index import Index
except ImportError:
# FUTURE: remove for `conda >=24.9`
from conda_build.index import Index

if TYPE_CHECKING:
from typing import Iterable, Literal

Expand Down Expand Up @@ -173,7 +178,7 @@ def test_installable(channel: str = "defaults") -> bool:
success = True
for subdir in ["osx-64", "linux-32", "linux-64", "win-32", "win-64"]:
log.info("######## Testing subdir %s ########", subdir)
for prec in get_index(channel_urls=[channel], prepend=False, platform=subdir):
for prec in Index(channels=[channel], prepend=False, platform=subdir):
name = prec["name"]
if name in {"conda", "conda-build"}:
# conda can only be installed in the root environment
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
9 changes: 7 additions & 2 deletions conda_build/skeletons/cpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from os.path import basename, dirname, exists, join

import requests
from conda.core.index import get_index
from conda.exceptions import CondaError, CondaHTTPError
from conda.gateways.connection.download import TmpDownload, download
from conda.gateways.disk.create import TemporaryDirectory
Expand All @@ -34,6 +33,12 @@
from ..variants import get_default_variant
from ..version import _parse as parse_version

try:
from conda.core.index import Index
except ImportError:
# FUTURE: remove for `conda >=24.9`
from conda_build.index import Index

CPAN_META = """\
{{% set name = "{packagename}" %}}
{{% set version = "{version}" %}}
Expand Down Expand Up @@ -695,7 +700,7 @@ def latest_pkg_version(pkg):
"""
:returns: the latest version of the specified conda package available
"""
r = Resolve(get_index())
r = Resolve(Index())
try:
pkg_list = sorted(r.get_pkgs(MatchSpec(pkg)))
except:
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>
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,19 @@ filterwarnings = [
# 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",
# ignore conda-package-streaming error
"ignore:conda.core.index._supplement_index_with_system is pending deprecation:PendingDeprecationWarning:conda",
"ignore:conda.core.index._make_virtual_package is pending deprecation:PendingDeprecationWarning:conda",
# ignore tarfile
"ignore:Python 3.14 will, by default, filter extracted tar archives:DeprecationWarning",
]
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",
"benchmark: execute the benchmark tests",
"memray: memory use tests",
]
minversion = 3.0
norecursedirs = ["tests/test-recipes/*"]
Expand Down
Loading

0 comments on commit e7277e1

Please sign in to comment.