Closed arthurzenika closed 1 year ago
With poetry 1.1 we get a different error :
python -m poetry install
Updating dependencies
Resolving dependencies... (16.4s)
SolverProblemError
Because vsphere-automation-sdk (1.80.0) depends on vmc-draas-client-bindings (1.20.0) which doesn't match any versions, vsphere-automation-sdk is forbidden.
So, because cmdb-pic-tooling depends on vsphere-automation-sdk (1.80.0), version solving failed.
at /usr/lib/python3/dist-packages/poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
Again https://pypi.org/project/vmc-draas-client-bindings/#history only shows a 0.0.1 version...
Here is a workaround for anyone else using poetry. In your pyproject.toml
:
[tool.poetry.dependencies]
# vsphere-automation-sdk work around
vsphere-automation-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/archive/refs/tags/v8.0.0.1.tar.gz"}
vmc-draas-client-bindings = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vmc-draas-client-bindings/vmc_draas_client_bindings-1.20.0-py2.py3-none-any.whl"}
vapi-runtime = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-runtime/vapi_runtime-2.37.0-py2.py3-none-any.whl"}
vapi-common-client = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-common-client/vapi_common_client-2.37.0-py2.py3-none-any.whl"}
nsx-policy-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
nsx-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-python-sdk/nsx_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
nsx-vmc-aws-integration-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
nsx-vmc-policy-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.0.1.0.0-py2.py3-none-any.whl"}
vapi-client-bindings = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vapi-client-bindings/vapi_client_bindings-4.0.0-py2.py3-none-any.whl"}
vmc-client-bindings = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/master/lib/vmc-client-bindings/vmc_client_bindings-1.61.0-py2.py3-none-any.whl"}
# end of vsphere-automation-sdk work around
Thank you @arthurzenika for your workaround. It is now possible for me to setup this framework with poetry 💪
Here is the updated workaround list with latest release 8.0.2.0:
# vsphere-automation-sdk work around
vsphere-automation-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/archive/refs/tags/v8.0.2.0.tar.gz"}
nsx-policy-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl"}
nsx-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-python-sdk/nsx_python_sdk-4.1.2.0.0-py2.py3-none-any.whl"}
nsx-vmc-aws-integration-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.1.2.0.0-py2.py3-none-any.whl"}
nsx-vmc-policy-python-sdk = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl"}
vapi-common-client = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vapi-common-client/vapi_common_client-2.44.0-py2.py3-none-any.whl"}
vapi-runtime = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vapi-runtime/vapi_runtime-2.44.0-py2.py3-none-any.whl"}
vcenter-bindings = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vcenter-bindings/vcenter_bindings-4.2.0-py2.py3-none-any.whl"}
vmwarecloud-aws = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vmwarecloud-aws/vmwarecloud_aws-1.64.0-py2.py3-none-any.whl"}
vmwarecloud-draas = {url = "https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vmwarecloud-draas/vmwarecloud_draas-1.23.0-py2.py3-none-any.whl"}
# end of vsphere-automation-sdk work around
I asked to ChatGPT to write a python script to automate the dependency list, it takes vsphere-automation-sdk-python tag as first arg to generate the list.
$ python script.py v8.0.2.0
# vsphere-automation-sdk work around
vsphere-automation-sdk = {url = https://github.com/vmware/vsphere-automation-sdk-python/archive/refs/tags/v8.0.2.0.tar.gz}
nsx-policy-python-sdk = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl}
nsx-python-sdk = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-python-sdk/nsx_python_sdk-4.1.2.0.0-py2.py3-none-any.whl}
nsx-vmc-aws-integration-python-sdk = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.1.2.0.0-py2.py3-none-any.whl}
nsx-vmc-policy-python-sdk = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl}
vapi-common-client = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vapi-common-client/vapi_common_client-2.44.0-py2.py3-none-any.whl}
vapi-runtime = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vapi-runtime/vapi_runtime-2.44.0-py2.py3-none-any.whl}
vcenter-bindings = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vcenter-bindings/vcenter_bindings-4.2.0-py2.py3-none-any.whl}
vmwarecloud-aws = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vmwarecloud-aws/vmwarecloud_aws-1.64.0-py2.py3-none-any.whl}
vmwarecloud-draas = {url = https://github.com/vmware/vsphere-automation-sdk-python/raw/v8.0.2.0/lib/vmwarecloud-draas/vmwarecloud_draas-1.23.0-py2.py3-none-any.whl}
# end of vsphere-automation-sdk work around
Here is the python script:
import os
import glob
import requests
import argparse
# Parsing the command line argument for the Git tag
parser = argparse.ArgumentParser(description='Generate a list of .whl files from the vsphere-automation-sdk-python repo for a given Git tag.')
parser.add_argument('tag', help='The Git tag to search for .whl files')
args = parser.parse_args()
# Setting up the base URL and the target directory
base_url = "https://github.com/vmware/vsphere-automation-sdk-python"
target_dir = "lib"
def get_whl_files(tag):
# Construct the URL to download the archive of the given tag
archive_url = f"{base_url}/archive/refs/tags/{tag}.tar.gz"
# List to hold the paths of .whl files
whl_files = []
# Construct the API URL to fetch the contents of the lib directory at the given tag
api_url = f"https://api.github.com/repos/vmware/vsphere-automation-sdk-python/git/trees/{tag}?recursive=1"
# Make a request to the GitHub API
response = requests.get(api_url)
if response.status_code == 200:
data = response.json()
for file in data.get('tree', []):
# Check if the file is in the lib directory and is a .whl file
if file['path'].startswith(target_dir) and file['path'].endswith('.whl'):
# Construct the raw URL for the file
raw_file_url = f"{base_url}/raw/{tag}/{file['path']}"
whl_files.append(raw_file_url)
else:
print(f"Failed to retrieve data: {response.status_code}")
return whl_files
def main():
# Retrieve the .whl files for the given tag
whl_files = get_whl_files(args.tag)
# Generate the output file content
output = []
output.append("# vsphere-automation-sdk work around")
output.append(f"vsphere-automation-sdk = {{url = \"{base_url}/archive/refs/tags/{args.tag}.tar.gz\"}}")
for whl in whl_files:
lib_name = whl.split('/')[-2]
output.append(f"{lib_name} = {{url = \"{whl}\"}}")
output.append("# end of vsphere-automation-sdk work around")
# Print the output to the console
print("\n".join(output))
if __name__ == "__main__":
main()
Describe the bug
poetry add vsphere-automation-sdk
gives :Reproduction steps
poetry add vsphere-automation-sdk
Expected behavior
poetry add vsphere-automation-sdk
to work, and versions be coherent between github and pypi.Additional context
Related : https://github.com/vmware/vsphere-automation-sdk-python/issues/354 and https://github.com/vmware/vsphere-automation-sdk-python/issues/200