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

Make it possible to check/validate requirements and versions online #670

Open
pradyunsg opened this issue Jan 23, 2023 · 2 comments
Open

Comments

@pradyunsg
Copy link
Member

pradyunsg commented Jan 23, 2023

I'm imagining this would help users hit by #631 and friends. Pyodide seems like the right tool for the job.

/cc @rth in case he has thoughts on how we could use packaging from the current-latest PyPI release.

@brettcannon
Copy link
Member

So you're basically looking to create a web page where you can feed in something like a pyproject.toml and have it validate it?

And this is probably a good use of https://pyscript.net/ to build a quick-and-easy web UI wrapping some Python code.

@rth
Copy link

rth commented Jan 26, 2023

Yes it could be done with Pyscript, or plain HTML/JS with a bit of Pyodide. Here is a very basic version https://jsfiddle.net/z9bkhq6c/2/ (which does only version checking, not parsing of pyproject.toml)

how we could use packaging from the current-latest PyPI release.

Yes, so right now it doesn't seem possible to install a different version of packaging than the one we ship pyodide/micropip#51 (because it's already loaded as a dependency of micropip) but that should probably be fixed.

A simpler solution is to load the wheel by URL using pyodide_js.loadPackage

>>> import pyodide_js
>>> await pyodide_js.loadPackage('https://files.pythonhosted.org/packages/ed/35/a31aed2993e398f6b09a790a181a7927eb1
4610ee8bbf02dc14d31677f1c/packaging-23.0-py3-none-any.whl'
... )
>>> import packaging
>>> packaging.__version__
'23.0'

which should work both in Pyodide and Pyscript.

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

No branches or pull requests

3 participants