From 4b904277c35cf7bf371e23e0b6603268f48683e4 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 17 Oct 2024 15:44:24 +0200 Subject: [PATCH 01/20] WIP --- conda_smithy/configure_feedstock.py | 30 +++++++++++++++++++-------- conda_smithy/schema.py | 11 +++++----- conda_smithy/templates/pixi.toml.tmpl | 12 +++++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 conda_smithy/templates/pixi.toml.tmpl diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 689f37d1f..5968ee037 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -12,6 +12,7 @@ import warnings from collections import Counter, OrderedDict, namedtuple from copy import deepcopy +from datetime import datetime from functools import lru_cache from itertools import chain, product from os import fspath @@ -1495,6 +1496,7 @@ def _travis_specific_setup(jinja_env, forge_config, forge_dir, platform): def _render_template_exe_files( forge_config, jinja_env, template_files, forge_dir ): + breakpoint() for template_file in template_files: template = jinja_env.get_template( os.path.basename(template_file) + ".tmpl" @@ -2177,6 +2179,14 @@ def render_github_actions_services(jinja_env, forge_config, forge_dir): fh.write(new_file_contents) +def render_pixi(jinja_env, forge_config, forge_dir): + template = jinja_env.get_template("pixi.toml.tmpl") + target_fname = os.path.join(forge_dir, "pixi.toml") + new_file_contents = template.render(**forge_config) + with write_file(target_fname) as fh: + fh.write(new_file_contents) + + def copy_feedstock_content(forge_config, forge_dir): feedstock_content = os.path.join(conda_forge_content, "feedstock_content") skip_files = _get_skip_files(forge_config) @@ -2763,7 +2773,7 @@ def main( config = _load_forge_config(forge_dir, exclusive_config_file, forge_yml) config["feedstock_name"] = os.path.basename(forge_dir) - + config["render_time"] = datetime.now() env = make_jinja_env(forge_dir) logger.debug("env rendered") @@ -2783,42 +2793,44 @@ def main( render_info.append( render_circle(env, config, forge_dir, return_metadata=True) ) - logger.debug("circle rendered") + render_info.append( render_travis(env, config, forge_dir, return_metadata=True) ) - logger.debug("travis rendered") + render_info.append( render_appveyor(env, config, forge_dir, return_metadata=True) ) - logger.debug("appveyor rendered") + render_info.append( render_azure(env, config, forge_dir, return_metadata=True) ) - logger.debug("azure rendered") + render_info.append( render_drone(env, config, forge_dir, return_metadata=True) ) - logger.debug("drone rendered") + render_info.append( render_woodpecker(env, config, forge_dir, return_metadata=True) ) - logger.debug("woodpecker rendered") + render_info.append( render_github_actions(env, config, forge_dir, return_metadata=True) ) - logger.debug("github_actions rendered") - render_github_actions_services(env, config, forge_dir) + render_github_actions_services(env, config, forge_dir) logger.debug("github_actions services rendered") + render_pixi(env, config, forge_dir) + logger.debug("pixi config rendered") + # put azure first just in case azure_ind = ([ri["provider_name"] for ri in render_info]).index("azure") tmp = render_info[0] diff --git a/conda_smithy/schema.py b/conda_smithy/schema.py index d6415bb7d..20d8a6fc3 100644 --- a/conda_smithy/schema.py +++ b/conda_smithy/schema.py @@ -626,7 +626,7 @@ class ConfigModel(BaseModel): ), ) - conda_install_tool: Optional[Literal["conda", "mamba", "micromamba"]] = ( + conda_install_tool: Optional[Literal["conda", "mamba", "micromamba", "pixi"]] = ( Field( default="micromamba", description=cleandoc( @@ -635,12 +635,13 @@ class ConfigModel(BaseModel): feedstock. Defaults to micromamba. If conda or mamba are chosen, the latest Miniforge will be used to - provision the base environment. If micromamba is chosen, Miniforge - is not involved; the environment is created directly by micromamba. + provision the base environment. If micromamba or pixi are chosen, + Miniforge is not involved; the environment is created directly by + micromamba or pixi. - Note: micromamba is only used on macOS and Windows for now. + Note: micromamba and pixi are only used on macOS and Windows for now. On Linux, mamba (as provided in the Docker images) will still be used - even if micromamba is chosen. + even if micromamba or pixi are chosen. """ ), ) diff --git a/conda_smithy/templates/pixi.toml.tmpl b/conda_smithy/templates/pixi.toml.tmpl new file mode 100644 index 000000000..df1d97ccc --- /dev/null +++ b/conda_smithy/templates/pixi.toml.tmpl @@ -0,0 +1,12 @@ +# This file was generated automatically from conda-smithy. To update this configuration, +# update the conda-forge.yml and/or the recipe/meta.yaml. +# -*- mode: yaml -*- + +[project] +name = "{{ feedstock_name }}" +version = "{{ render_time.strftime('%Y.%m.%d.%H.%M.%S')}}" +description = "Pixi configuration for the {{ feedstock_name }} feedstock" +authors = ["@conda-forge/{{ feedstock_name }}"] +channels = ["conda-forge"] +platforms = ["linux-64", "win-64", "osx-arm64", "osx-64]" + From 242d69cfd3b0b7f58bcf5fbee2878c5a179630f4 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 01:30:30 +0200 Subject: [PATCH 02/20] add pixi.toml template --- conda_smithy/configure_feedstock.py | 20 ++++++++--- conda_smithy/templates/pixi.toml.tmpl | 52 ++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 5968ee037..1a859a2e0 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -12,7 +12,6 @@ import warnings from collections import Counter, OrderedDict, namedtuple from copy import deepcopy -from datetime import datetime from functools import lru_cache from itertools import chain, product from os import fspath @@ -1496,7 +1495,6 @@ def _travis_specific_setup(jinja_env, forge_config, forge_dir, platform): def _render_template_exe_files( forge_config, jinja_env, template_files, forge_dir ): - breakpoint() for template_file in template_files: template = jinja_env.get_template( os.path.basename(template_file) + ".tmpl" @@ -2182,7 +2180,16 @@ def render_github_actions_services(jinja_env, forge_config, forge_dir): def render_pixi(jinja_env, forge_config, forge_dir): template = jinja_env.get_template("pixi.toml.tmpl") target_fname = os.path.join(forge_dir, "pixi.toml") - new_file_contents = template.render(**forge_config) + ci_support_path = os.path.join(forge_dir, ".ci_support") + variants = [] + if os.path.exists(ci_support_path): + for filename in os.listdir(ci_support_path): + if filename.endswith(".yaml"): + variant_name, _ = os.path.splitext(filename) + variants.append(variant_name) + new_file_contents = template.render( + smithy_version=__version__, variants=variants, **forge_config + ) with write_file(target_fname) as fh: fh.write(new_file_contents) @@ -2414,6 +2421,10 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): else: config["remote_ci_setup_update"] = config["remote_ci_setup"] + _build_tools_deps = config["conda_build_tool_deps"].split() + config["remote_ci_setup"] + _build_tools_deps = MatchSpec.merge([dep.strip("\"'") for dep in _build_tools_deps]) + config["build_tool_deps_dict"] = {spec.name: str(spec.version) for spec in _build_tools_deps} + if not config["github_actions"]["triggers"]: self_hosted = config["github_actions"]["self_hosted"] config["github_actions"]["triggers"] = ( @@ -2771,9 +2782,8 @@ def main( ) config = _load_forge_config(forge_dir, exclusive_config_file, forge_yml) - config["feedstock_name"] = os.path.basename(forge_dir) - config["render_time"] = datetime.now() + env = make_jinja_env(forge_dir) logger.debug("env rendered") diff --git a/conda_smithy/templates/pixi.toml.tmpl b/conda_smithy/templates/pixi.toml.tmpl index df1d97ccc..a199a9a0e 100644 --- a/conda_smithy/templates/pixi.toml.tmpl +++ b/conda_smithy/templates/pixi.toml.tmpl @@ -4,9 +4,53 @@ [project] name = "{{ feedstock_name }}" -version = "{{ render_time.strftime('%Y.%m.%d.%H.%M.%S')}}" -description = "Pixi configuration for the {{ feedstock_name }} feedstock" -authors = ["@conda-forge/{{ feedstock_name }}"] +version = "{{ smithy_version }}" +description = "Pixi configuration for conda-forge/{{ feedstock_name }}" +authors = ["@conda-forge/{{ feedstock_name[:-11] }}"] channels = ["conda-forge"] -platforms = ["linux-64", "win-64", "osx-arm64", "osx-64]" +platforms = [ +{%- for platform, service in provider.items() %} +{%- if service %} + "{{ platform.replace('_', '-') }}", +{%- endif %} +{%- endfor %} +] +[dependencies] +{%- for spec_name, spec_constraints in build_tool_deps_dict.items() %} +{{ spec_name }} = "{{ spec_constraints }}" +{%- endfor %} +{%- if local_ci_setup %} + +[pypi-dependencies] +conda_forge_ci_setup = { path = "./" } +{%- endif %} + +[tasks] +inspect-all = "inspect_artifacts --all-packages" +{%- if conda_build_tool != "rattler-build" %} +build = "{{ conda_build_tool }} build {{ recipe_dir }}" +debug = "{{ conda_build_tool }} build {{ recipe_dir }}" +{%- else %} +build = "{{ conda_build_tool }} build --recipe {{ recipe_dir }}" +{%- endif %} +{%- for variant in variants %} +{%- if conda_build_tool != "rattler-build" %} +build-{{ variant }} = "{{ conda_build_tool }} build {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml --suppress-variables --clobber-file .ci_support/clobber_{{ variant }}.yaml" +debug-{{ variant }} = "{{ conda_build_tool }} debug {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" +{%- else %} +build-{{ variant }} = "{{ conda_build_tool }} build --recipe {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" +{%- endif %} +inspect-{{ variant }} = "inspect_artifacts --recipe-dir {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" +{%- endfor %} + +[feature.smithy.dependencies] +conda-smithy = "*" + +[feature.smithy.tasks] +smithy = "conda-smithy" +rerender = "conda-smithy rerender" +lint = "conda-smithy lint {{ recipe_dir}}" + +[environments] +smithy = ["smithy"] From b8beb2213a805e9432c3945d0066d38bde909b82 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 01:30:36 +0200 Subject: [PATCH 03/20] add osx --- conda_smithy/templates/run_osx_build.sh.tmpl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index 9fbc2f612..b73767420 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -32,6 +32,12 @@ mv "${MAMBA_ROOT_PREFIX}/pkgs" "${MINIFORGE_HOME}" echo "Cleaning up micromamba" rm -rf "${MAMBA_ROOT_PREFIX}" "${micromamba_exe}" || true ( endgroup "Provisioning base env with micromamba" ) 2> /dev/null +{%- elif conda_install_tool == "pixi" %} +( startgroup "Provisioning base env with pixi" ) 2> /dev/null +curl -fsSL https://pixi.sh/install.sh | bash +export PATH="~/.pixi/bin:$PATH" +pixi install +( endgroup "Provisioning base env with pixi" ) 2> /dev/null {%- else %} ( startgroup "Installing a fresh version of Miniforge" ) 2> /dev/null @@ -57,8 +63,12 @@ bash "${MINIFORGE_FILE}" -b -p "${MINIFORGE_HOME}" {%- set BUILD_CMD="conda-build" %} {%- endif %} +{%- if conda_install_tool == "pixi" %} +eval "$(pixi shell-hook)" +{%- else %} source "${MINIFORGE_HOME}/etc/profile.d/conda.sh" conda activate base +{%- endif %} {%- if conda_solver %} export CONDA_SOLVER="{{ conda_solver }}" {%- endif %} @@ -71,7 +81,7 @@ export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- endif %} -{% if local_ci_setup %} +{% if conda_install_tool != "pixi" and local_ci_setup %} conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }} pip install --no-deps {{ recipe_dir }}/. {%- endif %} From 1322f584f1dfefc41b5078640c487ac731649d7c Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 01:36:23 +0200 Subject: [PATCH 04/20] add windows --- conda_smithy/templates/run_win_build.bat.tmpl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/conda_smithy/templates/run_win_build.bat.tmpl b/conda_smithy/templates/run_win_build.bat.tmpl index d0f466ca8..591f1eccc 100644 --- a/conda_smithy/templates/run_win_build.bat.tmpl +++ b/conda_smithy/templates/run_win_build.bat.tmpl @@ -40,6 +40,15 @@ if !errorlevel! neq 0 exit /b !errorlevel! echo Removing %MAMBA_ROOT_PREFIX% del /S /Q "%MAMBA_ROOT_PREFIX%" del /S /Q "%MICROMAMBA_TMPDIR%" +{%- elif conda_install_tool == "pixi" %} +call :start_group "Provisioning base env with pixi" +echo Installing pixi +powershell -NoProfile -ExecutionPolicy unrestricted -Command "iwr -useb https://pixi.sh/install.ps1 | iex" +if !errorlevel! neq 0 exit /b !errorlevel! +set "PATH=%USERPROFILE%\.pixi\bin;%PATH%" +echo Installing environment +pixi install +if !errorlevel! neq 0 exit /b !errorlevel! call :end_group {%- else %} call :start_group "Installing a fresh version of Miniforge" @@ -56,7 +65,13 @@ call :end_group call :start_group "Configuring conda" :: Activate the base conda environment +{%- if conda_install_tool == "pixi" %} +set "ACTIVATE_PIXI=%TMP%\pixi-activate-%RANDOM%.bat" +pixi shell-hook > %ACTIVATE_PIXI% +call %ACTIVATE_PIXI% +{%- else %} call "%MINIFORGE_HOME%\Scripts\activate.bat" +{%- endif %} {%- if conda_solver %} :: Configure the solver @@ -74,7 +89,7 @@ echo Installing dependencies if !errorlevel! neq 0 exit /b !errorlevel! {%- endif %} -{%- if local_ci_setup %} +{%- if conda_install_tool != "pixi" and local_ci_setup %} echo Overriding conda-forge-ci-setup with local version conda.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }} if !errorlevel! neq 0 exit /b !errorlevel! From 32dd1f2336b9704b076f8b24af1eeecb1c19bf18 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 01:36:33 +0200 Subject: [PATCH 05/20] add news --- news/2099-pixi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 news/2099-pixi diff --git a/news/2099-pixi b/news/2099-pixi new file mode 100644 index 000000000..4ac61962f --- /dev/null +++ b/news/2099-pixi @@ -0,0 +1,24 @@ +**Added:** + +* Added ``pixi`` as valid ``conda_install_tool`` option. + Includes several preconfigured tasks like ``build``, ``debug``, ``rerender``, or ``lint``. (#2099) + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From f04e3673c73378bd459142973cfbf7ab6ee919f1 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 02:01:21 +0200 Subject: [PATCH 06/20] add linux --- conda_smithy/templates/build_steps.sh.tmpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index aa5fb904b..39e99051d 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -40,6 +40,11 @@ echo > /opt/conda/conda-meta/history micromamba install --root-prefix ~/.conda --prefix /opt/conda \ --yes --override-channels --channel conda-forge --strict-channel-priority \ pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} +{%- elif conda_install_tool == "pixi" %} +curl -fsSL https://pixi.sh/install.sh | bash +export PATH="~/.pixi/bin:$PATH" +pixi install --manifest-path "${FEEDSTOCK_ROOT}/pixi.toml" +eval "$(pixi shell-hook --manifest-path "${FEEDSTOCK_ROOT}/pixi.toml")" {%- endif %} {%- if conda_build_tool == "mambabuild" %} @@ -64,7 +69,7 @@ export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 {{ conda_install_tool }} update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup_update) }} {%- endif %} -{% if local_ci_setup %} +{% if conda_install_tool != "pixi" and local_ci_setup %} conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup)}} pip install --no-deps ${RECIPE_ROOT}/. {%- endif %} From 4aac280e7145e6edae5568e3fe6dfb9c4b339e5e Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 02:01:28 +0200 Subject: [PATCH 07/20] expose build-locally --- conda_smithy/templates/pixi.toml.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/conda_smithy/templates/pixi.toml.tmpl b/conda_smithy/templates/pixi.toml.tmpl index a199a9a0e..436e05a2a 100644 --- a/conda_smithy/templates/pixi.toml.tmpl +++ b/conda_smithy/templates/pixi.toml.tmpl @@ -48,6 +48,7 @@ inspect-{{ variant }} = "inspect_artifacts --recipe-dir {{ recipe_dir }} -m .ci_ conda-smithy = "*" [feature.smithy.tasks] +build-locally = "python ./build-locally.py" smithy = "conda-smithy" rerender = "conda-smithy rerender" lint = "conda-smithy lint {{ recipe_dir}}" From dc82f3072dfd4e78ce349b6b6dde1cc9915b6dcf Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 02:01:50 +0200 Subject: [PATCH 08/20] pre-commit --- conda_smithy/configure_feedstock.py | 12 +++++++++--- conda_smithy/schema.py | 14 +++++++------- conda_smithy/templates/build_steps.sh.tmpl | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 1a859a2e0..c4a8aeb8f 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -2421,9 +2421,15 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): else: config["remote_ci_setup_update"] = config["remote_ci_setup"] - _build_tools_deps = config["conda_build_tool_deps"].split() + config["remote_ci_setup"] - _build_tools_deps = MatchSpec.merge([dep.strip("\"'") for dep in _build_tools_deps]) - config["build_tool_deps_dict"] = {spec.name: str(spec.version) for spec in _build_tools_deps} + _build_tools_deps = ( + config["conda_build_tool_deps"].split() + config["remote_ci_setup"] + ) + _build_tools_deps = MatchSpec.merge( + [dep.strip("\"'") for dep in _build_tools_deps] + ) + config["build_tool_deps_dict"] = { + spec.name: str(spec.version) for spec in _build_tools_deps + } if not config["github_actions"]["triggers"]: self_hosted = config["github_actions"]["self_hosted"] diff --git a/conda_smithy/schema.py b/conda_smithy/schema.py index f074133df..1e2bdf523 100644 --- a/conda_smithy/schema.py +++ b/conda_smithy/schema.py @@ -626,11 +626,12 @@ class ConfigModel(BaseModel): ), ) - conda_install_tool: Optional[Literal["conda", "mamba", "micromamba", "pixi"]] = ( - Field( - default="micromamba", - description=cleandoc( - """ + conda_install_tool: Optional[ + Literal["conda", "mamba", "micromamba", "pixi"] + ] = Field( + default="micromamba", + description=cleandoc( + """ Use this option to choose which tool is used to provision the tooling in your feedstock. Defaults to micromamba. @@ -639,8 +640,7 @@ class ConfigModel(BaseModel): Miniforge is not involved; the environment is created directly by micromamba or pixi. """ - ), - ) + ), ) conda_forge_output_validation: Optional[bool] = Field( diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index 39e99051d..1a1f31248 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -43,7 +43,7 @@ micromamba install --root-prefix ~/.conda --prefix /opt/conda \ {%- elif conda_install_tool == "pixi" %} curl -fsSL https://pixi.sh/install.sh | bash export PATH="~/.pixi/bin:$PATH" -pixi install --manifest-path "${FEEDSTOCK_ROOT}/pixi.toml" +pixi install --manifest-path "${FEEDSTOCK_ROOT}/pixi.toml" eval "$(pixi shell-hook --manifest-path "${FEEDSTOCK_ROOT}/pixi.toml")" {%- endif %} From f84663e10bfcc77a8eef83a6435f59138559daa9 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 11:05:11 +0200 Subject: [PATCH 09/20] reuse /opt/conda cache --- conda_smithy/templates/build_steps.sh.tmpl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index 1a1f31248..9c87be9bd 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -43,8 +43,13 @@ micromamba install --root-prefix ~/.conda --prefix /opt/conda \ {%- elif conda_install_tool == "pixi" %} curl -fsSL https://pixi.sh/install.sh | bash export PATH="~/.pixi/bin:$PATH" -pixi install --manifest-path "${FEEDSTOCK_ROOT}/pixi.toml" -eval "$(pixi shell-hook --manifest-path "${FEEDSTOCK_ROOT}/pixi.toml")" +pushd "${FEEDSTOCK_ROOT}" +ln -s /opt/conda/pkgs/cache /opt/conda/repodata +echo "Creating environment" +PIXI_CACHE_DIR=/opt/conda pixi install +pixi list +echo "Activating environment" +eval "$(pixi shell-hook)" {%- endif %} {%- if conda_build_tool == "mambabuild" %} From 7a1247f6c81cb235c7e74c93e477ac7b0ff726ed Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 11:05:18 +0200 Subject: [PATCH 10/20] pixi list --- conda_smithy/templates/run_osx_build.sh.tmpl | 1 + conda_smithy/templates/run_win_build.bat.tmpl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index b73767420..ae69c31b2 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -37,6 +37,7 @@ rm -rf "${MAMBA_ROOT_PREFIX}" "${micromamba_exe}" || true curl -fsSL https://pixi.sh/install.sh | bash export PATH="~/.pixi/bin:$PATH" pixi install +pixi list ( endgroup "Provisioning base env with pixi" ) 2> /dev/null {%- else %} ( startgroup "Installing a fresh version of Miniforge" ) 2> /dev/null diff --git a/conda_smithy/templates/run_win_build.bat.tmpl b/conda_smithy/templates/run_win_build.bat.tmpl index 591f1eccc..871c32e2f 100644 --- a/conda_smithy/templates/run_win_build.bat.tmpl +++ b/conda_smithy/templates/run_win_build.bat.tmpl @@ -49,6 +49,8 @@ set "PATH=%USERPROFILE%\.pixi\bin;%PATH%" echo Installing environment pixi install if !errorlevel! neq 0 exit /b !errorlevel! +pixi list +if !errorlevel! neq 0 exit /b !errorlevel! call :end_group {%- else %} call :start_group "Installing a fresh version of Miniforge" @@ -65,6 +67,7 @@ call :end_group call :start_group "Configuring conda" :: Activate the base conda environment +echo Activating environment {%- if conda_install_tool == "pixi" %} set "ACTIVATE_PIXI=%TMP%\pixi-activate-%RANDOM%.bat" pixi shell-hook > %ACTIVATE_PIXI% From eec4b81e90b6e24339a43049c38465a9e677d577 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 13:06:20 +0200 Subject: [PATCH 11/20] patch platforms --- conda_smithy/configure_feedstock.py | 10 +++++++++- conda_smithy/templates/build_steps.sh.tmpl | 8 +++++++- conda_smithy/templates/pixi.toml.tmpl | 8 +------- conda_smithy/templates/run_osx_build.sh.tmpl | 14 +++++++++++--- conda_smithy/templates/run_win_build.bat.tmpl | 17 ++++++++++++----- 5 files changed, 40 insertions(+), 17 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index c4a8aeb8f..08eee65e1 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -2187,8 +2187,16 @@ def render_pixi(jinja_env, forge_config, forge_dir): if filename.endswith(".yaml"): variant_name, _ = os.path.splitext(filename) variants.append(variant_name) + platforms = [ + platform.replace("_", "-") + for platform, service in forge_config["provider"].items() + if service + ] new_file_contents = template.render( - smithy_version=__version__, variants=variants, **forge_config + smithy_version=__version__, + platforms=platforms, + variants=variants, + **forge_config, ) with write_file(target_fname) as fh: fh.write(new_file_contents) diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index 9c87be9bd..510b1c61c 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -44,12 +44,18 @@ micromamba install --root-prefix ~/.conda --prefix /opt/conda \ curl -fsSL https://pixi.sh/install.sh | bash export PATH="~/.pixi/bin:$PATH" pushd "${FEEDSTOCK_ROOT}" -ln -s /opt/conda/pkgs/cache /opt/conda/repodata +arch=$(uname -m) +if [[ "$arch" == "x86_64" ]]; then + arch="64" +fi +sed -i.bak "s/platforms = .*/platforms = [\"linux-${arch}\"]/" pixi.toml echo "Creating environment" PIXI_CACHE_DIR=/opt/conda pixi install pixi list echo "Activating environment" eval "$(pixi shell-hook)" +mv pixi.toml.bak pixi.toml +popd {%- endif %} {%- if conda_build_tool == "mambabuild" %} diff --git a/conda_smithy/templates/pixi.toml.tmpl b/conda_smithy/templates/pixi.toml.tmpl index 436e05a2a..78bf31028 100644 --- a/conda_smithy/templates/pixi.toml.tmpl +++ b/conda_smithy/templates/pixi.toml.tmpl @@ -8,13 +8,7 @@ version = "{{ smithy_version }}" description = "Pixi configuration for conda-forge/{{ feedstock_name }}" authors = ["@conda-forge/{{ feedstock_name[:-11] }}"] channels = ["conda-forge"] -platforms = [ -{%- for platform, service in provider.items() %} -{%- if service %} - "{{ platform.replace('_', '-') }}", -{%- endif %} -{%- endfor %} -] +platforms = {{ platforms }} [dependencies] {%- for spec_name, spec_constraints in build_tool_deps_dict.items() %} diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index ae69c31b2..b7439ff79 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -36,8 +36,17 @@ rm -rf "${MAMBA_ROOT_PREFIX}" "${micromamba_exe}" || true ( startgroup "Provisioning base env with pixi" ) 2> /dev/null curl -fsSL https://pixi.sh/install.sh | bash export PATH="~/.pixi/bin:$PATH" +arch=$(uname -m) +if [[ "$arch" == "x86_64" ]]; then + arch="64" +fi +sed -i.bak "s/platforms = .*/platforms = [\"osx-${arch}\"]/" pixi.toml +echo "Creating environment" pixi install pixi list +echo "Activating environment" +eval "$(pixi shell-hook)" +mv pixi.toml.bak pixi.toml ( endgroup "Provisioning base env with pixi" ) 2> /dev/null {%- else %} ( startgroup "Installing a fresh version of Miniforge" ) 2> /dev/null @@ -64,9 +73,8 @@ bash "${MINIFORGE_FILE}" -b -p "${MINIFORGE_HOME}" {%- set BUILD_CMD="conda-build" %} {%- endif %} -{%- if conda_install_tool == "pixi" %} -eval "$(pixi shell-hook)" -{%- else %} +{%- if conda_install_tool != "pixi" %} +echo "Activating environment" source "${MINIFORGE_HOME}/etc/profile.d/conda.sh" conda activate base {%- endif %} diff --git a/conda_smithy/templates/run_win_build.bat.tmpl b/conda_smithy/templates/run_win_build.bat.tmpl index 871c32e2f..66f9aeaad 100644 --- a/conda_smithy/templates/run_win_build.bat.tmpl +++ b/conda_smithy/templates/run_win_build.bat.tmpl @@ -47,10 +47,21 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command "iwr -useb https:// if !errorlevel! neq 0 exit /b !errorlevel! set "PATH=%USERPROFILE%\.pixi\bin;%PATH%" echo Installing environment +move /y pixi.toml pixi.toml.bak +set "arch=64" +if "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "arch=arm64" +powershell -NoProfile -ExecutionPolicy unrestricted -Command "(Get-Content pixi.toml.bak -Encoding UTF8) -replace 'platforms = .*', 'platforms = [''win-%arch%'']' | Out-File pixi.toml -Encoding UTF8" pixi install if !errorlevel! neq 0 exit /b !errorlevel! pixi list if !errorlevel! neq 0 exit /b !errorlevel! +set "ACTIVATE_PIXI=%TMP%\pixi-activate-%RANDOM%.bat" +pixi shell-hook > "%ACTIVATE_PIXI%" +if !errorlevel! neq 0 exit /b !errorlevel! +call "%ACTIVATE_PIXI%" +if !errorlevel! neq 0 exit /b !errorlevel! +move /y pixi.toml.bak pixi.toml +popd call :end_group {%- else %} call :start_group "Installing a fresh version of Miniforge" @@ -67,12 +78,8 @@ call :end_group call :start_group "Configuring conda" :: Activate the base conda environment +{%- if conda_install_tool != "pixi" %} echo Activating environment -{%- if conda_install_tool == "pixi" %} -set "ACTIVATE_PIXI=%TMP%\pixi-activate-%RANDOM%.bat" -pixi shell-hook > %ACTIVATE_PIXI% -call %ACTIVATE_PIXI% -{%- else %} call "%MINIFORGE_HOME%\Scripts\activate.bat" {%- endif %} From db7a784966cb9991caab7d5054e8376dfd69d6cb Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 13:06:48 +0200 Subject: [PATCH 12/20] win: respect MINIFORGE_HOME for performance --- conda_smithy/templates/run_win_build.bat.tmpl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/conda_smithy/templates/run_win_build.bat.tmpl b/conda_smithy/templates/run_win_build.bat.tmpl index 66f9aeaad..cf0373729 100644 --- a/conda_smithy/templates/run_win_build.bat.tmpl +++ b/conda_smithy/templates/run_win_build.bat.tmpl @@ -12,7 +12,16 @@ setlocal enableextensions enabledelayedexpansion +FOR %%A IN ("%~dp0.") DO SET "REPO_ROOT=%%~dpA" +{%- if conda_install_tool == "pixi" %} +if "%MINIFORGE_HOME%"=="" ( + set "MINIFORGE_HOME=%REPO_ROOT%\.pixi\envs\default" +) else ( + set "PIXI_CACHE_DIR=%MINIFORGE_HOME%" +) +{%- else %} if "%MINIFORGE_HOME%"=="" set "MINIFORGE_HOME=%USERPROFILE%\Miniforge3" +{%- endif %} :: Remove trailing backslash, if present if "%MINIFORGE_HOME:~-1%"=="\" set "MINIFORGE_HOME=%MINIFORGE_HOME:~0,-1%" @@ -47,6 +56,13 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command "iwr -useb https:// if !errorlevel! neq 0 exit /b !errorlevel! set "PATH=%USERPROFILE%\.pixi\bin;%PATH%" echo Installing environment +if "%PIXI_CACHE_DIR%"=="%MINIFORGE_HOME%" ( + mkdir "%MINIFORGE_HOME%" + copy /Y pixi.toml "%MINIFORGE_HOME%" + pushd "%MINIFORGE_HOME%" +) else ( + pushd "%REPO_ROOT%" +) move /y pixi.toml pixi.toml.bak set "arch=64" if "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "arch=arm64" From 113fbebddef3aab0b5cf62ef0297a04e6c5753ca Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 14:01:40 +0200 Subject: [PATCH 13/20] delete if not enabled --- conda_smithy/configure_feedstock.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 08eee65e1..c611f0f77 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -2178,8 +2178,11 @@ def render_github_actions_services(jinja_env, forge_config, forge_dir): def render_pixi(jinja_env, forge_config, forge_dir): - template = jinja_env.get_template("pixi.toml.tmpl") target_fname = os.path.join(forge_dir, "pixi.toml") + remove_file_or_dir(target_fname) + if forge_config["conda_install_tool"] != "pixi": + return + template = jinja_env.get_template("pixi.toml.tmpl") ci_support_path = os.path.join(forge_dir, ".ci_support") variants = [] if os.path.exists(ci_support_path): From cc34022e5f70711f13ce996ffebc6f6ebb14f81d Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 15:58:36 +0200 Subject: [PATCH 14/20] refactor local_ci_setup logic --- conda_smithy/configure_feedstock.py | 84 ++++++++++++------- conda_smithy/templates/build_steps.sh.tmpl | 4 +- conda_smithy/templates/pixi.toml.tmpl | 9 +- conda_smithy/templates/run_osx_build.sh.tmpl | 2 +- conda_smithy/templates/run_win_build.bat.tmpl | 2 +- 5 files changed, 60 insertions(+), 41 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index c611f0f77..40c6199e3 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -660,7 +660,29 @@ def _yaml_represent_ordereddict(yaml_representer, data): ) -def _santize_remote_ci_setup(remote_ci_setup): +def _has_local_ci_setup(forge_dir, forge_config): + # If the recipe has its own conda_forge_ci_setup package, then + # install that + return ( + os.path.exists( + os.path.join( + forge_dir, + forge_config["recipe_dir"], + "conda_forge_ci_setup", + "__init__.py", + ) + ) + and os.path.exists( + os.path.join( + forge_dir, + forge_config["recipe_dir"], + "setup.py", + ) + ) + ) + + +def _sanitize_remote_ci_setup(remote_ci_setup): remote_ci_setup_ = conda_build.utils.ensure_list(remote_ci_setup) remote_ci_setup = [] for package in remote_ci_setup_: @@ -672,6 +694,30 @@ def _santize_remote_ci_setup(remote_ci_setup): return remote_ci_setup +def _sanitize_build_tool_deps_as_dict(forge_dir, forge_config) -> dict[str, str]: + """ + Aggregates different sources of build tool dependencies in + mapping of package names to OR-merged version constraints. + """ + deps = [ + *forge_config["conda_build_tool_deps"].split(), + *forge_config["remote_ci_setup"], + ] + merged = { + spec.name: str(spec.version) + for spec in MatchSpec.merge([dep.strip("\"'") for dep in deps]) + } + if ( + forge_config.get("local_ci_setup") + or _has_local_ci_setup(forge_dir, forge_config) + ): + # We need to conda uninstall conda-forge-ci-setup + # and then pip install on top + merged.setdefault("conda", "*") + merged.setdefault("pip", "*") + return merged + + def finalize_config(config, platform, arch, forge_config): """For configs without essential parameters like docker_image add fallback value. @@ -1185,25 +1231,9 @@ def _render_ci_provider( fast_finish_text=fast_finish_text, ) - # If the recipe has its own conda_forge_ci_setup package, then - # install that - if os.path.exists( - os.path.join( - forge_dir, - forge_config["recipe_dir"], - "conda_forge_ci_setup", - "__init__.py", - ) - ) and os.path.exists( - os.path.join( - forge_dir, - forge_config["recipe_dir"], - "setup.py", - ) - ): - forge_config["local_ci_setup"] = True - else: - forge_config["local_ci_setup"] = False + forge_config["local_ci_setup"] = _has_local_ci_setup( + forge_dir, forge_config + ) # hook for extending with whatever platform specific junk we need. # Function passed in as argument @@ -2421,7 +2451,7 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): if config["provider"]["linux_s390x"] in {"default", "native"}: config["provider"]["linux_s390x"] = ["travis"] - config["remote_ci_setup"] = _santize_remote_ci_setup( + config["remote_ci_setup"] = _sanitize_remote_ci_setup( config["remote_ci_setup"] ) if config["conda_install_tool"] == "conda": @@ -2432,15 +2462,10 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): else: config["remote_ci_setup_update"] = config["remote_ci_setup"] - _build_tools_deps = ( - config["conda_build_tool_deps"].split() + config["remote_ci_setup"] - ) - _build_tools_deps = MatchSpec.merge( - [dep.strip("\"'") for dep in _build_tools_deps] + # Post-process requirements so they are tidier for the TOML files + config["build_tool_deps_dict"] = _sanitize_build_tool_deps_as_dict( + forge_dir, config ) - config["build_tool_deps_dict"] = { - spec.name: str(spec.version) for spec in _build_tools_deps - } if not config["github_actions"]["triggers"]: self_hosted = config["github_actions"]["self_hosted"] @@ -2812,7 +2837,6 @@ def main( clear_variants(forge_dir) clear_scripts(forge_dir) set_migration_fns(forge_dir, config) - logger.debug("migration fns set") # the order of these calls appears to matter diff --git a/conda_smithy/templates/build_steps.sh.tmpl b/conda_smithy/templates/build_steps.sh.tmpl index 510b1c61c..31ef51246 100644 --- a/conda_smithy/templates/build_steps.sh.tmpl +++ b/conda_smithy/templates/build_steps.sh.tmpl @@ -80,9 +80,9 @@ export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 {{ conda_install_tool }} update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup_update) }} {%- endif %} -{% if conda_install_tool != "pixi" and local_ci_setup %} +{% if local_ci_setup %} conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup)}} -pip install --no-deps ${RECIPE_ROOT}/. +pip install --no-deps "${RECIPE_ROOT}/." {%- endif %} # set up the condarc setup_conda_rc "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" diff --git a/conda_smithy/templates/pixi.toml.tmpl b/conda_smithy/templates/pixi.toml.tmpl index 78bf31028..c246db274 100644 --- a/conda_smithy/templates/pixi.toml.tmpl +++ b/conda_smithy/templates/pixi.toml.tmpl @@ -6,7 +6,7 @@ name = "{{ feedstock_name }}" version = "{{ smithy_version }}" description = "Pixi configuration for conda-forge/{{ feedstock_name }}" -authors = ["@conda-forge/{{ feedstock_name[:-11] }}"] +authors = ["@conda-forge/{{ feedstock_name[:-10] }}"] channels = ["conda-forge"] platforms = {{ platforms }} @@ -14,17 +14,12 @@ platforms = {{ platforms }} {%- for spec_name, spec_constraints in build_tool_deps_dict.items() %} {{ spec_name }} = "{{ spec_constraints }}" {%- endfor %} -{%- if local_ci_setup %} - -[pypi-dependencies] -conda_forge_ci_setup = { path = "./" } -{%- endif %} [tasks] inspect-all = "inspect_artifacts --all-packages" {%- if conda_build_tool != "rattler-build" %} build = "{{ conda_build_tool }} build {{ recipe_dir }}" -debug = "{{ conda_build_tool }} build {{ recipe_dir }}" +debug = "{{ conda_build_tool }} debug {{ recipe_dir }}" {%- else %} build = "{{ conda_build_tool }} build --recipe {{ recipe_dir }}" {%- endif %} diff --git a/conda_smithy/templates/run_osx_build.sh.tmpl b/conda_smithy/templates/run_osx_build.sh.tmpl index b7439ff79..11e17960a 100644 --- a/conda_smithy/templates/run_osx_build.sh.tmpl +++ b/conda_smithy/templates/run_osx_build.sh.tmpl @@ -90,7 +90,7 @@ export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} {%- endif %} -{% if conda_install_tool != "pixi" and local_ci_setup %} +{% if local_ci_setup %} conda uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }} pip install --no-deps {{ recipe_dir }}/. {%- endif %} diff --git a/conda_smithy/templates/run_win_build.bat.tmpl b/conda_smithy/templates/run_win_build.bat.tmpl index cf0373729..f2020e1dd 100644 --- a/conda_smithy/templates/run_win_build.bat.tmpl +++ b/conda_smithy/templates/run_win_build.bat.tmpl @@ -115,7 +115,7 @@ echo Installing dependencies if !errorlevel! neq 0 exit /b !errorlevel! {%- endif %} -{%- if conda_install_tool != "pixi" and local_ci_setup %} +{%- if local_ci_setup %} echo Overriding conda-forge-ci-setup with local version conda.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }} if !errorlevel! neq 0 exit /b !errorlevel! From e5ab312ef7d2e748a487eb3e60b0ee0061763cce Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 15:59:06 +0200 Subject: [PATCH 15/20] pre-commit --- conda_smithy/configure_feedstock.py | 34 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 40c6199e3..a8200312a 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -663,21 +663,18 @@ def _yaml_represent_ordereddict(yaml_representer, data): def _has_local_ci_setup(forge_dir, forge_config): # If the recipe has its own conda_forge_ci_setup package, then # install that - return ( - os.path.exists( - os.path.join( - forge_dir, - forge_config["recipe_dir"], - "conda_forge_ci_setup", - "__init__.py", - ) + return os.path.exists( + os.path.join( + forge_dir, + forge_config["recipe_dir"], + "conda_forge_ci_setup", + "__init__.py", ) - and os.path.exists( - os.path.join( - forge_dir, - forge_config["recipe_dir"], - "setup.py", - ) + ) and os.path.exists( + os.path.join( + forge_dir, + forge_config["recipe_dir"], + "setup.py", ) ) @@ -694,7 +691,9 @@ def _sanitize_remote_ci_setup(remote_ci_setup): return remote_ci_setup -def _sanitize_build_tool_deps_as_dict(forge_dir, forge_config) -> dict[str, str]: +def _sanitize_build_tool_deps_as_dict( + forge_dir, forge_config +) -> dict[str, str]: """ Aggregates different sources of build tool dependencies in mapping of package names to OR-merged version constraints. @@ -707,9 +706,8 @@ def _sanitize_build_tool_deps_as_dict(forge_dir, forge_config) -> dict[str, str] spec.name: str(spec.version) for spec in MatchSpec.merge([dep.strip("\"'") for dep in deps]) } - if ( - forge_config.get("local_ci_setup") - or _has_local_ci_setup(forge_dir, forge_config) + if forge_config.get("local_ci_setup") or _has_local_ci_setup( + forge_dir, forge_config ): # We need to conda uninstall conda-forge-ci-setup # and then pip install on top From 3fe4035085a1b38554ece8e0492e0b566ed1a661 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 16:16:26 +0200 Subject: [PATCH 16/20] quote tasks --- conda_smithy/templates/pixi.toml.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conda_smithy/templates/pixi.toml.tmpl b/conda_smithy/templates/pixi.toml.tmpl index c246db274..ddbb3e42f 100644 --- a/conda_smithy/templates/pixi.toml.tmpl +++ b/conda_smithy/templates/pixi.toml.tmpl @@ -25,12 +25,12 @@ build = "{{ conda_build_tool }} build --recipe {{ recipe_dir }}" {%- endif %} {%- for variant in variants %} {%- if conda_build_tool != "rattler-build" %} -build-{{ variant }} = "{{ conda_build_tool }} build {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml --suppress-variables --clobber-file .ci_support/clobber_{{ variant }}.yaml" -debug-{{ variant }} = "{{ conda_build_tool }} debug {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" +"build-{{ variant }}" = "{{ conda_build_tool }} build {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml --suppress-variables --clobber-file .ci_support/clobber_{{ variant }}.yaml" +"debug-{{ variant }}" = "{{ conda_build_tool }} debug {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" {%- else %} -build-{{ variant }} = "{{ conda_build_tool }} build --recipe {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" +"build-{{ variant }}" = "{{ conda_build_tool }} build --recipe {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" {%- endif %} -inspect-{{ variant }} = "inspect_artifacts --recipe-dir {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" +"inspect-{{ variant }}" = "inspect_artifacts --recipe-dir {{ recipe_dir }} -m .ci_support/{{ variant }}.yaml" {%- endfor %} [feature.smithy.dependencies] From 0a6d660765a848a8693a2397e595fa1d22b46b76 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 16:19:31 +0200 Subject: [PATCH 17/20] fix vim mode --- conda_smithy/templates/pixi.toml.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_smithy/templates/pixi.toml.tmpl b/conda_smithy/templates/pixi.toml.tmpl index ddbb3e42f..9382f6ac0 100644 --- a/conda_smithy/templates/pixi.toml.tmpl +++ b/conda_smithy/templates/pixi.toml.tmpl @@ -1,6 +1,6 @@ # This file was generated automatically from conda-smithy. To update this configuration, # update the conda-forge.yml and/or the recipe/meta.yaml. -# -*- mode: yaml -*- +# -*- mode: toml -*- [project] name = "{{ feedstock_name }}" From a0a9ef7d16a06c4ff38bfa93ff817c54e62ea92b Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 16:27:12 +0200 Subject: [PATCH 18/20] empty version is "*" --- conda_smithy/configure_feedstock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index a8200312a..bb636ac3c 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -703,7 +703,7 @@ def _sanitize_build_tool_deps_as_dict( *forge_config["remote_ci_setup"], ] merged = { - spec.name: str(spec.version) + spec.name: str(spec.version) or "*" for spec in MatchSpec.merge([dep.strip("\"'") for dep in deps]) } if forge_config.get("local_ci_setup") or _has_local_ci_setup( From 2c11dd06e0ebf32ebc98a35598c72488179b88a5 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 16:28:10 +0200 Subject: [PATCH 19/20] dedupl and sort platforms --- conda_smithy/configure_feedstock.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index bb636ac3c..b6286d709 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -698,12 +698,12 @@ def _sanitize_build_tool_deps_as_dict( Aggregates different sources of build tool dependencies in mapping of package names to OR-merged version constraints. """ - deps = [ + deps =[ *forge_config["conda_build_tool_deps"].split(), *forge_config["remote_ci_setup"], ] merged = { - spec.name: str(spec.version) or "*" + spec.name: str(spec.version or "*") for spec in MatchSpec.merge([dep.strip("\"'") for dep in deps]) } if forge_config.get("local_ci_setup") or _has_local_ci_setup( @@ -2218,14 +2218,14 @@ def render_pixi(jinja_env, forge_config, forge_dir): if filename.endswith(".yaml"): variant_name, _ = os.path.splitext(filename) variants.append(variant_name) - platforms = [ + platforms = { platform.replace("_", "-") for platform, service in forge_config["provider"].items() if service - ] + } new_file_contents = template.render( smithy_version=__version__, - platforms=platforms, + platforms=sorted(platforms), variants=variants, **forge_config, ) From 6c9fe335f81d511b5997d487abca45dcdbfee549 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 18 Oct 2024 16:33:04 +0200 Subject: [PATCH 20/20] pre-commit --- conda_smithy/configure_feedstock.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index b6286d709..2caecf6e5 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -16,6 +16,7 @@ from itertools import chain, product from os import fspath from pathlib import Path, PurePath +from typing import Dict import requests import yaml @@ -693,12 +694,12 @@ def _sanitize_remote_ci_setup(remote_ci_setup): def _sanitize_build_tool_deps_as_dict( forge_dir, forge_config -) -> dict[str, str]: +) -> Dict[str, str]: """ Aggregates different sources of build tool dependencies in mapping of package names to OR-merged version constraints. """ - deps =[ + deps = [ *forge_config["conda_build_tool_deps"].split(), *forge_config["remote_ci_setup"], ]