How to import a local package, e.g biopython

After installing biopython locally … pip install biopython

How do I import biopython in PyScripts?


If you’re using a package on PyPI, no need to install it with pip

Add a <py-config> tag to the body of your html page, and use the paths parameter to specify the name of the file to load from PyPI. See the py-config section of the Getting Started guide.

Looking at one of the included example files in the PyScript download, you can see exactly how <py-config> is used. I show part of it below: note how matplotlib is included and then later imported in the code :
Also, read the doc mentioned by Jeff.

    <meta charset="utf-8">
    <link rel="icon" type="image/x-icon" href="./favicon.png">
    <link rel="stylesheet" href="" />
    <script defer src=""></script>
      <div id="mpl"></div>

        packages = [

      <py-script output="mpl">
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np

# First create the x and y coordinates of the points.
n_angles = 36
n_radii = 8
min_radius = 0.25
radii = np.linspace(min_radius, 0.95, n_radii)

…(rest of code cut off).