这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@mhsmith
Copy link

@mhsmith mhsmith commented Oct 9, 2025

Description

Initial work towards:

Requires Briefcase to be installed in the environment, including the following updates:

As discussed, this PR is sufficient to build a simple MSI installer (with no install-time options) from the miniconda3 recipe. After the Briefcase updates are merged, I'll post a comment here with instructions on how to do that.

@freakboy3742: FYI

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?

@conda-bot
Copy link
Contributor

We require contributors to sign our Contributor License Agreement and we don't have one on file for @mhsmith.

In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature, merge the PR (conda/infrastructure#1222), and ping the bot to refresh the PR.

@travishathaway
Copy link
Contributor

@conda-bot check

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Oct 9, 2025
msi_paths = list(dist_dir.glob("*.msi"))
if len(msi_paths) != 1:
raise RuntimeError(f"Found {len(msi_paths)} MSI files in {dist_dir}")
shutil.copy(msi_paths[0], info["_outpath"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a move command instead? In heavy installers and reduced disk storage availability, it might be the difference between success and error.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

"enum": [
"all",
"exe",
"msi",
Copy link
Contributor

Choose a reason for hiding this comment

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

This change should be applied in _schema.py and then propagated.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should also have an integration test in test_examples.py once the dependencies are ready.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think most integration tests have installer_type: all, which will break if features are missing. I suggest replacing them with installer_type: {{ 'exe' if sys.platform == 'win32' else 'all' for those that fail because of missing features. That will also give us a good idea about when we have feature parity.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mhsmith just for completeness, I've added (and working on finalizing it) the integration tests in test_examples.py in this branch: https://github.com/lrandersson/constructor/tree/briefcase
I branched from the branch that's in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

@marcoesters marcoesters changed the base branch from main to briefcase-integration October 14, 2025 15:01
@mhsmith
Copy link
Author

mhsmith commented Oct 29, 2025

Testing instructions

Check out the following repositories:

Run these commands:

conda env create -f constructor\dev\environment.yml
conda activate constructor-dev
pip install -e .\constructor .\briefcase
set INSTALLER_VERSION=25.9.0-99  # or any other build number
set PY_VER=3.13
set EXT=msi
constructor installers\products\miniconda3\recipe

The MSI will be generated in the working directory.

@mhsmith
Copy link
Author

mhsmith commented Oct 30, 2025

Remaining features required for production use

[Moved to #967]

Copy link
Contributor

@marcoesters marcoesters left a comment

Choose a reason for hiding this comment

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

My biggest change request is to get the dependencies right. Specifically, briefcase is missing from the list. I'm also a little concerned about how tightly this is bound to Python conventions.

Comment on lines +25 to +27
name = info["name"]
if not name:
raise ValueError("Name is empty")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name = info["name"]
if not name:
raise ValueError("Name is empty")
if not (name := info.get("name")):
raise ValueError("Name is empty")

If we are concerned about empty values, we should use get, too.

Copy link
Contributor

Choose a reason for hiding this comment

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

I fixed it in mhsmith#1

Copy link
Contributor

Choose a reason for hiding this comment

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

I think most integration tests have installer_type: all, which will break if features are missing. I suggest replacing them with installer_type: {{ 'exe' if sys.platform == 'win32' else 'all' for those that fail because of missing features. That will also give us a good idea about when we have feature parity.

if not name:
raise ValueError("Name is empty")

# Briefcase requires version numbers to be in the canonical Python format, and some
Copy link
Contributor

Choose a reason for hiding this comment

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

Python is not fully compatible with SemVer, so that could be a pretty significant limitation.

It will at least require a few version changes in our integration test examples:

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed temporarily in mhsmith#1

strip_chars = " .-_"
before = info["version"][:start].strip(strip_chars)
after = info["version"][end:].strip(strip_chars)
name = " ".join(s for s in [name, before, after] if s)
Copy link
Contributor

Choose a reason for hiding this comment

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

So, for something like Miniconda3-py310_25.9.1-3-Windows-x86_64.msi, we have the following?

name = Miniconda3 py310
version = 25.9.1.3

# different versions of a product.
def get_bundle_app_name(info, name):
# If reverse_domain_identifier is provided, use it as-is, but verify that the last
# component is a valid Python package name, as Briefcase requires.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since constructor doesn't require Python-based packages, will we run into issues with non-Python namespaces?

Comment on lines +135 to +141
briefcase = Path(sysconfig.get_path("scripts")) / "briefcase.exe"
logger.info("Building installer")
run(
[briefcase, "package"] + (["-v"] if verbose else []),
cwd=tmp_dir,
check=True,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I have two questions here:

  1. Is it possible to use briefcase as an API rather than a CLI?
  2. This looks like Windows - do we need any guards here?

Either way, we should make sure that briefcase.exe exists before calling it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I added 2) in mhsmith#1, the check for briefcase.exe is also there

@@ -0,0 +1,9 @@
_conda constructor --prefix . --extract-conda-pkgs
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use absolute paths instead of relative paths.

"jinja2",
"jsonschema >=4"
"jsonschema >=4",
"tomli-w >=1.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is only needed for MSI installers, this should probably only be added for Windows - same in the recipe.

This is also missing briefcase as a dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

@github-project-automation github-project-automation bot moved this from 🆕 New to 🏗️ In Progress in 🔎 Review Nov 13, 2025
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

Status: 🏗️ In Progress

Development

Successfully merging this pull request may close these issues.

6 participants