mirror of
https://github.com/correl/openapi-core.git
synced 2024-12-28 19:19:23 +00:00
Merge pull request #161 from p1c2u/feature/setup-config-refactor
Setup config file
This commit is contained in:
commit
f12b6d8445
3 changed files with 103 additions and 54 deletions
34
Makefile
Normal file
34
Makefile
Normal file
|
@ -0,0 +1,34 @@
|
|||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
PROJECT_NAME=openapi-core
|
||||
PACKAGE_NAME=$(subst -,_,${PROJECT_NAME})
|
||||
VERSION=`git describe --abbrev=0`
|
||||
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
params:
|
||||
@echo "Project name: ${PROJECT_NAME}"
|
||||
@echo "Package name: ${PACKAGE_NAME}"
|
||||
@echo "Version: ${VERSION}"
|
||||
|
||||
dist-build:
|
||||
@python setup.py bdist_wheel
|
||||
|
||||
dist-cleanup:
|
||||
@rm -rf build dist ${PACKAGE_NAME}.egg-info
|
||||
|
||||
dist-upload:
|
||||
@twine upload dist/*.whl
|
||||
|
||||
test-python:
|
||||
@python setup.py test
|
||||
|
||||
test-cache-cleanup:
|
||||
@rm -rf .pytest_cache
|
||||
|
||||
reports-cleanup:
|
||||
@rm -rf reports
|
||||
|
||||
test-cleanup: test-cache-cleanup reports-cleanup
|
||||
|
||||
cleanup: dist-cleanup test-cleanup
|
49
setup.cfg
Normal file
49
setup.cfg
Normal file
|
@ -0,0 +1,49 @@
|
|||
[metadata]
|
||||
name = openapi-core
|
||||
long_description = file: README.rst
|
||||
long-description-content-type = text/x-rst; charset=UTF-8
|
||||
keywords = openapi, swagger, schema
|
||||
classifiers =
|
||||
Development Status :: 4 - Beta
|
||||
Intended Audience :: Developers
|
||||
Topic :: Software Development :: Libraries :: Python Modules
|
||||
Operating System :: OS Independent
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 3.5
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Topic :: Software Development :: Libraries
|
||||
|
||||
[options]
|
||||
include_package_data = True
|
||||
packages = find:
|
||||
zip_safe = False
|
||||
test_suite = tests
|
||||
python_requires = >= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*, != 3.4.*
|
||||
setup_requires =
|
||||
setuptools
|
||||
install_requires =
|
||||
openapi-spec-validator
|
||||
six
|
||||
lazy-object-proxy
|
||||
strict_rfc3339
|
||||
isodate
|
||||
attrs
|
||||
backports.functools-lru-cache; python_version<"3.0"
|
||||
backports.functools-partialmethod; python_version<"3.0"
|
||||
tests_require =
|
||||
mock; python_version<"3.0"
|
||||
pytest
|
||||
pytest-flake8
|
||||
pytest-cov
|
||||
flask
|
||||
|
||||
[options.packages.find]
|
||||
exclude =
|
||||
tests
|
||||
|
||||
[options.extras_require]
|
||||
flask = werkzeug
|
||||
|
||||
[tool:pytest]
|
||||
addopts = -sv --flake8 --junitxml reports/junit.xml --cov openapi_core --cov-report term-missing --cov-report xml:reports/coverage.xml tests
|
74
setup.py
74
setup.py
|
@ -1,16 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
"""OpenAPI core setup module"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
|
||||
def read_requirements(filename):
|
||||
"""Open a requirements file and return list of its lines."""
|
||||
contents = read_file(filename).strip('\n')
|
||||
return contents.split('\n') if contents else []
|
||||
try:
|
||||
from setuptools import setup
|
||||
except ImportError:
|
||||
from ez_setup import use_setuptools
|
||||
use_setuptools()
|
||||
from setuptools import setup
|
||||
finally:
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
|
||||
def read_file(filename):
|
||||
|
@ -25,32 +25,17 @@ def get_metadata(init_file):
|
|||
return dict(re.findall("__([a-z]+)__ = '([^']+)'", init_file))
|
||||
|
||||
|
||||
def install_requires():
|
||||
py27 = '_2.7' if sys.version_info < (3,) else ''
|
||||
return read_requirements('requirements{}.txt'.format(py27))
|
||||
|
||||
|
||||
class PyTest(TestCommand):
|
||||
|
||||
"""Command to run unit tests after in-place build."""
|
||||
|
||||
def finalize_options(self):
|
||||
TestCommand.finalize_options(self)
|
||||
self.test_args = [
|
||||
'-sv',
|
||||
'--flake8',
|
||||
'--junitxml', 'reports/junit.xml',
|
||||
'--cov', 'openapi_core',
|
||||
'--cov-report', 'term-missing',
|
||||
'--cov-report', 'xml:reports/coverage.xml',
|
||||
'tests',
|
||||
]
|
||||
self.test_suite = True
|
||||
self.pytest_args = []
|
||||
|
||||
def run_tests(self):
|
||||
# Importing here, `cause outside the eggs aren't loaded.
|
||||
import pytest
|
||||
errno = pytest.main(self.test_args)
|
||||
errno = pytest.main(self.pytest_args)
|
||||
sys.exit(errno)
|
||||
|
||||
|
||||
|
@ -59,31 +44,12 @@ init_py = read_file(init_path)
|
|||
metadata = get_metadata(init_py)
|
||||
|
||||
|
||||
setup(
|
||||
name='openapi-core',
|
||||
version=metadata['version'],
|
||||
author=metadata['author'],
|
||||
author_email=metadata['email'],
|
||||
url=metadata['url'],
|
||||
long_description=read_file("README.rst"),
|
||||
packages=find_packages(include=('openapi_core*',)),
|
||||
include_package_data=True,
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
'Intended Audience :: Developers',
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Operating System :: OS Independent",
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Topic :: Software Development :: Libraries',
|
||||
],
|
||||
install_requires=install_requires(),
|
||||
tests_require=read_requirements('requirements_dev.txt'),
|
||||
extras_require={
|
||||
'flask': ["werkzeug"],
|
||||
},
|
||||
cmdclass={'test': PyTest},
|
||||
zip_safe=False,
|
||||
)
|
||||
if __name__ == '__main__':
|
||||
setup(
|
||||
version=metadata['version'],
|
||||
author=metadata['author'],
|
||||
author_email=metadata['email'],
|
||||
url=metadata['url'],
|
||||
cmdclass={'test': PyTest},
|
||||
setup_cfg=True,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue