Skip to content

Add installer attributes for name, version, platform, and type to .installer.info#1260

Merged
marcoesters merged 14 commits into
conda:mainfrom
stacynoland:installer_attributes
Jun 12, 2026
Merged

Add installer attributes for name, version, platform, and type to .installer.info#1260
marcoesters merged 14 commits into
conda:mainfrom
stacynoland:installer_attributes

Conversation

@stacynoland

@stacynoland stacynoland commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds attributes to a .installer.info file stored in the workspace directory for persistent storage.

The installer attributes are stored in JSON format using the following keys:

  • name
  • version
  • platform
  • type

This information is being stored so other services, such as telemetry, can find details about the installer that was used to setup conda.

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?

@github-project-automation github-project-automation Bot moved this to 🆕 New in 🔎 Review Jun 10, 2026
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jun 10, 2026
@stacynoland stacynoland changed the title Add installer attributes for name, version, platform, and type to .co… Add installer attributes for name, version, platform, and type to .constructor-build.info Jun 10, 2026
@stacynoland

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@stacynoland stacynoland marked this pull request as ready for review June 10, 2026 05:09
@stacynoland stacynoland requested a review from a team as a code owner June 10, 2026 05:09
@stacynoland stacynoland marked this pull request as draft June 10, 2026 05:15
@stacynoland stacynoland marked this pull request as ready for review June 10, 2026 05:16
Comment thread constructor/preconda.py Outdated
Comment on lines +126 to +128
out["installer_name"] = info.get("installer_name", "Unknown")
out["installer_version"] = info.get("installer_version", "Unknown")
out["installer_platform"] = info.get("installer_platform", "Unknown")

@lrandersson lrandersson Jun 10, 2026

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.

Suggested change
out["installer_name"] = info.get("installer_name", "Unknown")
out["installer_version"] = info.get("installer_version", "Unknown")
out["installer_platform"] = info.get("installer_platform", "Unknown")
out["installer_name"] = info.get("name", "Unknown")
out["installer_version"] = info.get("version", "Unknown")
out["installer_platform"] = info.get("_platform", "Unknown")

I looked at the keys again that I mentioned yesterday and I realized that was incorrect. I added this suggestion which should be accurate:

  1. name from construct.yaml
  2. version from construct.yaml
  3. _platform is set via main.py
  4. installer_type also set via main.py

I also wonder if we should simply have empty strings as default but no strong opinion, I guess the consumer of this data might have an opinion of this.
Perhaps also installer_name and installer_version should not even have a default since something must be fundamentally wrong if it not set.

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.

They're all guaranteed to be set. I think a simple get() without default values is good here - in the unlikely case that a value isn't set, we'd get null instead of a special string in the JSON file. Empty string is a good alternative, which I'd prefer over "Unknown".

@stacynoland stacynoland Jun 10, 2026

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.

@lrandersson Thanks for catching the info dict keys issue. I made sure this was updated.

@marcoesters I also removed the default value as suggested on the get() method.

@marcoesters marcoesters left a comment

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.

I think we should use a separate file to not conflate installer and build environment information. I would also like to see the changes be covered by a test - I recommend just modifying an existing one.

Comment thread constructor/preconda.py Outdated

files = (
"pkgs/.constructor-build.info",
".constructor-build.info",

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.

I'm not sure about whether to re-use that file. The file contains information about the build process and contains information on conda, python, etc. from the build environment. Adding information of the installer could imply that these are the version of conda, python, etc. that are packaged in the installer.

I think a separate file makes more sense.

Comment thread constructor/preconda.py Outdated
Comment on lines +126 to +128
out["installer_name"] = info.get("installer_name", "Unknown")
out["installer_version"] = info.get("installer_version", "Unknown")
out["installer_platform"] = info.get("installer_platform", "Unknown")

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.

They're all guaranteed to be set. I think a simple get() without default values is good here - in the unlikely case that a value isn't set, we'd get null instead of a special string in the JSON file. Empty string is a good alternative, which I'd prefer over "Unknown".

@stacynoland stacynoland changed the title Add installer attributes for name, version, platform, and type to .constructor-build.info Add installer attributes for name, version, platform, and type to .installer.info Jun 10, 2026
@stacynoland

Copy link
Copy Markdown
Contributor Author

I think we should use a separate file to not conflate installer and build environment information. I would also like to see the changes be covered by a test - I recommend just modifying an existing one.

The installer attributes are now saved to a .installer.info file in the installer/workspace directory and I reverted the changes we had made to the .constructor-build.info file.

I'm still working on getting it covered by a test, but I will have that for review by tomorrow.

@lrandersson lrandersson left a comment

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.

I think this looks good. As you mentioned maybe a simple unit test would be good to add and I think we should not hardcode .installer.info in both preconda.py and winexe.py, instead define a variable somewhere that can be utilized.

@marcoesters

Copy link
Copy Markdown
Contributor

I think this looks good. As you mentioned maybe a simple unit test would be good to add and I think we should not hardcode .installer.info in both preconda.py and winexe.py, instead define a variable somewhere that can be utilized.

I think changing an existing test like test_example_miniforge is sufficient. The current hardcoding is consistent with existing code, actually. A general refactor to replace the hard-coding with variables is a good issue though.

@lrandersson

Copy link
Copy Markdown
Contributor

I think this looks good. As you mentioned maybe a simple unit test would be good to add and I think we should not hardcode .installer.info in both preconda.py and winexe.py, instead define a variable somewhere that can be utilized.

I think changing an existing test like test_example_miniforge is sufficient. The current hardcoding is consistent with existing code, actually. A general refactor to replace the hard-coding with variables is a good issue though.

Created #1261

@stacynoland

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

Comment thread constructor/preconda.py
"platform": info.get("_platform"),
"type": info.get("installer_type"),
}
with open(join(workspace, ".installer.info"), "w") as fo:

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.

Should this get the JSON extension since it's a JSON file? I know the build info is .info, but .json is more transparent.

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.

.constructor-build.info is also a JSON file. I was following that as an example, so I guess that question would apply to both of these, correct?

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.

I don't like that either. 😅 I don't have a strong opinion either way.

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.

Yeah, I don't have a strong opinion either, but if we do make a choice I just want to stay consistent 🤓

Comment thread tests/test_examples.py Outdated
Comment thread tests/test_examples.py Outdated
else "Miniforge3-mamba2"
)
assert installer_info["version"] == "25.0.0-1" if example == "miniforge" else "25.1.1-0"
assert installer_info["platform"] in SUPPORTED_PLATFORMS

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 doesn't test that the platform is correct, just that it's a supported platform.

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 can use the platform module and piece together each "platform" value that way to check against it, replicating the format SUPPORTED_PLATFORMS expects. That's the only option I see here, because this value isn't provided by the construct.yaml files.

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.

Since you don't cross-build in this test, you could use cc_platform:

cc_platform = conda_context.subdir

That's the default value for the platform.

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 kept seeing that in places and wasn't 100% sure if that was it. I'll make that change and send it along in the next push.

Comment thread tests/test_examples.py Outdated
@stacynoland

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@stacynoland stacynoland requested a review from marcoesters June 11, 2026 22:33
stacynoland and others added 2 commits June 11, 2026 18:46
@stacynoland

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@github-project-automation github-project-automation Bot moved this from 🆕 New to ✅ Approved in 🔎 Review Jun 12, 2026
@marcoesters marcoesters merged commit 37ed3cc into conda:main Jun 12, 2026
20 checks passed
@github-project-automation github-project-automation Bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Jun 12, 2026
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.

4 participants