I’m thinking about a possible plug-in system for the Python Launcher for Unix, and I realized it generalizes to editors/IDEs in terms of the information one wants to know about interpreters and environments on the user’s machine.
If you were given the following bit of JSON in regards to an interpreter or environment on a machine, does it provide everything you would want to know?
[ // An array of of results.
{
// In case multple finders find the same thing.
// Could be a path to an environment, executable, etc.
"key": "/usr/local/bin/python3.10",
"python_version": {
// `sys.version_info`
"major": 3,
"minor": 10,
"micro": 1, // Optional
"releaselevel": "final", // Optional
"serial": 0 // Optional
},
"implementation": { // Optional
// `sys.implementation`
"name": "cpython",
"version": "3.10.1"
},
"distributor": { // Optional
// PEP 514 (https://www.python.org/dev/peps/pep-0514/)
"name": "Python Software Foundation",
"url": "https://www.python.org"
},
"executable": {
// An array specifying what is required to execute the interpreter.
// Expection is to append args to code to the end of the array before
// execution.
// For something like conda environments:
// `["/path/to/conda", "run", "--path", "<environment>", "--no-capture-output"]`.
"run": ["/usr/local/bin/python3.10"],
// E.g. 32-bit or 64-bit?
"bitness": 64, // Optional
// CPU architecture.
// Can be as generic as "64bit".
"arch": "x64" // Optional
},
"environment": {
// What type of environment, e.g. "venv", "conda", etc.
"type": "global",
// The name of the environment, e.g. the prompt name for a virtual
// environment.
"name": "" // Optional
},
// (Launcher-specific)
// Is this environment/interpreter specific/exact to the situation?
// E.g. the virtual environment created by Poetry for the folder,
// activated virtual environment, etc.
"halt_search": false
}
]
I realize that if this plug-in idea works for the Python Launcher then editors/IDEs could take advantage of the same mechanism for interpreter and environment discovery. To be clear, this entire idea is speculative, but if it did pan out I wanted to make sure I wasn’t proposing something from the start that had an obvious flaw from an editor/IDE perspective.