Skip to content

MSI: Add support for extra_envs#1186

Merged
lrandersson merged 15 commits intoconda:briefcase-integrationfrom
lrandersson:dev-ra-extra-envs
Mar 27, 2026
Merged

MSI: Add support for extra_envs#1186
lrandersson merged 15 commits intoconda:briefcase-integrationfrom
lrandersson:dev-ra-extra-envs

Conversation

@lrandersson
Copy link
Copy Markdown
Contributor

Description

Added MSI support for extra_envs installations.

constructor/briefcase.py

  • Added _setup_envs_commands(info): builds environment configs (base + extra_envs) with name, prefix, lockfile, channels, and shortcuts
  • Updated _stage_dists() to include packages from _extra_envs_info
  • Updated render_templates() to use _setup_envs_commands()

constructor/briefcase/run_installation.bat

  • Added install_env(env) Jinja macro for per-environment install logic
  • Replaced single install block with loop over setup_envs

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@lrandersson lrandersson changed the base branch from main to briefcase-integration March 20, 2026 14:56
@github-project-automation github-project-automation Bot moved this to 🆕 New in 🔎 Review Mar 20, 2026
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Mar 20, 2026
>> "%LOG%" echo {{ message }}
{%- endmacro %}

{% macro install_env(env) %}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with the macro approach because it seems easier to read, slightly.

@lrandersson lrandersson marked this pull request as ready for review March 24, 2026 13:09
@lrandersson lrandersson requested a review from a team as a code owner March 24, 2026 13:09
@lrandersson lrandersson marked this pull request as draft March 24, 2026 13:17
@lrandersson lrandersson self-assigned this Mar 25, 2026
Comment thread constructor/main.py
return os_allowed[osname][:1]
elif itype == "all":
return os_allowed[osname]
elif isinstance(itype, (list, tuple)):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I added because when I first added msi to installer_types to the example outputs (further down), an uncaughted exception was raised.

{{ tee("Running constructor uninstall...") }}
"%CONDA_EXE%" constructor uninstall --prefix "%BASE_PATH%"!UNINST_ARGS! --log-file "%LOG%"
if errorlevel 1 ( exit /b %errorlevel% )
{%- else %}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all of this because I enforced info["uninstall_with_conda_exe"] = True in briefcase.py.

Comment thread constructor/briefcase.py
"title": "Create shortcuts",
"description": "Create shortcuts (supported packages only).",
"default": False,
"default": True,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it matches NSIS.

@lrandersson lrandersson marked this pull request as ready for review March 25, 2026 17:56
Comment thread constructor/briefcase.py
# MSI installers always use conda-standalone for uninstallation.
# This ensures proper cleanup of conda init, environments, and shortcuts
# via the `conda constructor uninstall` command.
info["uninstall_with_conda_exe"] = True
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be verified that the conda-standalone version supports this, or we need to bump the minimum required version for conda-standalone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you have any preference on which approach would be the best here? I'm leaning towards bumping the minimum required version and take advantage of requiring all the new nice features.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the minimum version that we need to bump it to?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

24.11.0 and I think this would be reasonable considering we have this already

exe_type == StandaloneExe.CONDA and check_version(exe_version, min_version="24.11.0")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That version check is for exactly that feature, but requiring at least 24.11.0 seems reasonable enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See e1911f5

Comment thread constructor/briefcase.py Outdated
dists = self.info["_dists"].copy()
for env_info in self.info.get("_extra_envs_info", {}).values():
dists += env_info["_dists"]
dists = list({dist: None for dist in dists}) # de-duplicate
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a set instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could definitely use a set here, but a dict here preserves the insertion order. The functionality is the same but for debugging purposes and reproducible builds/logs I'd say a dict provides with a slight advantage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does insertion order matter here?

For debugging or reproducible logs, I would find a sorted list (which you can get from a set) more useful and would make the code more legible/semantic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, see ee96eec

Comment thread constructor/main.py
@lrandersson lrandersson requested a review from marcoesters March 26, 2026 18:56
Comment thread constructor/briefcase.py Outdated
lrandersson and others added 2 commits March 27, 2026 08:29
Co-authored-by: Marco Esters <mesters@anaconda.com>
@lrandersson lrandersson requested a review from marcoesters March 27, 2026 12:39
@github-project-automation github-project-automation Bot moved this from 🆕 New to ✅ Approved in 🔎 Review Mar 27, 2026
@lrandersson lrandersson merged commit 40cf913 into conda:briefcase-integration Mar 27, 2026
33 of 34 checks passed
@github-project-automation github-project-automation Bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Mar 27, 2026
lrandersson added a commit that referenced this pull request Apr 7, 2026
* add support for extra_envs, work in progress

* Fix rebase issues

* Add more examples to MSI testing

* fix error: TypeError: unhashable type

* Changed default value of shortcut option for consistency with NSIS

* Add debug output

* Always uninstall with conda-standalone

* Add debug output

* Improve debug output

* Remove debug output, skip test

* Remove more debug statements

* Use pytest.xfail

* Review fix

* Add suggestion from review

Co-authored-by: Marco Esters <mesters@anaconda.com>

* Bump min conda-standalone

---------

Co-authored-by: Marco Esters <mesters@anaconda.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants