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

Stop importing from conda/exports.py #13869

Merged
merged 8 commits into from
May 1, 2024
5 changes: 4 additions & 1 deletion conda/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .core.index import LAST_CHANNEL_URLS, _supplement_index_with_prefix
from .core.link import PrefixSetup, UnlinkLinkTransaction
from .core.solve import diff_for_unlink_link_precs
from .deprecations import deprecated
from .exceptions import CondaIndexError, PackagesNotFoundError
from .history import History
from .instructions import FETCH, LINK, SYMLINK_CONDA, UNLINK
Expand Down Expand Up @@ -563,18 +564,19 @@ def get_blank_actions(prefix): # pragma: no cover
return actions


@deprecated("24.9", "24.5")
@time_recorder("execute_plan")
def execute_plan(old_plan, index=None, verbose=False): # pragma: no cover
"""Deprecated: This should `conda.instructions.execute_instructions` instead."""
plan = _update_old_plan(old_plan)
execute_instructions(plan, index, verbose)


@deprecated("24.9", "24.5")
def execute_instructions(
plan, index=None, verbose=False, _commands=None
): # pragma: no cover
"""Execute the instructions in the plan

:param plan: A list of (instruction, arg) tuples
:param index: The meta-data index
:param verbose: verbose output
Expand Down Expand Up @@ -612,6 +614,7 @@ def execute_instructions(
getLogger("progress.stop").info(None)


@deprecated("24.9", "24.5")
def _update_old_plan(old_plan): # pragma: no cover
"""
Update an old plan object to work with
Expand Down
22 changes: 22 additions & 0 deletions news/13869-remove-imports-from-exports-module
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* Mark `conda.plan.execute_plan` as pending deprecation. (#13869)
* Mark `conda.plan.execute_instructions` as pending deprecation. (#13869)
* Mark `conda.plan._update_old_plan` as pending deprecation. (#13869)


### Docs

* <news item>

### Other

* Remove and update any imports inside conda that is importing from `conda/exports.py`. (#13869)
3 changes: 2 additions & 1 deletion tests/core/test_package_cache_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
ProgressiveFetchExtract,
)
from conda.core.path_actions import CacheUrlAction
from conda.exports import MatchSpec, url_path
from conda.gateways.disk.create import copy
from conda.gateways.disk.permissions import make_read_only
from conda.gateways.disk.read import isfile, listdir, yield_lines
from conda.models.match_spec import MatchSpec
from conda.testing.helpers import CHANNEL_DIR_V1
from conda.utils import url_path

assert CHANNEL_DIR_V1 == abspath(
join(dirname(__file__), "..", "data", "conda_format_repo")
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_subdir_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from conda.core.index import get_index
from conda.core.subdir_data import SubdirData, cache_fn_url
from conda.exceptions import CondaUpgradeError
from conda.exports import url_path
from conda.gateways.repodata import (
CondaRepoInterface,
RepodataCache,
Expand All @@ -26,6 +25,7 @@
from conda.models.records import PackageRecord
from conda.testing.helpers import CHANNEL_DIR_V1, CHANNEL_DIR_V2
from conda.testing.integration import make_temp_env
from conda.utils import url_path

log = getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from conda import instructions
from conda.exceptions import CondaFileIOError
from conda.exports import execute_instructions
from conda.instructions import commands
from conda.plan import execute_instructions


def test_expected_operation_order():
Expand Down
3 changes: 1 addition & 2 deletions tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
from conda.common.io import env_var
from conda.core.solve import get_pinned_specs
from conda.exceptions import PackagesNotFoundError
from conda.exports import execute_plan
from conda.models.channel import Channel
from conda.models.dist import Dist
from conda.models.match_spec import MatchSpec
from conda.models.records import PackageRecord
from conda.plan import _update_old_plan as update_old_plan
from conda.plan import add_unlink, display_actions
from conda.plan import add_unlink, display_actions, execute_plan
from conda.testing import CondaCLIFixture, TmpEnvFixture
from conda.testing.helpers import captured, get_index_r_1

Expand Down