Add installer attributes for name, version, platform, and type to .installer.info#1260
Conversation
…nstructor-build.info
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
| out["installer_name"] = info.get("installer_name", "Unknown") | ||
| out["installer_version"] = info.get("installer_version", "Unknown") | ||
| out["installer_platform"] = info.get("installer_platform", "Unknown") |
There was a problem hiding this comment.
| 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:
namefromconstruct.yamlversionfromconstruct.yaml_platformis set viamain.pyinstaller_typealso set viamain.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.
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
@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
left a comment
There was a problem hiding this comment.
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.
|
|
||
| files = ( | ||
| "pkgs/.constructor-build.info", | ||
| ".constructor-build.info", |
There was a problem hiding this comment.
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.
| out["installer_name"] = info.get("installer_name", "Unknown") | ||
| out["installer_version"] = info.get("installer_version", "Unknown") | ||
| out["installer_platform"] = info.get("installer_platform", "Unknown") |
There was a problem hiding this comment.
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".
The installer attributes are now saved to a I'm still working on getting it covered by a test, but I will have that for review by tomorrow. |
lrandersson
left a comment
There was a problem hiding this comment.
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 |
Created #1261 |
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
| "platform": info.get("_platform"), | ||
| "type": info.get("installer_type"), | ||
| } | ||
| with open(join(workspace, ".installer.info"), "w") as fo: |
There was a problem hiding this comment.
Should this get the JSON extension since it's a JSON file? I know the build info is .info, but .json is more transparent.
There was a problem hiding this comment.
.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?
There was a problem hiding this comment.
I don't like that either. 😅 I don't have a strong opinion either way.
There was a problem hiding this comment.
Yeah, I don't have a strong opinion either, but if we do make a choice I just want to stay consistent 🤓
| 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 |
There was a problem hiding this comment.
That doesn't test that the platform is correct, just that it's a supported platform.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Since you don't cross-build in this test, you could use cc_platform:
That's the default value for the platform.
There was a problem hiding this comment.
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.
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Co-authored-by: Marco Esters <mesters@anaconda.com>
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Description
This PR adds attributes to a
.installer.infofile stored in theworkspacedirectory for persistent storage.The installer attributes are stored in JSON format using the following keys:
nameversionplatformtypeThis 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 ...
newsdirectory (using the template) for the next release's release notes?