# Python vswhere
This module provides an interface to Microsoft's Visual Studio locator tool,
[vswhere](https://github.com/Microsoft/vswhere).
If Visual Studio 15.2 or later has been installed, this will use the vswhere
binary installed with Visual Studio. Otherwise, it will download the latest
release of vswhere the first time a function is called.
# Usage
`find()` and `find_first()` are the most generic functions. They support most of
the [command line options](https://github.com/Microsoft/vswhere/blob/master/src/vswhere.lib/vswhere.lib.rc#L72)
to vswhere. `find()` returns a list of installed copies of Visual Studio matching
the given options, and `find_first()` returns only the first result.
If you are only interested in the latest version of Visual Studio, use
`get_latest()`. To get just the installation path, use `get_latest_path()`.
To get just the version number, use `get_latest_version()` or `get_latest_major_version()`.
These functions also support the same arguments as `find()`, so you can find
pre-releases or different products such as build tools.
If you want to use your own version of vswhere.exe instead of the one installed
with Visual Studio, use `set_vswhere_path()` to provide its location.
If you want to use a mirror instead of GitHub to download vswhere.exe, for
example when on an intranet that does not have access to GitHub, use
`set_download_mirror()` and provide the URL of the mirror.
## Examples
```Python
>>> import pprint, vswhere
>>> vswhere.get_latest_path()
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community'
>>> vswhere.get_latest_path(products='Microsoft.VisualStudio.Product.BuildTools')
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools'
>>> vswhere.get_latest_version()
'16.5.30011.22'
>>> vswhere.get_latest_major_version()
16
>>> vswhere.find(legacy=True, prop='installationPath')
['C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community', 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\']
>>> pp = pprint.PrettyPrinter(indent=4, width=200)
>>> pp.pprint(vswhere.find(legacy=True))
[ { 'catalog': { 'buildBranch': 'd16.5',
'buildVersion': '16.5.30011.22',
'id': 'VisualStudio/16.5.4+30011.22',
'localBuild': 'build-lab',
'manifestName': 'VisualStudio',
'manifestType': 'installer',
'productDisplayVersion': '16.5.4',
'productLine': 'Dev16',
'productLineVersion': '2019',
'productMilestone': 'RTW',
'productMilestoneIsPreRelease': 'False',
'productName': 'Visual Studio',
'productPatchVersion': '4',
'productPreReleaseMilestoneSuffix': '1.0',
'productSemanticVersion': '16.5.4+30011.22',
'requiredEngineVersion': '2.5.2141.57745'},
'channelId': 'VisualStudio.16.Release',
'channelUri': 'https://aka.ms/vs/16/release/channel',
'description': 'Powerful IDE, free for students, open-source contributors, and individuals',
'displayName': 'Visual Studio Community 2019',
'enginePath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service',
'installDate': '2019-06-24T05:30:57Z',
'installationName': 'VisualStudio/16.5.4+30011.22',
'installationPath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community',
'installationVersion': '16.5.30011.22',
'instanceId': '0a09d80d',
'isComplete': True,
'isLaunchable': True,
'isPrerelease': False,
'isRebootRequired': False,
'productId': 'Microsoft.VisualStudio.Product.Community',
'productPath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.exe',
'properties': { 'campaignId': '1263684068.1543796472',
'channelManifestId': 'VisualStudio.16.Release/16.5.4+30011.22',
'nickname': '',
'setupEngineFilePath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe'},
'releaseNotes': 'https://go.microsoft.com/fwlink/?LinkId=660893#16.5.4',
'state': 4294967295,
'thirdPartyNotices': 'https://go.microsoft.com/fwlink/?LinkId=660909',
'updateDate': '2020-05-10T17:04:46.9919584Z'},
{'installationPath': 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\', 'installationVersion': '14.0', 'instanceId': 'VisualStudio.14.0'}]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ChaosinaCan/pyvswhere",
"name": "vswhere",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Joel Spadin",
"author_email": "joelspadin@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/64/17/c8d9147f5d424a7574c455721f7f995801f28ef84c09932434b0110d9803/vswhere-1.4.0.tar.gz",
"platform": "",
"description": "# Python vswhere\r\n\r\nThis module provides an interface to Microsoft's Visual Studio locator tool,\r\n[vswhere](https://github.com/Microsoft/vswhere).\r\n\r\nIf Visual Studio 15.2 or later has been installed, this will use the vswhere\r\nbinary installed with Visual Studio. Otherwise, it will download the latest\r\nrelease of vswhere the first time a function is called.\r\n\r\n# Usage\r\n\r\n`find()` and `find_first()` are the most generic functions. They support most of\r\nthe [command line options](https://github.com/Microsoft/vswhere/blob/master/src/vswhere.lib/vswhere.lib.rc#L72)\r\nto vswhere. `find()` returns a list of installed copies of Visual Studio matching\r\nthe given options, and `find_first()` returns only the first result.\r\n\r\nIf you are only interested in the latest version of Visual Studio, use\r\n`get_latest()`. To get just the installation path, use `get_latest_path()`.\r\nTo get just the version number, use `get_latest_version()` or `get_latest_major_version()`.\r\nThese functions also support the same arguments as `find()`, so you can find\r\npre-releases or different products such as build tools.\r\n\r\nIf you want to use your own version of vswhere.exe instead of the one installed\r\nwith Visual Studio, use `set_vswhere_path()` to provide its location.\r\n\r\nIf you want to use a mirror instead of GitHub to download vswhere.exe, for\r\nexample when on an intranet that does not have access to GitHub, use\r\n`set_download_mirror()` and provide the URL of the mirror.\r\n\r\n## Examples\r\n\r\n```Python\r\n>>> import pprint, vswhere\r\n>>> vswhere.get_latest_path()\r\n'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community'\r\n>>> vswhere.get_latest_path(products='Microsoft.VisualStudio.Product.BuildTools')\r\n'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools'\r\n>>> vswhere.get_latest_version()\r\n'16.5.30011.22'\r\n>>> vswhere.get_latest_major_version()\r\n16\r\n>>> vswhere.find(legacy=True, prop='installationPath')\r\n['C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community', 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 14.0\\\\']\r\n>>> pp = pprint.PrettyPrinter(indent=4, width=200)\r\n>>> pp.pprint(vswhere.find(legacy=True))\r\n[ { 'catalog': { 'buildBranch': 'd16.5',\r\n 'buildVersion': '16.5.30011.22',\r\n 'id': 'VisualStudio/16.5.4+30011.22',\r\n 'localBuild': 'build-lab',\r\n 'manifestName': 'VisualStudio',\r\n 'manifestType': 'installer',\r\n 'productDisplayVersion': '16.5.4',\r\n 'productLine': 'Dev16',\r\n 'productLineVersion': '2019',\r\n 'productMilestone': 'RTW',\r\n 'productMilestoneIsPreRelease': 'False',\r\n 'productName': 'Visual Studio',\r\n 'productPatchVersion': '4',\r\n 'productPreReleaseMilestoneSuffix': '1.0',\r\n 'productSemanticVersion': '16.5.4+30011.22',\r\n 'requiredEngineVersion': '2.5.2141.57745'},\r\n 'channelId': 'VisualStudio.16.Release',\r\n 'channelUri': 'https://aka.ms/vs/16/release/channel',\r\n 'description': 'Powerful IDE, free for students, open-source contributors, and individuals',\r\n 'displayName': 'Visual Studio Community 2019',\r\n 'enginePath': 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service',\r\n 'installDate': '2019-06-24T05:30:57Z',\r\n 'installationName': 'VisualStudio/16.5.4+30011.22',\r\n 'installationPath': 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community',\r\n 'installationVersion': '16.5.30011.22',\r\n 'instanceId': '0a09d80d',\r\n 'isComplete': True,\r\n 'isLaunchable': True,\r\n 'isPrerelease': False,\r\n 'isRebootRequired': False,\r\n 'productId': 'Microsoft.VisualStudio.Product.Community',\r\n 'productPath': 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\Community\\\\Common7\\\\IDE\\\\devenv.exe',\r\n 'properties': { 'campaignId': '1263684068.1543796472',\r\n 'channelManifestId': 'VisualStudio.16.Release/16.5.4+30011.22',\r\n 'nickname': '',\r\n 'setupEngineFilePath': 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\vs_installershell.exe'},\r\n 'releaseNotes': 'https://go.microsoft.com/fwlink/?LinkId=660893#16.5.4',\r\n 'state': 4294967295,\r\n 'thirdPartyNotices': 'https://go.microsoft.com/fwlink/?LinkId=660909',\r\n 'updateDate': '2020-05-10T17:04:46.9919584Z'},\r\n {'installationPath': 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 14.0\\\\', 'installationVersion': '14.0', 'instanceId': 'VisualStudio.14.0'}]\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Interface to Microsoft's Visual Studio locator tool, vswhere",
"version": "1.4.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6417c8d9147f5d424a7574c455721f7f995801f28ef84c09932434b0110d9803",
"md5": "f16e4f8a679f0c392832c36ad16733bc",
"sha256": "d5680e0ebf83cc6f97204ee75dde4fa83bfe9a95271fd29424bd8728bedf57e3"
},
"downloads": -1,
"filename": "vswhere-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "f16e4f8a679f0c392832c36ad16733bc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6642,
"upload_time": "2022-01-06T18:46:35",
"upload_time_iso_8601": "2022-01-06T18:46:35.603884Z",
"url": "https://files.pythonhosted.org/packages/64/17/c8d9147f5d424a7574c455721f7f995801f28ef84c09932434b0110d9803/vswhere-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-01-06 18:46:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "ChaosinaCan",
"github_project": "pyvswhere",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "vswhere"
}