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

feat(manager/pixi): full support #34646

Open
wants to merge 144 commits into
base: main
Choose a base branch
from
Open
Changes from 9 commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
fa12352
feat: add conda versioning
trim21 Feb 22, 2025
97ced6c
coverage
trim21 Feb 25, 2025
aeee08d
coverage
trim21 Feb 25, 2025
da125a5
coverage
trim21 Feb 25, 2025
0f419ea
doc
trim21 Feb 25, 2025
72aacd6
coverage
trim21 Feb 25, 2025
e615772
coverage
trim21 Feb 25, 2025
2cf7237
Merge remote-tracking branch 'upstream/main' into conda-versioning
trim21 Feb 26, 2025
b562b09
fix test
trim21 Feb 26, 2025
3e732fc
fix test
trim21 Feb 26, 2025
8cf1489
fix test
trim21 Feb 26, 2025
0d570f5
Merge branch 'main' into conda-versioning
trim21 Feb 26, 2025
c9f860d
fix stable
trim21 Feb 26, 2025
3547aef
add more comment
trim21 Feb 26, 2025
1e4df0f
fix some case of replace
trim21 Feb 26, 2025
bd54b33
Merge branch 'main' into conda-versioning
trim21 Feb 27, 2025
427b0fc
Merge branch 'main' into conda-versioning
trim21 Feb 27, 2025
33a08c3
coverage
trim21 Feb 27, 2025
2872435
fix replace case with and
trim21 Feb 27, 2025
69b0ca9
fallback to pep440
trim21 Feb 27, 2025
b3d0083
Merge branch 'main' into conda-versioning
trim21 Feb 27, 2025
5d6b363
coverage
trim21 Mar 1, 2025
f2dfd87
support conda `*`
trim21 Mar 5, 2025
8405f2a
Merge remote-tracking branch 'upstream/main' into conda-versioning
trim21 Mar 5, 2025
57f182f
coverage
trim21 Mar 5, 2025
4d6e720
ignore cov
trim21 Mar 5, 2025
737ac09
fix test
trim21 Mar 5, 2025
50a8d36
fix test
trim21 Mar 5, 2025
b6b53a4
Feat/manager/pixi/conda
trim21 Mar 5, 2025
0a60b7f
test datasource change
trim21 Mar 5, 2025
92e7c67
ignore unexpected input
trim21 Mar 5, 2025
80c333d
cov
trim21 Mar 5, 2025
93bc436
cov
trim21 Mar 5, 2025
3e83ed1
cov
trim21 Mar 5, 2025
138f4be
update docs
trim21 Mar 5, 2025
93c4633
Merge branch 'main' into conda-versioning
trim21 Mar 5, 2025
b1e7e92
fix eslint
trim21 Mar 5, 2025
d4d944a
revert some change for debug
trim21 Mar 5, 2025
7975196
Merge branch 'main' into feat/manager-pixi
trim21 Mar 5, 2025
ad59ce7
add supported channel docs
trim21 Mar 6, 2025
5f7acb9
add supported channel docs
trim21 Mar 6, 2025
6323750
update docs
trim21 Mar 6, 2025
fbdfd68
Merge remote-tracking branch 'upstream/main' into feat/manager-pixi
trim21 Mar 6, 2025
bff46d6
cov
trim21 Mar 6, 2025
998a583
Merge branch 'main' into feat/manager-pixi
trim21 Mar 6, 2025
3614c3e
docs: update conda usage
trim21 Feb 27, 2025
444b9fd
typo
trim21 Feb 27, 2025
d8d54cd
use rattler from upstream
trim21 Mar 6, 2025
5f587cf
Merge branch 'main' into conda-versioning
trim21 Mar 6, 2025
c2d13dc
use rattler from upstream
trim21 Mar 6, 2025
1ea8508
use pep440.getNewValue should always work
trim21 Mar 6, 2025
65ec686
Merge branch 'conda-versioning' into feat/manager-pixi
trim21 Mar 6, 2025
8757c76
we do not need to add default export
trim21 Mar 6, 2025
d6711b2
Merge branch 'conda-versioning' into feat/manager-pixi
trim21 Mar 6, 2025
833b248
Update lib/modules/manager/pixi/readme.md
trim21 Mar 7, 2025
f3bffd0
Update readme.md
trim21 Mar 7, 2025
cfa4333
Update readme.md
trim21 Mar 7, 2025
2efa277
Update lib/modules/manager/pixi/readme.md
trim21 Mar 7, 2025
f8b7313
Update lib/modules/datasource/conda/readme.md
trim21 Mar 7, 2025
b3aa7c9
Update readme.md
trim21 Mar 7, 2025
26158b1
update docs
trim21 Mar 7, 2025
25f5079
Merge branch 'main' into feat/manager-pixi
trim21 Mar 7, 2025
a46c5ec
update docs
trim21 Mar 7, 2025
202aeaa
add todo
trim21 Mar 7, 2025
aef6f6c
update docs
trim21 Mar 7, 2025
7060403
Merge branch 'main' into conda-versioning
trim21 Mar 7, 2025
cde96e5
fix typo
trim21 Mar 7, 2025
dfcde16
use pixi >=0.40
trim21 Mar 7, 2025
5567be8
remove unintentionally export from pep621
trim21 Mar 7, 2025
7bb28f0
update docs
trim21 Mar 7, 2025
6095db2
update docs
trim21 Mar 7, 2025
9eb9559
update docs
trim21 Mar 7, 2025
b1dd478
update docs
trim21 Mar 7, 2025
3e58ac8
update docs
trim21 Mar 7, 2025
07eed29
update docs
trim21 Mar 7, 2025
3ad99e8
add releaseTimestamp support to anaconda api source
trim21 Mar 7, 2025
b2e326a
add yanked package support to prefix.dev
trim21 Mar 7, 2025
eee4deb
reduce fixture size
trim21 Mar 7, 2025
f3741f0
fix test
trim21 Mar 7, 2025
54ad630
init commit
trim21 Mar 7, 2025
6da041f
revert data source change
trim21 Mar 7, 2025
5e57184
Merge branch 'main' into feat/datasource/conda
trim21 Mar 7, 2025
6385f9a
Update lib/modules/datasource/conda/index.spec.ts
trim21 Mar 7, 2025
023bb39
cov
trim21 Mar 7, 2025
ee1f252
cov
trim21 Mar 7, 2025
92e2b78
Update lib/modules/manager/pixi/readme.md
trim21 Mar 7, 2025
a467ab4
cov
trim21 Mar 7, 2025
1471cf9
fix eslint
trim21 Mar 7, 2025
1deccd4
init commit
trim21 Mar 7, 2025
b11ddc1
feat(github-actions): Support actions/setup-node/go/python with:node-…
rarkins Mar 7, 2025
852d792
Update lib/modules/datasource/conda/index.spec.ts
trim21 Mar 7, 2025
19839ce
cov
trim21 Mar 7, 2025
e358906
cov
trim21 Mar 7, 2025
31d6dcc
cov
trim21 Mar 7, 2025
43c2d52
fix eslint
trim21 Mar 7, 2025
d763d83
wip
trim21 Mar 7, 2025
73fe4cf
apply code review
trim21 Mar 7, 2025
e5c91ad
apply code review
trim21 Mar 7, 2025
d71aa40
fix eslint
trim21 Mar 7, 2025
89b0bbf
apply code review
trim21 Mar 7, 2025
0aa0a59
improve code readability
trim21 Mar 7, 2025
ac65a34
fix
trim21 Mar 7, 2025
f78c1ed
Merge branch 'conda-versioning' into feat/manager-pixi
trim21 Mar 7, 2025
f3c20ba
Merge branch 'main' into conda-versioning
trim21 Mar 7, 2025
cc2c93b
add fast.prefix.dev domain
trim21 Mar 7, 2025
a0f61e4
avoid show pixi stderr multiple times
trim21 Mar 7, 2025
5323104
Merge branch 'main' into feat/manager-pixi
trim21 Mar 7, 2025
7556def
apply code review
trim21 Mar 8, 2025
758b5ad
apply code review
trim21 Mar 8, 2025
47046c1
merge prefix.dev files
trim21 Mar 8, 2025
bb4a27b
apply code review
trim21 Mar 9, 2025
243f882
Merge branch 'main' into feat/manager-pixi
trim21 Mar 9, 2025
c4fc3be
Merge branch 'feat/datasource/conda' into feat/manager-pixi
trim21 Mar 9, 2025
cc79108
Merge branch 'main' into conda-versioning
trim21 Mar 11, 2025
5fcc199
Merge branch 'main' into feat/datasource/conda
trim21 Mar 11, 2025
9639309
upgrade deps
trim21 Mar 12, 2025
0131fea
Merge branch 'main' into conda-versioning
trim21 Mar 12, 2025
8e9ecc8
Update lib/modules/datasource/conda/index.ts
trim21 Mar 12, 2025
f2d907c
Apply suggestions from code review
trim21 Mar 12, 2025
73a35d1
apply code review
trim21 Mar 12, 2025
ab47a4b
add urls
trim21 Mar 12, 2025
8dbd5ce
Merge branch 'main' into feat/datasource/conda
trim21 Mar 12, 2025
cb9c620
fix eslint
trim21 Mar 12, 2025
6dc435e
Merge branch 'main' into feat/manager-pixi
trim21 Mar 13, 2025
d5ccab2
Merge branch 'main' into conda-versioning
trim21 Mar 13, 2025
7e4983c
Merge branch 'feat/datasource/conda' into feat/manager-pixi
trim21 Mar 13, 2025
6598a56
fix type
trim21 Mar 13, 2025
4690ff5
Merge branch 'feat/datasource/conda' into feat/manager-pixi
trim21 Mar 13, 2025
9f02826
Merge remote-tracking branch 'upstream/main' into feat/datasource/conda
trim21 Mar 13, 2025
3b69af9
Merge remote-tracking branch 'upstream/main' into conda-versioning
trim21 Mar 13, 2025
2e2bd6a
Merge remote-tracking branch 'upstream/main' into feat/manager-pixi
trim21 Mar 13, 2025
424ef87
Merge branch 'conda-versioning' into feat/manager-pixi
trim21 Mar 13, 2025
9e695d8
apply code review
trim21 Mar 14, 2025
51e248d
Merge branch 'main' into feat/datasource/conda
trim21 Mar 14, 2025
8eb2f8e
Merge branch 'main' into conda-versioning
trim21 Mar 14, 2025
7b6af02
apply code review
trim21 Mar 14, 2025
addefe3
apply code review
trim21 Mar 14, 2025
275fdc9
Revert "apply code review"
trim21 Mar 14, 2025
d66f262
Reapply "apply code review"
trim21 Mar 14, 2025
93fc898
fix test
trim21 Mar 14, 2025
bd5bee7
Merge remote-tracking branch 'origin/conda-versioning' into feat/mana…
trim21 Mar 14, 2025
4522783
Merge remote-tracking branch 'origin/feat/datasource/conda' into feat…
trim21 Mar 14, 2025
7f6e29d
Merge remote-tracking branch 'upstream/main' into feat/manager-pixi
trim21 Mar 14, 2025
533054f
trigger ci
trim21 Mar 14, 2025
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
343 changes: 114 additions & 229 deletions lib/modules/datasource/conda/index.spec.ts
Original file line number Diff line number Diff line change
@@ -2,250 +2,135 @@ import { DateTime } from 'luxon';
import { getPkgReleases } from '..';
import { EXTERNAL_HOST_ERROR } from '../../../constants/error-messages';
import { datasource, defaultRegistryUrl } from './common';
import type { CondaPackage } from './types';
import { CondaDatasource } from './index';
import * as httpMock from '~test/http-mock';

const packageName = 'main/pytest';
const depUrl = `/${packageName}`;

const anacondaApiRes = `
{
"name": "pytest",
"id": "563802059c73330b8ae83d68",
"package_types": ["conda"],
"summary": "Simple and powerful testing with Python.",
"description": "The pytest framework makes it easy to write small tests, yet scales to",
"home": "None",
"public": true,
"owner": {
"company": "Anaconda, Inc.",
"location": "Austin, Texas",
"login": "anaconda",
"name": "Anaconda's internal mirroring channel",
"url": "",
"description": "The packages on this channel are covered by the Anaconda repository Terms of Service. Among other things, the ToS prohibits heavy commercial use and mirroring by any third party for commercial purposes.",
"created_at": "2015-09-18 21:41:59.933000+00:00",
"user_type": "org"
const anacondaApiRes: CondaPackage = {
name: 'pytest',
id: '563802059c73330b8ae83d68',
package_types: ['conda'],
summary: 'Simple and powerful testing with Python.',
description:
'The pytest framework makes it easy to write small tests, yet scales to',
home: 'None',
public: true,
owner: {
company: 'Anaconda, Inc.',
location: 'Austin, Texas',
login: 'anaconda',
name: "Anaconda's internal mirroring channel",
url: '',
description:
'The packages on this channel are covered by the Anaconda repository Terms of Service. Among other things, the ToS prohibits heavy commercial use and mirroring by any third party for commercial purposes.',
created_at: '2015-09-18 21:41:59.933000+00:00',
user_type: 'org',
},
"full_name": "anaconda/pytest",
"url": "http://api.anaconda.org/packages/anaconda/pytest",
"html_url": "http://anaconda.org/anaconda/pytest",
"versions": ["3.3.0", "3.7.2", "3.10.0", "3.10.1", "8.3.4"],
"latest_version": "8.3.4",
"platforms": {
"linux-ppc64le": "7.4.0",
"osx-arm64": "8.3.4",
"linux-64": "8.3.4",
"win-32": "7.1.2",
"linux-aarch64": "8.3.4",
"linux-s390x": "8.3.4",
"osx-64": "8.3.4",
"linux-32": "4.0.2",
"win-64": "8.3.4"
},
"conda_platforms": [
"win-64",
"linux-aarch64",
"linux-64",
"linux-32",
"linux-ppc64le",
"linux-s390x",
"osx-arm64",
"win-32",
"osx-64"
full_name: 'anaconda/pytest',
url: 'http://api.anaconda.org/packages/anaconda/pytest',
html_url: 'http://anaconda.org/anaconda/pytest',
versions: ['3.3.0', '3.7.2', '3.10.0', '3.10.1', '8.3.4'],
latest_version: '8.3.4',
conda_platforms: [
'win-64',
'linux-aarch64',
'linux-64',
'linux-32',
'linux-ppc64le',
'linux-s390x',
'osx-arm64',
'win-32',
'osx-64',
],
"revision": 3438,
"license": "MIT",
"license_url": null,
"dev_url": "https://github.com/pytest-dev/pytest/",
"doc_url": "https://docs.pytest.org",
"source_git_url": null,
"source_git_tag": null,
"app_entry": {},
"app_type": {},
"app_summary": {},
"builds": [],
"releases": [],
"watchers": 1,
"upvoted": 0,
"created_at": "2015-11-03 00:38:29.074000+00:00",
"modified_at": "2025-02-07 15:05:02.800000+00:00",
"files": [
revision: 3438,
license: 'MIT',
dev_url: 'https://github.com/pytest-dev/pytest/',
doc_url: 'https://docs.pytest.org',
app_entry: {},
app_type: {},
app_summary: {},
builds: [],
releases: [],
watchers: 1,
upvoted: 0,
created_at: '2015-11-03 00:38:29.074000+00:00',
modified_at: '2025-02-07 15:05:02.800000+00:00',
files: [
{
"description": null,
"dependencies": [],
"distribution_type": "conda",
"basename": "linux-32/pytest-3.3.0-py27hb8c8e07_0.tar.bz2",
"attrs": {
"size": 278751,
"subdir": "linux-32",
"build_number": 0,
"name": "pytest",
"license": "MIT",
"timestamp": 1511930912651,
"source_url": "http://repo.continuum.io/pkgs/main/linux-32/pytest-3.3.0-py27hb8c8e07_0.tar.bz2",
"platform": "linux",
"depends": [
"attrs >=17.2.0",
"funcsigs",
"pluggy >=0.5,<0.7",
"py >=1.5.0",
"python >=2.7,<2.8.0a0",
"setuptools",
"six >=1.10.0"
],
"version": "3.3.0",
"build": "py27hb8c8e07_0",
"sha256": "d8cd7575fb3a20eda30316ef70b190fb27ceb46dd88e67d63802b260a21dfdcc",
"arch": "x86",
"md5": "de4bf7793ec65a71742ca219622c9b06"
},
"upload_time": "2020-02-28 11:46:08.898000+00:00",
"md5": "de4bf7793ec65a71742ca219622c9b06",
"sha256": "None",
"size": 278751,
"full_name": "anaconda/pytest/3.3.0/linux-32/pytest-3.3.0-py27hb8c8e07_0.tar.bz2",
"download_url": "//api.anaconda.org/download/anaconda/pytest/3.3.0/linux-32/pytest-3.3.0-py27hb8c8e07_0.tar.bz2",
"type": "conda",
"version": "3.3.0",
"ndownloads": 22,
"owner": "anaconda",
"labels": ["main"]
description: null,
dependencies: [],
distribution_type: 'conda',
basename: 'linux-32/pytest-3.3.0-py27hb8c8e07_0.tar.bz2',
upload_time: '2020-02-28 11:46:08.898000+00:00',
md5: 'de4bf7793ec65a71742ca219622c9b06',
size: 278751,
full_name:
'anaconda/pytest/3.3.0/linux-32/pytest-3.3.0-py27hb8c8e07_0.tar.bz2',
download_url:
'//api.anaconda.org/download/anaconda/pytest/3.3.0/linux-32/pytest-3.3.0-py27hb8c8e07_0.tar.bz2',
type: 'conda',
version: '3.3.0',
ndownloads: 22,
owner: 'anaconda',
labels: ['main'],
},
{
"description": null,
"dependencies": [],
"distribution_type": "conda",
"basename": "linux-32/pytest-3.7.2-py27_0.tar.bz2",
"attrs": {
"size": 306933,
"subdir": "linux-32",
"build_number": 0,
"name": "pytest",
"license": "MIT",
"timestamp": 1534944845820,
"source_url": "http://repo.continuum.io/pkgs/main/linux-32/pytest-3.7.2-py27_0.tar.bz2",
"platform": "linux",
"depends": [
"atomicwrites >=1.0",
"attrs >=17.4.0",
"funcsigs",
"more-itertools >=4.0",
"pathlib2",
"pluggy >=0.7",
"py >=1.5.0",
"python >=2.7,<2.8.0a0",
"setuptools",
"six >=1.10.0"
],
"version": "3.7.2",
"build": "py27_0",
"sha256": "6588f30cf3979407632145be7da55b0de98275a42b92c8ba5d73908be6503af0",
"arch": "x86",
"md5": "5a446c3abbb13fc5d287f02f2e4634fe"
},
"upload_time": "2020-02-28 11:46:33.245000+00:00",
"md5": "5a446c3abbb13fc5d287f02f2e4634fe",
"sha256": "None",
"size": 306933,
"full_name": "anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py27_0.tar.bz2",
"download_url": "//api.anaconda.org/download/anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py27_0.tar.bz2",
"type": "conda",
"version": "3.7.2",
"ndownloads": 21,
"owner": "anaconda",
"labels": ["main"]
description: null,
dependencies: [],
distribution_type: 'conda',
basename: 'linux-32/pytest-3.7.2-py27_0.tar.bz2',
upload_time: '2020-02-28 11:46:33.245000+00:00',
md5: '5a446c3abbb13fc5d287f02f2e4634fe',
size: 306933,
full_name: 'anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py27_0.tar.bz2',
download_url:
'//api.anaconda.org/download/anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py27_0.tar.bz2',
type: 'conda',
version: '3.7.2',
ndownloads: 21,
owner: 'anaconda',
labels: ['main'],
},
{
"description": null,
"dependencies": [],
"distribution_type": "conda",
"basename": "linux-32/pytest-3.7.2-py35_0.tar.bz2",
"attrs": {
"size": 317011,
"subdir": "linux-32",
"build_number": 0,
"name": "pytest",
"license": "MIT",
"timestamp": 1534944859986,
"source_url": "http://repo.continuum.io/pkgs/main/linux-32/pytest-3.7.2-py35_0.tar.bz2",
"platform": "linux",
"depends": [
"atomicwrites >=1.0",
"attrs >=17.4.0",
"more-itertools >=4.0",
"pathlib2",
"pluggy >=0.7",
"py >=1.5.0",
"python >=3.5,<3.6.0a0",
"setuptools",
"six >=1.10.0"
],
"version": "3.7.2",
"build": "py35_0",
"sha256": "4b9ce0265bd1e2462f5cfa8057dd81a1aee2461bc4dd93df4c3f5a5e41ea9345",
"arch": "x86",
"md5": "20f13818ca90d8fbdcf43a821be921cd"
},
"upload_time": "2020-02-28 11:46:33.924000+00:00",
"md5": "20f13818ca90d8fbdcf43a821be921cd",
"sha256": "None",
"size": 317011,
"full_name": "anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py35_0.tar.bz2",
"download_url": "//api.anaconda.org/download/anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py35_0.tar.bz2",
"type": "conda",
"version": "3.7.2",
"ndownloads": 22,
"owner": "anaconda",
"labels": ["main"]
description: null,
dependencies: [],
distribution_type: 'conda',
basename: 'linux-32/pytest-3.7.2-py35_0.tar.bz2',
upload_time: '2020-02-28 11:46:33.924000+00:00',
md5: '20f13818ca90d8fbdcf43a821be921cd',
size: 317011,
full_name: 'anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py35_0.tar.bz2',
download_url:
'//api.anaconda.org/download/anaconda/pytest/3.7.2/linux-32/pytest-3.7.2-py35_0.tar.bz2',
type: 'conda',
version: '3.7.2',
ndownloads: 22,
owner: 'anaconda',
labels: ['main'],
},
{
"description": null,
"dependencies": [],
"distribution_type": "conda",
"basename": "win-64/pytest-8.3.4-py39haa95532_0.tar.bz2",
"attrs": {
"build": "py39haa95532_0",
"build_number": 0,
"constrains": ["pytest-faulthandler >=2"],
"depends": [
"colorama",
"exceptiongroup >=1.0.0",
"iniconfig",
"packaging",
"pluggy <2,>=1.5",
"python >=3.9,<3.10.0a0",
"tomli >=1"
],
"license": "MIT",
"license_family": "MIT",
"md5": "c88e9fb72dc2641e00a97ce2bbe0a27b",
"name": "pytest",
"sha256": "81375997767160409bb65282e4b5b669f07f704b33c87a3f2b52533021204af2",
"size": 1108312,
"subdir": "win-64",
"timestamp": 1738939219838,
"version": "8.3.4",
"source_url": "http://repo.continuum.io/pkgs/main/win-64/pytest-8.3.4-py39haa95532_0.tar.bz2",
"platform": "win",
"arch": "x86_64"
},
"upload_time": "2025-02-07 15:05:00.099000+00:00",
"md5": "c88e9fb72dc2641e00a97ce2bbe0a27b",
"sha256": "81375997767160409bb65282e4b5b669f07f704b33c87a3f2b52533021204af2",
"size": 1108312,
"full_name": "anaconda/pytest/8.3.4/win-64/pytest-8.3.4-py39haa95532_0.tar.bz2",
"download_url": "//api.anaconda.org/download/anaconda/pytest/8.3.4/win-64/pytest-8.3.4-py39haa95532_0.tar.bz2",
"type": "conda",
"version": "8.3.4",
"ndownloads": 143,
"owner": "anaconda",
"labels": ["main"]
}
]
}

`;
description: null,
dependencies: [],
distribution_type: 'conda',
basename: 'win-64/pytest-8.3.4-py39haa95532_0.tar.bz2',
upload_time: '2025-02-07 15:05:00.099000+00:00',
md5: 'c88e9fb72dc2641e00a97ce2bbe0a27b',
size: 1108312,
full_name:
'anaconda/pytest/8.3.4/win-64/pytest-8.3.4-py39haa95532_0.tar.bz2',
download_url:
'//api.anaconda.org/download/anaconda/pytest/8.3.4/win-64/pytest-8.3.4-py39haa95532_0.tar.bz2',
type: 'conda',
version: '8.3.4',
ndownloads: 143,
owner: 'anaconda',
labels: ['main'],
},
],
};

describe('modules/datasource/conda/index', () => {
describe('getReleases', () => {
48 changes: 10 additions & 38 deletions lib/modules/datasource/conda/prefix-dev.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
import is from '@sindresorhus/is';
import { z } from 'zod';
import { logger } from '../../../logger';
import { isNotNullOrUndefined } from '../../../util/array';
import type { Http } from '../../../util/http';
import type { Timestamp } from '../../../util/timestamp';
import { MaybeTimestamp } from '../../../util/timestamp';
import type { ReleaseResult } from '../types';
import { type File, PagedResponseSchema } from './schema/prefix-dev';

const MAX_PREFIX_DEV_GRAPHQL_PAGE = 100;

const File = z.object({
version: z.string(),
createdAt: z.string().nullable(),
yankedReason: z.string().nullable(),
urls: z
.array(z.object({ url: z.string(), kind: z.string() }))
.optional()
.default([])
.transform((urls) => {
return Object.fromEntries(urls.map((url) => [url.kind, url.url]));
}),
});

const query = `
query search($channel: String!, $package: String!, $page: Int = 0) {
package(channelName: $channel, name: $package) {
@@ -41,21 +28,6 @@ query search($channel: String!, $package: String!, $page: Int = 0) {
}
`;

const PagedResponseSchema = z.object({
data: z.object({
package: z
.object({
variants: z
.object({
pages: z.number(),
page: z.array(File),
})
.nullable(),
})
.nullable(),
}),
});

export async function getReleases(
http: Http,
channel: string,
@@ -71,15 +43,19 @@ export async function getReleases(
package: packageName,
});

if (!files.length) {
return null;
}

const releaseDate: Record<string, Timestamp> = {};
const yanked: Record<string, boolean> = {};
const versions = new Set<string>();
const versions: Record<string, boolean> = {};

let homepage: string | undefined = undefined;
let sourceUrl: string | undefined = undefined;

for (const file of files) {
versions.add(file.version);
versions[file.version] = true;
yanked[file.version] = Boolean(
isNotNullOrUndefined(file.yankedReason) || yanked[file.version],
);
@@ -103,14 +79,10 @@ export async function getReleases(
}
}

if (!versions.size) {
return null;
}

return {
homepage,
sourceUrl,
releases: Array.from(versions).map((version) => {
releases: Object.keys(versions).map((version) => {
return {
version,
releaseDate: releaseDate[version],
@@ -124,8 +96,8 @@ async function getPagedResponse(
http: Http,
query: string,
data: any,
): Promise<z.infer<typeof File>[]> {
const result: z.infer<typeof File>[] = [];
): Promise<File[]> {
const result: File[] = [];

for (let page = 0; page <= MAX_PREFIX_DEV_GRAPHQL_PAGE; page++) {
const res = await http.postJson(
31 changes: 31 additions & 0 deletions lib/modules/datasource/conda/schema/prefix-dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { z } from 'zod';

export const File = z.object({
version: z.string(),
createdAt: z.string().nullable(),
yankedReason: z.string().nullable(),
urls: z
.array(z.object({ url: z.string(), kind: z.string() }))
.optional()
.default([])
.transform((urls) => {
return Object.fromEntries(urls.map((url) => [url.kind, url.url]));
}),
});

export type File = z.infer<typeof File>;

export const PagedResponseSchema = z.object({
data: z.object({
package: z
.object({
variants: z
.object({
pages: z.number(),
page: z.array(File),
})
.nullable(),
})
.nullable(),
}),
});
21 changes: 1 addition & 20 deletions lib/modules/datasource/conda/types.ts
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@ export interface CondaPackage {
full_name: string;
owner: CondaPackageOwner;
home: string;
source_git_url: string;
source_git_tag: string;
app_type: Record<string, unknown>;
upvoted: number;
id: string;
@@ -36,7 +34,6 @@ export interface CondaPackage {
modified_at: string;
latest_version: CondaVersion;
summary: string;
license_url: string;
doc_url: string;
}

@@ -58,7 +55,7 @@ export interface CondaRelease {
}

export interface CondaFile {
description: string;
description?: string | null;
basename: string;
labels: string[];
dependencies: string[];
@@ -72,20 +69,4 @@ export interface CondaFile {
version: CondaVersion;
md5: string;
type: string;
attrs: {
build_number: number;
name?: string;
license: string;
timestamp?: number;
source_url?: string;
platform: string;
depends: string[];
version?: CondaVersion;
subdir: string;
build: string;
sha256?: string;
arch: string;
md5?: string;
size?: number;
};
}