Skip to content

Commit

Permalink
Fix setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
thcrock committed Feb 12, 2018
1 parent 0ec9aee commit 230a661
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,47 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import re
from pathlib import Path
from setuptools import setup

with open('README.md') as readme_file:
readme = readme_file.read()

with open('LICENSE') as license_file:
license = license_file.read()
ROOT_PATH = Path(__file__).parent

with open('requirements.txt') as requirements_file:
requirements = requirements_file.readlines()
LICENSE_PATH = ROOT_PATH / 'LICENSE'

README_PATH = ROOT_PATH / 'README.md'

REQUIREMENTS_PATH = ROOT_PATH / 'requirements.txt'

REQUIREMENTS_TEST_PATH = ROOT_PATH / 'requirements_dev.txt'


def stream_requirements(fd):
"""For a given requirements file descriptor, generate lines of
distribution requirements, ignoring comments and chained requirement
files.
"""
for line in fd:
cleaned = re.sub(r'#.*$', '', line).strip()
if cleaned and not cleaned.startswith('-r'):
yield cleaned


with REQUIREMENTS_PATH.open() as requirements_file:
REQUIREMENTS = list(stream_requirements(requirements_file))


with REQUIREMENTS_TEST_PATH.open() as test_requirements_file:
REQUIREMENTS_TEST = REQUIREMENTS[:]
REQUIREMENTS_TEST.extend(stream_requirements(test_requirements_file))

with open('requirements_dev.txt') as requirements_dev_file:
test_requirements = requirements + requirements_dev_file.readlines()

setup(
name='results_schema',
version='1.2.1',
description="Store results of modeling runs",
long_description=readme,
long_description=README_PATH.read_text(),
author="Center for Data Science and Public Policy",
author_email='[email protected]',
url='https://github.com/dssg/results-schema',
Expand All @@ -29,9 +51,9 @@
'results_schema.alembic.versions',
],
include_package_data=True,
install_requires=requirements,
tests_require=test_requirements,
license=license,
install_requires=REQUIREMENTS,
tests_require=REQUIREMENTS_TEST,
license=LICENSE_PATH.read_text(),
zip_safe=False,
keywords='analytics datascience modeling modelevaluation',
classifiers=[
Expand Down

0 comments on commit 230a661

Please sign in to comment.