Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: install index url missing from high level doc and incorrect docstring: #116

Open
Carreau opened this issue Jun 28, 2024 · 2 comments
Open

Comments

@Carreau
Copy link
Contributor

Carreau commented Jun 28, 2024

- The index URL should support the
`JSON API <https://warehouse.pypa.io/api-reference/json/>`__ .

state that index "should support json api", as far as I can tell this is not true as we can see that Transation will use query_package:

_fetch_kwargs["headers"].setdefault(
"accept", "application/vnd.pypi.simple.v1+json, */*;q=0.01"
)
if index_urls is None:
index_urls = INDEX_URLS
elif isinstance(index_urls, str):
index_urls = [index_urls]
for url in index_urls:
if _contain_placeholder(url):
url = url.format(package_name=name)
else:
url = f"{url}/{name}/"
try:
metadata, headers = await fetch_string_and_headers(url, _fetch_kwargs)
except OSError:
continue
content_type = headers.get("content-type", "").lower()
parser = _select_parser(content_type, name)
return parser(metadata)

def from_simple_html_api(data: str, pkgname: str) -> "ProjectInfo":
"""
Parse Simple HTML API response
https://peps.python.org/pep-0503
"""
project_detail = from_project_details_html(data, pkgname)
name, releases = ProjectInfo._parse_pep691_response(project_detail) # type: ignore[arg-type]
return ProjectInfo._compatible_only(name, releases)

which does support simple API.

(I have not tried though).

I think mentioning index could also be added in the pyodide documentation itslef in adiition to direct URLS:

https://github.com/pyodide/pyodide/blob/9f49030ef511296574885720282887bea6c6fd54/docs/usage/loading-packages.md#installing-wheels-from-arbitrary-urls

@ryanking13
Copy link
Member

Thanks. You are right. micropip now support Simple APIs (both HTML and JSON). Could you open a PR?

@Carreau
Copy link
Contributor Author

Carreau commented Jun 28, 2024

Yes, I can send a pr a bit later. I'll try to do both one here, and on Pyodide to document it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants