Skip to content

Commit

Permalink
Deprecate conda.models.dist.IndexRecord (conda#13193)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard authored Oct 11, 2023
1 parent 45549ca commit 3d35f53
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
8 changes: 7 additions & 1 deletion conda/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,13 @@ def handle_proxy_407(x, y):
CondaOSError = CondaOSError
# PathNotFoundError is the conda 4.4.x name for it - let's plan ahead.
CondaFileNotFoundError = PathNotFoundError
IndexRecord = PackageRecord
deprecated.constant(
"24.3",
"24.9",
"IndexRecord",
PackageRecord,
addendum="Use `conda.models.records.PackageRecord` instead.",
)
# Replacements for six exports for compatibility
PY3 = True # noqa: F401
string_types = str # noqa: F401
Expand Down
9 changes: 8 additions & 1 deletion conda/models/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ..common.compat import ensure_text_type
from ..common.constants import NULL
from ..common.url import has_platform, is_url, join_url
from ..deprecations import deprecated
from .channel import Channel
from .package_info import PackageInfo
from .records import PackageRecord
Expand All @@ -32,7 +33,13 @@ class DistDetails(NamedTuple):
fmt: str


IndexRecord = PackageRecord # for conda-build backward compat
deprecated.constant(
"24.3",
"24.9",
"IndexRecord",
PackageRecord,
addendum="Use `conda.models.records.PackageRecord` instead.",
)


class DistType(EntityType):
Expand Down
2 changes: 1 addition & 1 deletion conda/models/match_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def original_spec_str(self):

def match(self, rec):
"""
Accepts an `IndexRecord` or a dict, and matches can pull from any field
Accepts a `PackageRecord` or a dict, and matches can pull from any field
in that record. Returns True for a match, and False for no match.
"""
if isinstance(rec, dict):
Expand Down
19 changes: 19 additions & 0 deletions news/13193-deprecate-IndexRecord
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* Mark `conda.models.dist.IndexRecord` as pending deprecation for removal in 24.9. (#13193)

### Docs

* <news item>

### Other

* <news item>
2 changes: 1 addition & 1 deletion tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ def INSTRUCTION_CMD(state, arg):

def generate_mocked_resolve(pkgs, install=None):
mock_package = namedtuple(
"IndexRecord", ["preferred_env", "name", "schannel", "version", "fn"]
"PacakgeRecord", ["preferred_env", "name", "schannel", "version", "fn"]
)
mock_resolve = namedtuple(
"Resolve",
Expand Down

0 comments on commit 3d35f53

Please sign in to comment.