prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Use `importlib.metadata` to get package version instead of `pkg_resources`
  Now that we're using Python 3.8+, we should switch to using `importlib.metadata` to get our version at runtime in `plasmapy/__init__.py`.  We're using `pkg_resources` right now, but that has a "[significant runtime cost](https://github.com/pypa/setuptools_scm/#retrieving-package-version-at-runtime)".
  
  </issue>
  <code>
  [start of plasmapy/__init__.py]
  1 """
  2 Welcome to the `plasmapy` package, an open source community-developed Python
  3 package for the plasma community.  Documentation is available in the docstrings
  4 and online at https://docs.plasmapy.org (accessible also using the
  5 :func:`~plasmapy.online_help` function).
  6 """
  7 __all__ = [
  8     "online_help",
  9     "analysis",
  10     "diagnostics",
  11     "dispersion",
  12     "formulary",
  13     "particles",
  14     "plasma",
  15     "simulation",
  16     "utils",
  17     "__version__",
  18     "__citation__",
  19 ]
  20 
  21 # Enforce Python version check during package import.
  22 # This is the same check as the one at the top of setup.py
  23 import sys
  24 
  25 if sys.version_info < (3, 8):  # coverage: ignore
  26     raise ImportError("PlasmaPy does not support Python < 3.8")
  27 
  28 # Packages may add whatever they like to this file, but
  29 # should keep this content at the top.
  30 # ----------------------------------------------------------------------------
  31 import pkg_resources
  32 
  33 from plasmapy import (
  34     analysis,
  35     diagnostics,
  36     dispersion,
  37     formulary,
  38     particles,
  39     plasma,
  40     simulation,
  41     utils,
  42 )
  43 
  44 # define version
  45 try:
  46     # this places a runtime dependency on setuptools
  47     #
  48     # note: if there's any distribution metadata in your source files, then this
  49     #       will find a version based on those files.  Keep distribution metadata
  50     #       out of your repository unless you've intentionally installed the package
  51     #       as editable (e.g. `pip install -e {plasmapy_directory_root}`),
  52     #       but then __version__ will not be updated with each commit, it is
  53     #       frozen to the version at time of install.
  54     #
  55     #: PlasmaPy version string
  56     __version__ = pkg_resources.get_distribution("plasmapy").version
  57 except pkg_resources.DistributionNotFound:
  58     # package is not installed
  59     fallback_version = "unknown"
  60     try:
  61         # code most likely being used from source
  62         # if setuptools_scm is installed then generate a version
  63         from setuptools_scm import get_version
  64 
  65         __version__ = get_version(
  66             root="..", relative_to=__file__, fallback_version=fallback_version
  67         )
  68         del get_version
  69         warn_add = "setuptools_scm failed to detect the version"
  70     except ModuleNotFoundError:
  71         # setuptools_scm is not installed
  72         __version__ = fallback_version
  73         warn_add = "setuptools_scm is not installed"
  74 
  75     if __version__ == fallback_version:
  76         from warnings import warn
  77 
  78         warn(
  79             f"plasmapy.__version__ not generated (set to 'unknown'), PlasmaPy is "
  80             f"not an installed package and {warn_add}.",
  81             RuntimeWarning,
  82         )
  83 
  84         del warn
  85     del fallback_version, warn_add
  86 
  87 # ----------------------------------------------------------------------------
  88 #: PlasmaPy citation instructions
  89 __citation__ = (
  90     "Instructions on how to cite and acknowledge PlasmaPy are provided in the "
  91     "online documentation at: http://docs.plasmapy.org/en/stable/about/citation.html"
  92 )
  93 
  94 
  95 def online_help(query: str):
  96     """
  97     Open a webpage containing a search page in `PlasmaPy's documentation`_,
  98     or another page that contains relevant online help.
  99 
  100     This function requires an active internet connection, and will open
  101     the page in the default web browser.
  102 
  103     Parameters
  104     ----------
  105     query : str
  106         The search query.
  107     """
  108     import webbrowser
  109 
  110     from urllib.parse import urlencode
  111 
  112     url = (
  113         "http://docs.plasmapy.org/en/stable/search.html?"
  114         "{}&check_keywords=yes&area=default"
  115     ).format(urlencode({"q": query}))
  116 
  117     if query.lower() in ("unit", "units", "quantity", "quantities"):
  118         url = "http://docs.astropy.org/en/stable/units/"
  119 
  120     webbrowser.open(url)
  121 
  122 
  123 del pkg_resources, sys
  124
  [end of plasmapy/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/plasmapy/__init__.py b/plasmapy/__init__.py
  --- a/plasmapy/__init__.py
  +++ b/plasmapy/__init__.py
  @@ -28,7 +28,7 @@
   # Packages may add whatever they like to this file, but
   # should keep this content at the top.
   # ----------------------------------------------------------------------------
  -import pkg_resources
  +from importlib.metadata import PackageNotFoundError, version
   
   from plasmapy import (
       analysis,
  @@ -53,8 +53,8 @@
       #       frozen to the version at time of install.
       #
       #: PlasmaPy version string
  -    __version__ = pkg_resources.get_distribution("plasmapy").version
  -except pkg_resources.DistributionNotFound:
  +    __version__ = version("plasmapy")
  +except PackageNotFoundError:
       # package is not installed
       fallback_version = "unknown"
       try:
  @@ -120,4 +120,4 @@
       webbrowser.open(url)
   
   
  -del pkg_resources, sys
  +del sys
  
verification_info: {"golden_diff": "diff --git a/plasmapy/__init__.py b/plasmapy/__init__.py\n--- a/plasmapy/__init__.py\n+++ b/plasmapy/__init__.py\n@@ -28,7 +28,7 @@\n # Packages may add whatever they like to this file, but\n # should keep this content at the top.\n # ----------------------------------------------------------------------------\n-import pkg_resources\n+from importlib.metadata import PackageNotFoundError, version\n \n from plasmapy import (\n     analysis,\n@@ -53,8 +53,8 @@\n     #       frozen to the version at time of install.\n     #\n     #: PlasmaPy version string\n-    __version__ = pkg_resources.get_distribution(\"plasmapy\").version\n-except pkg_resources.DistributionNotFound:\n+    __version__ = version(\"plasmapy\")\n+except PackageNotFoundError:\n     # package is not installed\n     fallback_version = \"unknown\"\n     try:\n@@ -120,4 +120,4 @@\n     webbrowser.open(url)\n \n \n-del pkg_resources, sys\n+del sys\n", "issue": "Use `importlib.metadata` to get package version instead of `pkg_resources`\nNow that we're using Python 3.8+, we should switch to using `importlib.metadata` to get our version at runtime in `plasmapy/__init__.py`.  We're using `pkg_resources` right now, but that has a \"[significant runtime cost](https://github.com/pypa/setuptools_scm/#retrieving-package-version-at-runtime)\".\n", "before_files": [{"content": "\"\"\"\nWelcome to the `plasmapy` package, an open source community-developed Python\npackage for the plasma community.  Documentation is available in the docstrings\nand online at https://docs.plasmapy.org (accessible also using the\n:func:`~plasmapy.online_help` function).\n\"\"\"\n__all__ = [\n    \"online_help\",\n    \"analysis\",\n    \"diagnostics\",\n    \"dispersion\",\n    \"formulary\",\n    \"particles\",\n    \"plasma\",\n    \"simulation\",\n    \"utils\",\n    \"__version__\",\n    \"__citation__\",\n]\n\n# Enforce Python version check during package import.\n# This is the same check as the one at the top of setup.py\nimport sys\n\nif sys.version_info < (3, 8):  # coverage: ignore\n    raise ImportError(\"PlasmaPy does not support Python < 3.8\")\n\n# Packages may add whatever they like to this file, but\n# should keep this content at the top.\n# ----------------------------------------------------------------------------\nimport pkg_resources\n\nfrom plasmapy import (\n    analysis,\n    diagnostics,\n    dispersion,\n    formulary,\n    particles,\n    plasma,\n    simulation,\n    utils,\n)\n\n# define version\ntry:\n    # this places a runtime dependency on setuptools\n    #\n    # note: if there's any distribution metadata in your source files, then this\n    #       will find a version based on those files.  Keep distribution metadata\n    #       out of your repository unless you've intentionally installed the package\n    #       as editable (e.g. `pip install -e {plasmapy_directory_root}`),\n    #       but then __version__ will not be updated with each commit, it is\n    #       frozen to the version at time of install.\n    #\n    #: PlasmaPy version string\n    __version__ = pkg_resources.get_distribution(\"plasmapy\").version\nexcept pkg_resources.DistributionNotFound:\n    # package is not installed\n    fallback_version = \"unknown\"\n    try:\n        # code most likely being used from source\n        # if setuptools_scm is installed then generate a version\n        from setuptools_scm import get_version\n\n        __version__ = get_version(\n            root=\"..\", relative_to=__file__, fallback_version=fallback_version\n        )\n        del get_version\n        warn_add = \"setuptools_scm failed to detect the version\"\n    except ModuleNotFoundError:\n        # setuptools_scm is not installed\n        __version__ = fallback_version\n        warn_add = \"setuptools_scm is not installed\"\n\n    if __version__ == fallback_version:\n        from warnings import warn\n\n        warn(\n            f\"plasmapy.__version__ not generated (set to 'unknown'), PlasmaPy is \"\n            f\"not an installed package and {warn_add}.\",\n            RuntimeWarning,\n        )\n\n        del warn\n    del fallback_version, warn_add\n\n# ----------------------------------------------------------------------------\n#: PlasmaPy citation instructions\n__citation__ = (\n    \"Instructions on how to cite and acknowledge PlasmaPy are provided in the \"\n    \"online documentation at: http://docs.plasmapy.org/en/stable/about/citation.html\"\n)\n\n\ndef online_help(query: str):\n    \"\"\"\n    Open a webpage containing a search page in `PlasmaPy's documentation`_,\n    or another page that contains relevant online help.\n\n    This function requires an active internet connection, and will open\n    the page in the default web browser.\n\n    Parameters\n    ----------\n    query : str\n        The search query.\n    \"\"\"\n    import webbrowser\n\n    from urllib.parse import urlencode\n\n    url = (\n        \"http://docs.plasmapy.org/en/stable/search.html?\"\n        \"{}&check_keywords=yes&area=default\"\n    ).format(urlencode({\"q\": query}))\n\n    if query.lower() in (\"unit\", \"units\", \"quantity\", \"quantities\"):\n        url = \"http://docs.astropy.org/en/stable/units/\"\n\n    webbrowser.open(url)\n\n\ndel pkg_resources, sys\n", "path": "plasmapy/__init__.py"}]}