prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  __version__
  ### Feature motivation
  Is there a way to dynamically poll the version of larq (or lce or larq-zoo for that matter)?
  If not, could it be done using `__version__` as usual for standard library modules?
  
  ### Feature description
  ```
  import larq
  print(larq.__version__)
  ```
  
  </issue>
  <code>
  [start of setup.py]
  1 from setuptools import find_packages, setup
  2 
  3 
  4 def readme():
  5     with open("README.md", "r") as f:
  6         return f.read()
  7 
  8 
  9 setup(
  10     name="larq",
  11     version="0.10.1",
  12     python_requires=">=3.6",
  13     author="Plumerai",
  14     author_email="opensource@plumerai.com",
  15     description="An Open Source Machine Learning Library for Training Binarized Neural Networks",
  16     long_description=readme(),
  17     long_description_content_type="text/markdown",
  18     url="https://larq.dev/",
  19     packages=find_packages(exclude=["larq.snapshots"]),
  20     license="Apache 2.0",
  21     install_requires=[
  22         "numpy >= 1.15.4, < 2.0",
  23         "terminaltables>=3.1.0",
  24         "dataclasses ; python_version<'3.7'",
  25     ],
  26     extras_require={
  27         "tensorflow": ["tensorflow>=1.14.0"],
  28         "tensorflow_gpu": ["tensorflow-gpu>=1.14.0"],
  29         "test": [
  30             "black==20.8b1",
  31             "flake8>=3.7.9,<3.9.0",
  32             "isort==5.6.4",
  33             "packaging>=19.2,<21.0",
  34             "pytest>=5.2.4,<6.2.0",
  35             "pytest-cov>=2.8.1,<2.11.0",
  36             "pytest-xdist>=1.30,<2.2",
  37             "pytest-mock>=2.0,<3.4",
  38             "pytype==2020.10.8",
  39             "snapshottest>=0.5.1,<0.7.0",
  40         ],
  41     },
  42     classifiers=[
  43         "Development Status :: 4 - Beta",
  44         "Intended Audience :: Developers",
  45         "Intended Audience :: Education",
  46         "Intended Audience :: Science/Research",
  47         "License :: OSI Approved :: Apache Software License",
  48         "Programming Language :: Python :: 3",
  49         "Programming Language :: Python :: 3 :: Only",
  50         "Programming Language :: Python :: 3.6",
  51         "Programming Language :: Python :: 3.7",
  52         "Programming Language :: Python :: 3.8",
  53         "Topic :: Scientific/Engineering",
  54         "Topic :: Scientific/Engineering :: Mathematics",
  55         "Topic :: Scientific/Engineering :: Artificial Intelligence",
  56         "Topic :: Software Development",
  57         "Topic :: Software Development :: Libraries",
  58         "Topic :: Software Development :: Libraries :: Python Modules",
  59     ],
  60 )
  61
  [end of setup.py]
  [start of larq/__init__.py]
  1 from larq import (
  2     activations,
  3     callbacks,
  4     constraints,
  5     context,
  6     layers,
  7     math,
  8     metrics,
  9     models,
  10     optimizers,
  11     quantizers,
  12     utils,
  13 )
  14 
  15 __all__ = [
  16     "layers",
  17     "activations",
  18     "callbacks",
  19     "constraints",
  20     "context",
  21     "math",
  22     "metrics",
  23     "models",
  24     "quantizers",
  25     "optimizers",
  26     "utils",
  27 ]
  28
  [end of larq/__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/larq/__init__.py b/larq/__init__.py
  --- a/larq/__init__.py
  +++ b/larq/__init__.py
  @@ -12,6 +12,14 @@
       utils,
   )
   
  +try:
  +    from importlib import metadata  # type: ignore
  +except ImportError:
  +    # Running on pre-3.8 Python; use importlib-metadata package
  +    import importlib_metadata as metadata  # type: ignore
  +
  +__version__ = metadata.version("larq")
  +
   __all__ = [
       "layers",
       "activations",
  diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -22,6 +22,7 @@
           "numpy >= 1.15.4, < 2.0",
           "terminaltables>=3.1.0",
           "dataclasses ; python_version<'3.7'",
  +        "importlib-metadata ~= 2.0 ; python_version<'3.8'",
       ],
       extras_require={
           "tensorflow": ["tensorflow>=1.14.0"],
  
verification_info: {"golden_diff": "diff --git a/larq/__init__.py b/larq/__init__.py\n--- a/larq/__init__.py\n+++ b/larq/__init__.py\n@@ -12,6 +12,14 @@\n     utils,\n )\n \n+try:\n+    from importlib import metadata  # type: ignore\n+except ImportError:\n+    # Running on pre-3.8 Python; use importlib-metadata package\n+    import importlib_metadata as metadata  # type: ignore\n+\n+__version__ = metadata.version(\"larq\")\n+\n __all__ = [\n     \"layers\",\n     \"activations\",\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -22,6 +22,7 @@\n         \"numpy >= 1.15.4, < 2.0\",\n         \"terminaltables>=3.1.0\",\n         \"dataclasses ; python_version<'3.7'\",\n+        \"importlib-metadata ~= 2.0 ; python_version<'3.8'\",\n     ],\n     extras_require={\n         \"tensorflow\": [\"tensorflow>=1.14.0\"],\n", "issue": "__version__\n### Feature motivation\r\nIs there a way to dynamically poll the version of larq (or lce or larq-zoo for that matter)?\r\nIf not, could it be done using `__version__` as usual for standard library modules?\r\n\r\n### Feature description\r\n```\r\nimport larq\r\nprint(larq.__version__)\r\n```\n", "before_files": [{"content": "from setuptools import find_packages, setup\n\n\ndef readme():\n    with open(\"README.md\", \"r\") as f:\n        return f.read()\n\n\nsetup(\n    name=\"larq\",\n    version=\"0.10.1\",\n    python_requires=\">=3.6\",\n    author=\"Plumerai\",\n    author_email=\"opensource@plumerai.com\",\n    description=\"An Open Source Machine Learning Library for Training Binarized Neural Networks\",\n    long_description=readme(),\n    long_description_content_type=\"text/markdown\",\n    url=\"https://larq.dev/\",\n    packages=find_packages(exclude=[\"larq.snapshots\"]),\n    license=\"Apache 2.0\",\n    install_requires=[\n        \"numpy >= 1.15.4, < 2.0\",\n        \"terminaltables>=3.1.0\",\n        \"dataclasses ; python_version<'3.7'\",\n    ],\n    extras_require={\n        \"tensorflow\": [\"tensorflow>=1.14.0\"],\n        \"tensorflow_gpu\": [\"tensorflow-gpu>=1.14.0\"],\n        \"test\": [\n            \"black==20.8b1\",\n            \"flake8>=3.7.9,<3.9.0\",\n            \"isort==5.6.4\",\n            \"packaging>=19.2,<21.0\",\n            \"pytest>=5.2.4,<6.2.0\",\n            \"pytest-cov>=2.8.1,<2.11.0\",\n            \"pytest-xdist>=1.30,<2.2\",\n            \"pytest-mock>=2.0,<3.4\",\n            \"pytype==2020.10.8\",\n            \"snapshottest>=0.5.1,<0.7.0\",\n        ],\n    },\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: Education\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Topic :: Scientific/Engineering\",\n        \"Topic :: Scientific/Engineering :: Mathematics\",\n        \"Topic :: Scientific/Engineering :: Artificial Intelligence\",\n        \"Topic :: Software Development\",\n        \"Topic :: Software Development :: Libraries\",\n        \"Topic :: Software Development :: Libraries :: Python Modules\",\n    ],\n)\n", "path": "setup.py"}, {"content": "from larq import (\n    activations,\n    callbacks,\n    constraints,\n    context,\n    layers,\n    math,\n    metrics,\n    models,\n    optimizers,\n    quantizers,\n    utils,\n)\n\n__all__ = [\n    \"layers\",\n    \"activations\",\n    \"callbacks\",\n    \"constraints\",\n    \"context\",\n    \"math\",\n    \"metrics\",\n    \"models\",\n    \"quantizers\",\n    \"optimizers\",\n    \"utils\",\n]\n", "path": "larq/__init__.py"}]}