mirror of https://github.com/pyodide/pyodide.git
Add documentation
This commit is contained in:
parent
ac68a30511
commit
76237050eb
27
docs/pypi.md
27
docs/pypi.md
|
@ -22,7 +22,7 @@ For use outside of Iodide (just Python), you can use the `then` method on the
|
||||||
`Promise` that `micropip.install` returns to do work once the packages have
|
`Promise` that `micropip.install` returns to do work once the packages have
|
||||||
finished loading:
|
finished loading:
|
||||||
|
|
||||||
```
|
```py
|
||||||
def do_work(*args):
|
def do_work(*args):
|
||||||
import snowballstemmer
|
import snowballstemmer
|
||||||
stemmer = snowballstemmer.stemmer('english')
|
stemmer = snowballstemmer.stemmer('english')
|
||||||
|
@ -32,6 +32,31 @@ import micropip
|
||||||
micropip.install('snowballstemmer').then(do_work)
|
micropip.install('snowballstemmer').then(do_work)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
File integrity validation is implementing by checking the hash of the downloaded
|
||||||
|
wheel against pre-recorded hash digests from the PyPi JSON API.
|
||||||
|
|
||||||
|
## Installing wheels from arbitrary URLs
|
||||||
|
|
||||||
|
Pure python wheels can also be installed from any URL with micropip,
|
||||||
|
```py
|
||||||
|
import micropip
|
||||||
|
micropip.install(
|
||||||
|
'https://example.com/files/snowballstemmer-2.0.0-py2.py3-none-any.whl'
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
The wheel name in the URL must follow [PEP 427 naming
|
||||||
|
convention](https://www.python.org/dev/peps/pep-0427/#file-format), which will
|
||||||
|
be the case if the wheels is made using standard python tools (`wheel`,
|
||||||
|
`setup.py bdist_wheel`).
|
||||||
|
|
||||||
|
The remote server must set Cross-Origin Resource Sharing (CORS) headers to
|
||||||
|
allow access. Otherwise, you can prepend a CORS proxy to the URL. Note however
|
||||||
|
that using third-party CORS proxies has security implications, particularly
|
||||||
|
since we are not able to check the file integrity, unlike with installs from
|
||||||
|
PyPi.
|
||||||
|
|
||||||
|
|
||||||
## Complete example
|
## Complete example
|
||||||
|
|
||||||
Adapting the setup from the section on ["using pyodide from
|
Adapting the setup from the section on ["using pyodide from
|
||||||
|
|
Loading…
Reference in New Issue