Skip to content

Commit

Permalink
refactor: use requirements.txt for install_requires
Browse files Browse the repository at this point in the history
  • Loading branch information
devstein committed Dec 31, 2022
1 parent 58dbf35 commit 1bd4417
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 35 deletions.
16 changes: 9 additions & 7 deletions autovizwidget/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ def read(path, encoding="utf-8"):
return fp.read()


# read requirements.txt and convert to install_requires format
def requirements(path):
lines = read(path).splitlines()
# remove comments and empty lines
lines = [line for line in lines if not line.startswith("#") and line]
return lines


def version(path):
"""Obtain the package version from a python file e.g. pkg/__init__.py.
Expand Down Expand Up @@ -60,11 +68,5 @@ def version(path):
"Natural Language :: English",
"Programming Language :: Python :: 3.7",
],
install_requires=[
"plotly>=3",
"ipywidgets>5.0.0",
"hdijupyterutils>=0.6",
"notebook>=4.2",
"pandas>=0.20.1",
],
install_requires=requirements("requirements.txt"),
)
21 changes: 9 additions & 12 deletions hdijupyterutils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ def read(path, encoding="utf-8"):
return fp.read()


# read requirements.txt and convert to install_requires format
def requirements(path):
lines = read(path).splitlines()
# remove comments and empty lines
lines = [line for line in lines if not line.startswith("#") and line]
return lines


def version(path):
"""Obtain the package version from a python file e.g. pkg/__init__.py.
Expand All @@ -36,7 +44,6 @@ def version(path):

VERSION = version("hdijupyterutils/__init__.py")


setup(
name=NAME,
version=VERSION,
Expand All @@ -55,15 +62,5 @@ def version(path):
"Natural Language :: English",
"Programming Language :: Python :: 3.7",
],
install_requires=[
"ipython>=5",
"nose",
"mock",
"ipywidgets>5.0.0",
"ipykernel>=4.2.2",
"jupyter>=1",
"pandas>=0.17.1",
"numpy",
"notebook>=4.2",
],
install_requires=requirements("requirements.txt"),
)
25 changes: 9 additions & 16 deletions sparkmagic/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ def read(path, encoding="utf-8"):
return fp.read()


# read requirements.txt and convert to install_requires format
def requirements(path):
lines = read(path).splitlines()
# remove comments and empty lines
lines = [line for line in lines if not line.startswith("#") and line]
return lines


def version(path):
"""Obtain the package version from a python file e.g. pkg/__init__.py.
Expand Down Expand Up @@ -79,20 +87,5 @@ def version(path):
"Natural Language :: English",
"Programming Language :: Python :: 3.7",
],
install_requires=[
"hdijupyterutils>=0.6",
"autovizwidget>=0.6",
"ipython>=5",
"nose",
"mock",
"pandas>=0.17.1",
"numpy",
"requests",
"ipykernel>=4.2.2",
"ipywidgets>5.0.0",
"notebook>=4.2",
"tornado>=4",
"requests_kerberos>=0.8.0",
"nest_asyncio==1.5.5",
],
install_requires=requirements("requirements.txt"),
)

0 comments on commit 1bd4417

Please sign in to comment.