Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
"""Setup for pip package."""

import re

from setuptools import find_namespace_packages
from setuptools import setup


def _get_sonnet_version():
with open('sonnet/__init__.py') as fp:
for line in fp:
if line.startswith('__version__'):
g = {}
exec(line, g) # pylint: disable=exec-used
return g['__version__']
raise ValueError('`__version__` not defined in `sonnet/__init__.py`')
content = fp.read()
match = re.search(r"__version__\s*=\s*['\"]([^'\"]+)['\"]", content)
if match:
return match.group(1)
raise ValueError('`__version__` not defined in `sonnet/__init__.py`')


def _parse_requirements(requirements_txt_path):
Expand Down