forked from jazzband/djangorestframework-simplejwt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0b01b72
Showing
22 changed files
with
450 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
*.pyc | ||
*.db | ||
*~ | ||
.* | ||
|
||
/site/ | ||
/htmlcov/ | ||
/coverage/ | ||
/build/ | ||
/dist/ | ||
/*.egg-info/ | ||
/env/ | ||
MANIFEST | ||
coverage.* | ||
|
||
!.gitignore | ||
!.travis.yml | ||
!.isort.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[settings] | ||
skip=.tox | ||
atomic=true | ||
multi_line_output=5 | ||
known_standard_library=types | ||
known_third_party=pytest,django | ||
known_first_party=rest_framework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
language: python | ||
|
||
python: | ||
- "2.7" | ||
- "3.4" | ||
- "3.5" | ||
|
||
sudo: false | ||
|
||
env: | ||
- DJANGO=1.8 | ||
- DJANGO=1.9 | ||
- DJANGO=1.10 | ||
- DJANGO=1.11 | ||
- DJANGO=master | ||
|
||
matrix: | ||
fast_finish: true | ||
include: | ||
- python: "3.6" | ||
env: DJANGO=master | ||
- python: "3.6" | ||
env: DJANGO=1.11 | ||
- python: "3.3" | ||
env: DJANGO=1.8 | ||
- python: "2.7" | ||
env: TOXENV="lint" | ||
- python: "2.7" | ||
env: TOXENV="docs" | ||
exclude: | ||
- python: "2.7" | ||
env: DJANGO=master | ||
- python: "3.4" | ||
env: DJANGO=master | ||
|
||
allow_failures: | ||
- env: DJANGO=master | ||
|
||
install: | ||
- pip install tox tox-travis | ||
|
||
script: | ||
- tox | ||
|
||
after_success: | ||
- pip install codecov | ||
- codecov -e TOXENV,DJANGO | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright 2017 David Sanders | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include README.rst | ||
include LICENSE.txt | ||
recursive-exclude * __pycache__ | ||
recursive-exclude * *.py[co] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Simple JWT | ||
========== | ||
|
||
A bare-bones JSON Web Token authentication plugin for the `Django REST | ||
Framework <http://www.django-rest-framework.org/>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
coverage: | ||
status: | ||
project: false | ||
patch: false | ||
changes: false | ||
|
||
comment: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# License | ||
|
||
Copyright (c) 2011-2017, Tom Christie | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
Redistributions in binary form must reproduce the above copyright notice, this | ||
list of conditions and the following disclaimer in the documentation and/or | ||
other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-r requirements/requirements-codestyle.txt | ||
-r requirements/requirements-packaging.txt | ||
-r requirements/requirements-testing.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
flake8==2.4.0 | ||
pep8==1.5.7 | ||
isort==4.2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
wheel==0.29.0 | ||
twine==1.6.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytest==3.0.5 | ||
pytest-django==3.1.2 | ||
pytest-cov==2.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#! /usr/bin/env python | ||
from __future__ import print_function, unicode_literals | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
|
||
import pytest | ||
|
||
|
||
PYTEST_ARGS = { | ||
'default': ['tests', '--tb=short', '-s', '-rw'], | ||
'fast': ['tests', '--tb=short', '-q', '-s', '-rw'], | ||
} | ||
|
||
FLAKE8_ARGS = ['--ignore=E501', 'rest_framework_simplejwt', 'tests'] | ||
|
||
ISORT_ARGS = ['--recursive', '--check-only', '-p', 'rest_framework_simplejwt', 'tests'] | ||
|
||
sys.path.append(os.path.dirname(__file__)) | ||
|
||
|
||
def exit_on_failure(ret, message=None): | ||
if ret: | ||
sys.exit(ret) | ||
|
||
|
||
def flake8_main(args): | ||
print('Running flake8 code linting') | ||
ret = subprocess.call(['flake8'] + args) | ||
print('flake8 failed' if ret else 'flake8 passed') | ||
return ret | ||
|
||
|
||
def isort_main(args): | ||
print('Running isort code checking') | ||
ret = subprocess.call(['isort'] + args) | ||
|
||
if ret: | ||
print('isort failed: Some modules have incorrectly ordered imports. Fix by running `isort --recursive .`') | ||
else: | ||
print('isort passed') | ||
|
||
return ret | ||
|
||
|
||
def split_class_and_function(string): | ||
class_string, function_string = string.split('.', 1) | ||
return '%s and %s' % (class_string, function_string) | ||
|
||
|
||
def is_function(string): | ||
# `True` if it looks like a test function is included in the string. | ||
return string.startswith('test_') or '.test_' in string | ||
|
||
|
||
def is_class(string): | ||
# `True` if first character is uppercase - assume it's a class name. | ||
return string[0] == string[0].upper() | ||
|
||
|
||
if __name__ == '__main__': | ||
try: | ||
sys.argv.remove('--nolint') | ||
except ValueError: | ||
run_flake8 = True | ||
run_isort = True | ||
else: | ||
run_flake8 = False | ||
run_isort = False | ||
|
||
try: | ||
sys.argv.remove('--lintonly') | ||
except ValueError: | ||
run_tests = True | ||
else: | ||
run_tests = False | ||
|
||
try: | ||
sys.argv.remove('--fast') | ||
except ValueError: | ||
style = 'default' | ||
else: | ||
style = 'fast' | ||
run_flake8 = False | ||
run_isort = False | ||
|
||
if len(sys.argv) > 1: | ||
pytest_args = sys.argv[1:] | ||
first_arg = pytest_args[0] | ||
|
||
try: | ||
pytest_args.remove('--coverage') | ||
except ValueError: | ||
pass | ||
else: | ||
pytest_args = [ | ||
'--cov-report', | ||
'xml', | ||
'--cov', | ||
'rest_framework'] + pytest_args | ||
|
||
if first_arg.startswith('-'): | ||
# `runtests.py [flags]` | ||
pytest_args = ['tests'] + pytest_args | ||
elif is_class(first_arg) and is_function(first_arg): | ||
# `runtests.py TestCase.test_function [flags]` | ||
expression = split_class_and_function(first_arg) | ||
pytest_args = ['tests', '-k', expression] + pytest_args[1:] | ||
elif is_class(first_arg) or is_function(first_arg): | ||
# `runtests.py TestCase [flags]` | ||
# `runtests.py test_function [flags]` | ||
pytest_args = ['tests', '-k', pytest_args[0]] + pytest_args[1:] | ||
else: | ||
pytest_args = PYTEST_ARGS[style] | ||
|
||
if run_tests: | ||
exit_on_failure(pytest.main(pytest_args)) | ||
|
||
if run_flake8: | ||
exit_on_failure(flake8_main(FLAKE8_ARGS)) | ||
|
||
if run_isort: | ||
exit_on_failure(isort_main(ISORT_ARGS)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[wheel] | ||
universal = 1 | ||
|
||
[metadata] | ||
license_file = LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from io import open | ||
import os | ||
import re | ||
import shutil | ||
import sys | ||
|
||
from setuptools import setup, find_packages | ||
|
||
|
||
init_py = open(os.path.join('rest_framework_simplejwt', '__init__.py')).read() | ||
version = re.search(r'''^__version__ = ['"]([^'"]+)['"]$''', init_py).group(1) | ||
|
||
|
||
if sys.argv[-1] == 'publish': | ||
if os.system('pip freeze | grep twine'): | ||
print('twine not installed.\nUse `pip install twine`.\nExiting.') | ||
sys.exit() | ||
os.system('python setup.py sdist bdist_wheel') | ||
os.system('twine upload dist/*') | ||
print('You probably want to also tag the version now:') | ||
print(" git tag -a %s -m 'version %s'" % (version, version)) | ||
print(' git push --tags') | ||
shutil.rmtree('dist') | ||
shutil.rmtree('build') | ||
shutil.rmtree('djangorestframework.egg-info') | ||
sys.exit() | ||
|
||
|
||
setup( | ||
name='djangorestframework_simplejwt', | ||
version=version, | ||
url='https://github.com/davesque/django-rest-framework-simplejwt', | ||
license='MIT', | ||
description='A bare-bones JSON Web Token authentication plugin for Django REST Framework', | ||
long_description=open('README.rst', 'r', encoding='utf-8').read(), | ||
author='David Sanders', | ||
author_email='davesque@gmail.com', | ||
packages=find_packages(exclude=['tests', 'licenses', 'requirements']), | ||
install_requires=['djangorestframework'], | ||
classifiers=[ | ||
'Development Status :: 2 - Pre-Alpha', | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Framework :: Django :: 1.8', | ||
'Framework :: Django :: 1.9', | ||
'Framework :: Django :: 1.10', | ||
'Framework :: Django :: 1.11', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.3', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Topic :: Internet :: WWW/HTTP', | ||
] | ||
) |
Empty file.
Oops, something went wrong.