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

Mark conda._vendor.boltons for deprecation. #12453

Merged
merged 9 commits into from
Mar 8, 2023
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
5 changes: 1 addition & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,8 @@ jobs:
docker run
--rm -v ${PWD}:/opt/conda-src
--platform linux/${{ matrix.platform }}
-e TEST_SPLITS
-e TEST_GROUP
ghcr.io/conda/conda-ci:main-linux-python${{ matrix.python-version }}${{ matrix.default-channel == 'conda-forge' && '-conda-forge' || '' }}
bash -c "source /opt/conda/etc/profile.d/conda.sh; \
pytest --cov=conda -k test_DepsModifier_contract"
/opt/conda-src/dev/linux/qemu.sh

- name: Upload test results
if: always()
Expand Down
2 changes: 2 additions & 0 deletions conda/_vendor/boltons/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from ...deprecations import deprecated
deprecated.module("23.9", "24.3", addendum="Use `boltons` instead.")
7 changes: 5 additions & 2 deletions conda/auxlib/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,17 @@

from collections.abc import Mapping, Sequence
from datetime import datetime
from enum import Enum
from functools import reduce
from json import JSONEncoder, dumps as json_dumps, loads as json_loads
from logging import getLogger

from enum import Enum
try:
from boltons.timeutils import isoparse
except ImportError:
from .._vendor.boltons.timeutils import isoparse

from . import NULL
from .._vendor.boltons.timeutils import isoparse
from .._vendor.frozendict import frozendict
from .collection import AttrDict, make_immutable
from .compat import isiterable, odict
Expand Down
6 changes: 5 additions & 1 deletion conda/base/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
import struct
from contextlib import contextmanager

try:
from boltons.setutils import IndexedSet
except ImportError:
from .._vendor.boltons.setutils import IndexedSet

from .constants import (
APP_NAME,
ChannelPriority,
Expand Down Expand Up @@ -39,7 +44,6 @@
from .._vendor.appdirs import user_data_dir
from ..auxlib.decorators import memoizedproperty
from ..auxlib.ish import dals
from .._vendor.boltons.setutils import IndexedSet
from .._vendor.frozendict import frozendict
from ..common.compat import NoneType, on_win
from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
Expand Down
7 changes: 4 additions & 3 deletions conda/cli/main_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# SPDX-License-Identifier: BSD-3-Clause

from collections import defaultdict
from datetime import datetime
from datetime import datetime, timezone

from .._vendor.boltons.timeutils import UTC
from ..base.context import context
from ..cli.common import stdout_json
from ..common.io import Spinner
Expand Down Expand Up @@ -134,7 +133,9 @@ def push_line(display_name, attr_name):
push_line("url", "url")
push_line("md5", "md5")
if record.timestamp:
date_str = datetime.fromtimestamp(record.timestamp, UTC).strftime('%Y-%m-%d %H:%M:%S %Z')
date_str = datetime.fromtimestamp(record.timestamp, timezone.utc).strftime(
"%Y-%m-%d %H:%M:%S %Z"
)
builder.append("%-12s: %s" % ("timestamp", date_str))
if record.track_features:
builder.append("%-12s: %s" % ("track_features", dashlist(record.track_features)))
Expand Down
6 changes: 5 additions & 1 deletion conda/common/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
if TYPE_CHECKING:
from typing import Sequence

try:
from boltons.setutils import IndexedSet
except ImportError:
from .._vendor.boltons.setutils import IndexedSet

from .compat import isiterable, primitive_types
from .constants import NULL
from .path import expand
Expand All @@ -40,7 +45,6 @@
from ..auxlib.type_coercion import TypeCoercionError, typify, typify_data_structure
from ..common.iterators import unique
from .._vendor.frozendict import frozendict
from .._vendor.boltons.setutils import IndexedSet

try:
from ruamel.yaml.comments import CommentedSeq, CommentedMap
Expand Down
6 changes: 5 additions & 1 deletion conda/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
import platform
import sys

try:
from boltons.setutils import IndexedSet
except ImportError:
from .._vendor.boltons.setutils import IndexedSet

from ..deprecations import deprecated
from .package_cache_data import PackageCacheData
from .prefix_data import PrefixData
from .subdir_data import SubdirData, make_feature_record
from .._vendor.boltons.setutils import IndexedSet
from ..base.context import context
from ..common.io import ThreadLimitedThreadPoolExecutor, time_recorder
from ..exceptions import ChannelNotAllowed, InvalidSpec, PluginError
Expand Down
6 changes: 5 additions & 1 deletion conda/core/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import sys
from textwrap import dedent

try:
from boltons.setutils import IndexedSet
except ImportError:
from .._vendor.boltons.setutils import IndexedSet

from conda.common.iterators import groupby_to_dict as groupby

from .index import get_reduced_index, _supplement_index_with_system
Expand All @@ -19,7 +24,6 @@
from ..deprecations import deprecated
from ..auxlib.decorators import memoizedproperty
from ..auxlib.ish import dals
from .._vendor.boltons.setutils import IndexedSet
from ..base.constants import DepsModifier, UNKNOWN_CHANNEL, UpdateModifier, REPODATA_FN
from ..base.context import context
from ..common.constants import NULL
Expand Down
22 changes: 12 additions & 10 deletions conda/core/subdir_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,39 @@
from contextlib import closing
from errno import EACCES, ENODEV, EPERM, EROFS
from functools import partial
from genericpath import getmtime, isfile
from io import open as io_open
from itertools import chain, islice
from logging import getLogger
from mmap import ACCESS_READ, mmap
from os.path import dirname, exists, isdir, join, splitext
from time import time

from genericpath import getmtime, isfile

from conda.common.iterators import groupby_to_dict as groupby
from conda.gateways.repodata import (
CondaRepoInterface,
RepodataIsEmpty,
RepoInterface,
Response304ContentUnchanged,
)
try:
from boltons.setutils import IndexedSet
except ImportError:
from .._vendor.boltons.setutils import IndexedSet

from .. import CondaError
from .._vendor.boltons.setutils import IndexedSet
from ..auxlib.ish import dals
from ..base.constants import CONDA_PACKAGE_EXTENSION_V1, REPODATA_FN
from ..base.context import context
from ..common.compat import ensure_binary, ensure_unicode
from ..common.io import DummyExecutor, ThreadLimitedThreadPoolExecutor, dashlist
from ..common.iterators import groupby_to_dict as groupby
from ..common.path import url_to_path
from ..common.url import join_url
from ..core.package_cache_data import PackageCacheData
from ..exceptions import CondaUpgradeError, NotWritableError, UnavailableInvalidChannel
from ..gateways.disk import mkdir_p, mkdir_p_sudo_safe
from ..gateways.disk.delete import rm_rf
from ..gateways.disk.update import touch
from ..gateways.repodata import (
CondaRepoInterface,
RepodataIsEmpty,
RepoInterface,
Response304ContentUnchanged,
)
from ..models.channel import Channel, all_channel_urls
from ..models.match_spec import MatchSpec
from ..models.records import PackageRecord
Expand Down
6 changes: 5 additions & 1 deletion conda/models/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
from itertools import chain
from logging import getLogger

from .._vendor.boltons.setutils import IndexedSet
try:
from boltons.setutils import IndexedSet
except ImportError:
from .._vendor.boltons.setutils import IndexedSet

from ..base.constants import DEFAULTS_CHANNEL_NAME, MAX_CHANNEL_PRIORITY, UNKNOWN_CHANNEL
from ..base.context import context, Context
from ..common.compat import ensure_text_type, isiterable
Expand Down
6 changes: 5 additions & 1 deletion conda/models/prefix_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
from collections import defaultdict
from logging import getLogger

try:
from boltons.setutils import IndexedSet
except ImportError:
from .._vendor.boltons.setutils import IndexedSet

from .enums import NoarchType
from .match_spec import MatchSpec
from .._vendor.boltons.setutils import IndexedSet
from ..base.context import context
from ..common.compat import on_win
from ..exceptions import CyclicalDependencyError
Expand Down
6 changes: 5 additions & 1 deletion conda/models/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

from os.path import basename, join

try:
from boltons.timeutils import dt_to_timestamp, isoparse
except ImportError:
from .._vendor.boltons.timeutils import dt_to_timestamp, isoparse

from .channel import Channel
from .enums import FileMode, LinkType, NoarchType, PackageType, PathType, Platform
from .match_spec import MatchSpec
Expand All @@ -27,7 +32,6 @@
NumberField,
StringField,
)
from .._vendor.boltons.timeutils import dt_to_timestamp, isoparse
from ..base.context import context
from ..common.compat import isiterable
from ..exceptions import PathNotFoundError
Expand Down
7 changes: 5 additions & 2 deletions conda/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
from logging import getLogger
import sys

from ._vendor.boltons.setutils import IndexedSet
try:
from boltons.setutils import IndexedSet
except ImportError:
from ._vendor.boltons.setutils import IndexedSet

from .base.constants import DEFAULTS_CHANNEL_NAME, UNKNOWN_CHANNEL
from .base.context import context, stack_context_default
from .common.io import dashlist, env_vars, time_recorder
Expand Down Expand Up @@ -440,7 +444,6 @@ def install_actions(prefix, index, specs, force=False, only_names=None, always_c
'CONDA_SOLVER_IGNORE_TIMESTAMPS': 'false',
}, stack_callback=stack_context_default):
from os.path import basename
from ._vendor.boltons.setutils import IndexedSet
from .models.channel import Channel
from .models.dist import Dist
if channel_priority_map:
Expand Down
6 changes: 5 additions & 1 deletion conda_env/installers/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import tempfile
from os.path import basename

from conda._vendor.boltons.setutils import IndexedSet
try:
from boltons.setutils import IndexedSet
except ImportError:
from conda._vendor.boltons.setutils import IndexedSet

from conda.base.constants import UpdateModifier
from conda.base.context import context
from conda.common.constants import NULL
Expand Down
Empty file modified dev/linux/install_miniconda.sh
100644 → 100755
Empty file.
17 changes: 17 additions & 0 deletions dev/linux/qemu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -o errtrace -o pipefail -o errexit

### Prevent git safety errors when mounting directories ###
git config --global --add safe.directory /opt/conda-src

# make sure all test requirements are installed
sudo /opt/conda/bin/conda install --quiet -y --file tests/requirements.txt
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
conda info
# remove the pkg cache. We can't hardlink from here anyway. Having it around causes log problems.
sudo rm -rf /opt/conda/pkgs/*-*-*
# put temporary files on same filesystem
export TMP=$HOME/pytesttmp
mkdir -p "$TMP"
python -m pytest --cov=conda --basetemp="$TMP" -k test_DepsModifier_contract
Empty file modified dev/linux/setup.sh
100644 → 100755
Empty file.
20 changes: 20 additions & 0 deletions news/12272-mark-vendor-boltons-for-deprecation
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* Mark `conda._vendor.boltons` for deprecation in 23.9.0 (#12272)

### Docs

* <news item>

### Other

* <news item>
2 changes: 2 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ requirements:
- toolz >=0.8.1
- pluggy >=1.0.0
- tqdm >=4
- boltons >= 23.0.0
run:
- python
- conda-package-handling >=1.3.0
Expand All @@ -49,6 +50,7 @@ requirements:
- toolz >=0.8.1
- pluggy >=1.0.0
- tqdm >=4
- boltons >= 23.0.0
run_constrained:
- conda-build >=3.18.3
- conda-env >=2.6
Expand Down
4 changes: 3 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# conda
# run as 'conda install --file tests/requirements.txt -c defaults'
# run as 'conda install --file tests/requirements.txt -c defaults' or
# run as 'conda install --file tests/requirements.txt -c conda-forge'
anaconda-client
beautifulsoup4
boto3 # NOTE: we also need the `minio` server, installed manually in CI
boltons >= 23.0.0
chardet
conda
conda-build >=3.23.3
Expand Down