Skip to content

Commit

Permalink
Build: Use setup.py to control dependencies and remove requirements f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
chenjr0719 committed Jun 10, 2019
1 parent 42f53b7 commit 1079e15
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 25 deletions.
2 changes: 0 additions & 2 deletions dev-requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

62 changes: 40 additions & 22 deletions setup.py
Expand Up @@ -4,36 +4,54 @@
import codecs
import os
import re

from setuptools import setup

install_requires = ["sanic>=18.12.0"]

dev_requires = ["black==19.3b0", "flake8==3.7.7", "isort==4.3.19"]

test_requires = [
"coverage==4.5.3",
"pytest==4.6.2",
"pytest-cov==2.7.1",
"pytest-runner==5.1",
"tox==3.12.1",
]

with codecs.open(os.path.join(os.path.abspath(os.path.dirname(
__file__)), 'sanic_openapi', '__init__.py'), 'r', 'latin1') as fp:
project_root = os.path.dirname(os.path.abspath(__file__))

with codecs.open(
os.path.join(project_root, "sanic_openapi", "__init__.py"), "r", "latin1"
) as fp:
try:
version = re.findall(r"^__version__ = '([^']+)'\r?$",
fp.read(), re.M)[0]
version = re.findall(r"^__version__ = '([^']+)'\r?$", fp.read(), re.M)[0]
except IndexError:
raise RuntimeError('Unable to determine version.')
raise RuntimeError("Unable to determine version.")

with open(os.path.join(project_root, "README.md"), "r") as f:
long_description = f.read()

setup(
name='sanic-openapi',
name="sanic-openapi",
version=version,
url='http://github.com/channelcat/sanic-openapi/',
license='MIT',
author='Channel Cat',
author_email='channelcat@gmail.com',
description='OpenAPI support for Sanic',
packages=['sanic_openapi'],
package_data={'sanic_openapi': ['ui/*']},
platforms='any',
install_requires=[
'sanic>=0.7.0',
],
url="http://github.com/channelcat/sanic-openapi/",
license="MIT",
author="Sanic Community",
description="Easily document your Sanic API with a UI.",
long_description=long_description,
long_description_content_type="text/markdown",
packages=["sanic_openapi"],
package_data={"sanic_openapi": ["ui/*"]},
platforms="any",
install_requires=install_requires,
extras_require={"dev": dev_requires + test_requires, "test": test_requires},
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Environment :: Web Environment',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
"Development Status :: 2 - Pre-Alpha",
"Environment :: Web Environment",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
)

0 comments on commit 1079e15

Please sign in to comment.