Fix installed model URL method and CI test

This commit is contained in:
Adriane Boyd 2023-03-06 12:11:06 +01:00
parent 586ec16114
commit e106e502bb
2 changed files with 3 additions and 3 deletions

View File

@ -60,8 +60,8 @@ steps:
condition: eq(variables['python_version'], '3.8') condition: eq(variables['python_version'], '3.8')
- script: | - script: |
python -W error -m spacy info ca_core_news_sm --url python -W error -m spacy info ca_core_news_sm | grep -q download_url
displayName: 'Test info --url CLI' displayName: 'Test download_url in info CLI'
condition: eq(variables['python_version'], '3.8') condition: eq(variables['python_version'], '3.8')
- script: | - script: |

View File

@ -138,7 +138,7 @@ def info_installed_model_url(model: str) -> Optional[str]:
""" """
try: try:
dist = importlib_metadata.distribution(model) dist = importlib_metadata.distribution(model)
data = dist.read_text("direct_url.json") data = json.loads(dist.read_text("direct_url.json"))
return data["url"] return data["url"]
except importlib_metadata.PackageNotFoundError: except importlib_metadata.PackageNotFoundError:
# no such package # no such package