conda
conda copied to clipboard
`Channel` equality checks ignores whether `platform` is defined
Checklist
- [X] I added a descriptive title
- [X] I searched open reports and couldn't find a duplicate
What happened?
>>> from conda.models.channel import Channel
>>> Channel("conda-forge")
Channel("conda-forge")
>>> Channel("conda-forge/linux-64")
Channel("conda-forge/linux-64")
>>> Channel("conda-forge") == Channel("conda-forge/linux-64")
True
>>> Channel("conda-forge/linux-aarch64") == Channel("conda-forge/linux-64")
True
I find this behaviour surprising. I would expect that maybe under an implicit platform, it would take the non-noarch subdir from context.subdirs, but it doesn't. Instead, equality seems to be tested on location and name alone!
https://github.com/conda/conda/blob/1163830df51e3c94b3fea69c63181f4c37015d93/conda/models/channel.py#L337-L352
This, combined with https://github.com/conda/conda/issues/14258, leads to surprising deduplication bugs:
>>> from conda.models.channel import Channel
>>> channels = [Channel("conda-forge/noarch"), Channel("conda-forge")]
>>> deduped = tuple(dict.fromkeys(channels))
>>> set(url for c in channels for url in c.urls())
{'https://conda.anaconda.org/conda-forge/noarch', 'https://conda.anaconda.org/conda-forge/linux-aarch64'}
>>> set(url for c in deduped for url in c.urls())
{'https://conda.anaconda.org/conda-forge/noarch'}
See how we "lost" a subdir on the deduped set.
Conda Info
active environment : base
active env location : /opt/conda
shell level : 1
user config file : /root/.condarc
populated config files : /opt/conda/.condarc
conda version : 24.7.2.dev88+dirty
conda-build version : 24.7.1
python version : 3.11.5.final.0
solver : libmamba (default)
virtual packages : __archspec=1=m1
__conda=24.7.2.dev88+dirty=0
__glibc=2.31=0
__linux=5.15.49=0
__unix=0=0
base environment : /opt/conda (writable)
conda av data dir : /opt/conda/etc/conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/linux-aarch64
https://conda.anaconda.org/conda-forge/noarch
package cache : /opt/conda/pkgs
/root/.conda/pkgs
envs directories : /opt/conda/envs
/root/.conda/envs
platform : linux-aarch64
user-agent : conda/24.7.2.dev88+dirty requests/2.32.3 CPython/3.11.5 Linux/5.15.49-linuxkit-pr ubuntu/20.04.6 glibc/2.31 solver/libmamba
UID:GID : 0:0
netrc file : None
offline mode : False
Conda Config
==> /opt/conda/.condarc <==
channels:
- conda-forge
==> envvars <==
allow_softlinks: False
Conda list
# Name Version Build Channel
_openmp_mutex 4.5 2_gnu conda-forge
anaconda-client 1.12.3 pyhd8ed1ab_1 conda-forge
annotated-types 0.7.0 pyhd8ed1ab_0 conda-forge
appdirs 1.4.4 pyh9f0ad1d_0 conda-forge
archspec 0.2.3 pyhd8ed1ab_0 conda-forge
attrs 24.2.0 pyh71513ae_0 conda-forge
backports 1.0 pyhd8ed1ab_4 conda-forge
backports.tarfile 1.0.0 pyhd8ed1ab_1 conda-forge
beautifulsoup4 4.12.3 pyha770c72_0 conda-forge
blinker 1.8.2 pyhd8ed1ab_0 conda-forge
boltons 24.0.0 pyhd8ed1ab_0 conda-forge
boto3 1.35.24 pyhd8ed1ab_0 conda-forge
botocore 1.35.24 pyge310_1234567_0 conda-forge
brotli-python 1.1.0 py311h89d996e_2 conda-forge
bzip2 1.0.8 h31becfc_5 conda-forge
c-ares 1.28.1 h31becfc_0 conda-forge
ca-certificates 2024.8.30 hcefe29a_0 conda-forge
cachecontrol 0.14.0 pyhd8ed1ab_1 conda-forge
cachecontrol-with-filecache 0.14.0 pyhd8ed1ab_1 conda-forge
cachy 0.3.0 pyhd8ed1ab_1 conda-forge
certifi 2024.8.30 pyhd8ed1ab_0 conda-forge
cffi 1.17.1 py311h14e8bb7_0 conda-forge
cfgv 3.3.1 pyhd8ed1ab_0 conda-forge
chardet 5.2.0 py311hfecb2dc_2 conda-forge
charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge
click 8.1.7 unix_pyh707e725_0 conda-forge
click-default-group 1.2.4 pyhd8ed1ab_0 conda-forge
clikit 0.6.2 pyhd8ed1ab_2 conda-forge
colorama 0.4.6 pyhd8ed1ab_0 conda-forge
conda 24.7.2.dev88+dirty dev_0 <develop>
conda-build 24.7.1 py311hec3470c_0 conda-forge
conda-content-trust 0.2.0 pyhd8ed1ab_0 conda-forge
conda-index 0.5.0 pyhd8ed1ab_0 conda-forge
conda-libmamba-solver 24.7.1.dev158+g000cbf4 pypi_0 pypi
conda-lock 2.5.7 pyhd8ed1ab_0 conda-forge
conda-package-handling 2.3.0 pyh7900ff3_0 conda-forge
conda-package-streaming 0.9.0 pyhd8ed1ab_0 conda-forge
coverage 7.6.1 py311h5487e9b_1 conda-forge
cpp-expected 1.1.0 h4c384f3_0 conda-forge
crashtest 0.4.1 pyhd8ed1ab_0 conda-forge
cryptography 43.0.1 py311h4047cc9_0 conda-forge
dbus 1.13.6 h12b9eeb_3 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
distlib 0.3.8 pyhd8ed1ab_0 conda-forge
distro 1.9.0 pyhd8ed1ab_0 conda-forge
ensureconda 1.4.4 pyhd8ed1ab_0 conda-forge
exceptiongroup 1.2.2 pyhd8ed1ab_0 conda-forge
expat 2.6.3 h5ad3122_0 conda-forge
filelock 3.16.1 pyhd8ed1ab_0 conda-forge
flask 3.0.3 pyhd8ed1ab_0 conda-forge
fmt 11.0.2 h70be974_0 conda-forge
frozendict 2.4.4 py311hf4892ed_0 conda-forge
git 2.46.0 pl5321h011b5c6_0 conda-forge
gitdb 4.0.11 pyhd8ed1ab_0 conda-forge
gitpython 3.1.43 pyhd8ed1ab_0 conda-forge
html5lib 1.1 pyh9f0ad1d_0 conda-forge
icu 73.2 h787c7f5_0 conda-forge
identify 2.6.1 pyhd8ed1ab_0 conda-forge
idna 3.7 pyhd8ed1ab_0 conda-forge
importlib-metadata 8.5.0 pyha770c72_0 conda-forge
importlib_resources 6.4.5 pyhd8ed1ab_0 conda-forge
iniconfig 2.0.0 pyhd8ed1ab_0 conda-forge
itsdangerous 2.2.0 pyhd8ed1ab_0 conda-forge
jaraco.classes 3.4.0 pyhd8ed1ab_1 conda-forge
jaraco.context 5.3.0 pyhd8ed1ab_1 conda-forge
jaraco.functools 4.0.0 pyhd8ed1ab_0 conda-forge
jeepney 0.8.0 pyhd8ed1ab_0 conda-forge
jinja2 3.1.4 pyhd8ed1ab_0 conda-forge
jmespath 1.0.1 pyhd8ed1ab_0 conda-forge
jsonpatch 1.33 pyhd8ed1ab_0 conda-forge
jsonpointer 3.0.0 py311hec3470c_1 conda-forge
jsonschema 4.23.0 pyhd8ed1ab_0 conda-forge
jsonschema-specifications 2023.12.1 pyhd8ed1ab_0 conda-forge
jupyter_core 5.7.2 py311hec3470c_0 conda-forge
keyring 25.4.0 pyha804496_0 conda-forge
keyutils 1.6.1 h4e544f5_0 conda-forge
krb5 1.21.3 h50a48e9_0 conda-forge
ld_impl_linux-aarch64 2.40 h2d8c526_0 conda-forge
libarchive 3.7.4 h2c0effa_0 conda-forge
libcurl 8.9.1 hfa30633_0 conda-forge
libedit 3.1.20191231 he28a2e2_2 conda-forge
libev 4.33 h31becfc_2 conda-forge
libexpat 2.6.3 h5ad3122_0 conda-forge
libffi 3.4.2 h3557bc0_5 conda-forge
libgcc 14.1.0 he277a41_1 conda-forge
libgcc-ng 14.1.0 he9431aa_1 conda-forge
libglib 2.80.3 haee52c6_2 conda-forge
libgomp 14.1.0 he277a41_1 conda-forge
libiconv 1.17 h31becfc_2 conda-forge
liblief 0.14.1 h5ad3122_2 conda-forge
libmamba 2.0.0rc6 h061609f_0 conda-forge/label/mamba_dev
libmambapy 2.0.0rc6 py311h6baf103_0 conda-forge/label/mamba_dev
libnghttp2 1.58.0 hb0e430d_0 conda-forge
libnsl 2.0.1 h31becfc_0 conda-forge
libsolv 0.7.30 h62756fc_0 conda-forge
libsqlite 3.46.1 hc4a20ef_0 conda-forge
libssh2 1.11.0 h492db2e_0 conda-forge
libstdcxx 14.1.0 h3f4de04_1 conda-forge
libstdcxx-ng 13.2.0 h9a76618_5 conda-forge
libuuid 2.38.1 hb4cce97_0 conda-forge
libxcrypt 4.4.36 h31becfc_1 conda-forge
libxml2 2.12.7 hfed6450_3 conda-forge
libzlib 1.3.1 h68df207_1 conda-forge
lz4-c 1.9.4 hd600fc2_0 conda-forge
lzo 2.10 h516909a_1000 conda-forge
mamba 2.0.0rc6 h53317cb_0 conda-forge/label/mamba_dev
markupsafe 2.1.5 py311h5487e9b_1 conda-forge
menuinst 2.1.2 py311hec3470c_1 conda-forge
minio-server 2024.03.10.02.53.48 hcefe29a_0 conda-forge
more-itertools 10.5.0 pyhd8ed1ab_0 conda-forge
msgpack-python 1.1.0 py311hc07b1fb_0 conda-forge
nbformat 5.10.4 pyhd8ed1ab_0 conda-forge
ncurses 6.4.20240210 h0425590_0 conda-forge
nlohmann_json 3.11.3 h0a1ffab_1 conda-forge
nodeenv 1.9.1 pyhd8ed1ab_0 conda-forge
openssl 3.3.2 h86ecc28_0 conda-forge
packaging 24.1 pyhd8ed1ab_0 conda-forge
pastel 0.2.1 pyhd8ed1ab_0 conda-forge
patch 2.7.6 hf897c2e_1002 conda-forge
patchelf 0.17.2 h884eca8_0 conda-forge
pcre2 10.44 h070dd5b_2 conda-forge
perl 5.32.1 7_h31becfc_perl5 conda-forge
pexpect 4.9.0 pyhd8ed1ab_0 conda-forge
pip 24.2 pyh8b19718_1 conda-forge
pkginfo 1.11.1 pyhd8ed1ab_0 conda-forge
pkgutil-resolve-name 1.3.10 pyhd8ed1ab_1 conda-forge
platformdirs 4.3.6 pyhd8ed1ab_0 conda-forge
pluggy 1.5.0 pyhd8ed1ab_0 conda-forge
pre-commit 3.8.0 pyha770c72_1 conda-forge
psutil 6.0.0 py311ha879c10_1 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
py-lief 0.14.1 py311h89d996e_2 conda-forge
pybind11-abi 4 hd8ed1ab_3 conda-forge
pycosat 0.6.6 py311hcd402e7_0 conda-forge
pycparser 2.22 pyhd8ed1ab_0 conda-forge
pydantic 2.9.2 pyhd8ed1ab_0 conda-forge
pydantic-core 2.23.4 py311h0ca61a2_0 conda-forge
pylev 1.4.0 pyhd8ed1ab_0 conda-forge
pysocks 1.7.1 pyha2e5f31_6 conda-forge
pytest 8.3.3 pyhd8ed1ab_0 conda-forge
pytest-cov 5.0.0 pyhd8ed1ab_0 conda-forge
pytest-mock 3.14.0 pyhd8ed1ab_0 conda-forge
pytest-rerunfailures 14.0 pyhd8ed1ab_0 conda-forge
pytest-split 0.8.2 pyhd8ed1ab_0 conda-forge
pytest-timeout 2.3.1 pyhd8ed1ab_1 conda-forge
pytest-xprocess 1.0.2 pyhd8ed1ab_0 conda-forge
python 3.11.5 h43d1f9e_0_cpython conda-forge
python-dateutil 2.9.0 pyhd8ed1ab_0 conda-forge
python-fastjsonschema 2.20.0 pyhd8ed1ab_0 conda-forge
python-libarchive-c 5.1 py311hec3470c_1 conda-forge
python_abi 3.11 5_cp311 conda-forge
pytz 2024.2 pyhd8ed1ab_0 conda-forge
pyyaml 6.0.2 py311ha879c10_1 conda-forge
readline 8.2 h8fc344f_1 conda-forge
referencing 0.35.1 pyhd8ed1ab_0 conda-forge
reproc 14.2.4.post0 h31becfc_1 conda-forge
reproc-cpp 14.2.4.post0 h2f0025b_1 conda-forge
requests 2.32.3 pyhd8ed1ab_0 conda-forge
requests-toolbelt 1.0.0 pyhd8ed1ab_0 conda-forge
responses 0.25.3 pyhd8ed1ab_0 conda-forge
ripgrep 14.1.0 h1d8f897_0 conda-forge
rpds-py 0.20.0 py311h7270cec_1 conda-forge
ruamel.yaml 0.18.6 py311hcd402e7_0 conda-forge
ruamel.yaml.clib 0.2.8 py311hcd402e7_0 conda-forge
s3transfer 0.10.2 pyhd8ed1ab_0 conda-forge
secretstorage 3.3.3 py311hfecb2dc_3 conda-forge
setuptools 74.1.2 pyhd8ed1ab_0 conda-forge
setuptools-scm 8.1.0 pyhd8ed1ab_0 conda-forge
setuptools_scm 8.1.0 hd8ed1ab_0 conda-forge
simdjson 3.10.1 h17cf362_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
smmap 5.0.0 pyhd8ed1ab_0 conda-forge
soupsieve 2.5 pyhd8ed1ab_1 conda-forge
spdlog 1.14.1 h9d9cc24_1 conda-forge
tk 8.6.12 hd8af866_0 conda-forge
toml 0.10.2 pyhd8ed1ab_0 conda-forge
tomli 2.0.1 pyhd8ed1ab_0 conda-forge
tomlkit 0.13.2 pyha770c72_0 conda-forge
toolz 0.12.1 pyhd8ed1ab_0 conda-forge
tqdm 4.66.5 pyhd8ed1ab_0 conda-forge
traitlets 5.14.3 pyhd8ed1ab_0 conda-forge
truststore 0.8.0 pyhd8ed1ab_0 conda-forge
types-pyyaml 6.0.12.20240917 pyhd8ed1ab_0 conda-forge
typing-extensions 4.12.2 hd8ed1ab_0 conda-forge
typing_extensions 4.12.2 pyha770c72_0 conda-forge
tzdata 2024a h0c530f3_0 conda-forge
ukkonen 1.0.1 py311hc07b1fb_5 conda-forge
urllib3 1.26.19 pyhd8ed1ab_0 conda-forge
virtualenv 20.26.5 pyhd8ed1ab_0 conda-forge
webencodings 0.5.1 pyhd8ed1ab_2 conda-forge
werkzeug 3.0.4 pyhd8ed1ab_0 conda-forge
wheel 0.43.0 pyhd8ed1ab_1 conda-forge
xz 5.2.6 h9cdd2b7_0 conda-forge
yaml 0.2.5 hf897c2e_2 conda-forge
yaml-cpp 0.8.0 h2f0025b_0 conda-forge
zipp 3.20.2 pyhd8ed1ab_0 conda-forge
zstandard 0.23.0 py311hd5293d8_1 conda-forge
zstd 1.5.6 h02f22dd_0 conda-forge
Additional Context
No response