Skip to content

Commit 951cc69

Browse files
committed
Merge pull request jpadilla#12 from rlucioni/renzo/optional-packages
Make OAuth packages optional
2 parents 0c5ee29 + b6cf728 commit 951cc69

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

docs/index.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ OAuth support for Django REST Framework
1717

1818
## Overview
1919

20-
OAuth support extracted as a third party package directly from the official Django REST Framework implementation. It's built using the [django-oauth-plus][django-oauth-plus] and [django-oauth2-provider][django-oauth2-provider] packages.
20+
OAuth support extracted as a third party package directly from the official Django REST Framework implementation. It's built to use the [django-oauth-plus][django-oauth-plus], [oauth2][oauth2], and [django-oauth2-provider][django-oauth2-provider] packages.
2121

22-
This package provides two authentication classes: [OAuthAuthentication][oauth-authentication] and [OAuth2Authentication][oauth2-authentication] and a [TokenHasReadWriteScope][token-has-read-write-scope] permission class.
22+
This package provides two authentication classes, [OAuthAuthentication][oauth-authentication] and [OAuth2Authentication][oauth2-authentication], and a [TokenHasReadWriteScope][token-has-read-write-scope] permission class.
2323

2424
## Requirements
2525

@@ -29,12 +29,26 @@ This package provides two authentication classes: [OAuthAuthentication][oauth-au
2929

3030
## Installation
3131

32-
Install using `pip`...
32+
Install using `pip`:
3333

3434
```bash
3535
$ pip install djangorestframework-oauth
3636
```
3737

38+
OAuth packages are optional and not installed out of the box. Use of `OAuthAuthentication` requires installation of the `django-oauth-plus` and `oauth2` packages:
39+
40+
```bash
41+
$ pip install django-oauth-plus oauth2
42+
```
43+
44+
Use of `OAuth2Authentication` requires installation of `django-oauth2-provider`:
45+
46+
```bash
47+
$ pip install django-oauth2-provider
48+
```
49+
50+
Use of `TokenHasReadWriteScope` requires installation of either `django-oauth-plus` or `django-oauth2-provider`.
51+
3852
## Documentation & Support
3953

4054
Full documentation for the project is available at http://jpadilla.github.io/django-rest-framework-oauth/.
@@ -46,7 +60,6 @@ You may also want to follow the [author][jpadilla] on Twitter.
4660
Install testing requirements.
4761

4862
```bash
49-
$ pip install -r requirements.txt
5063
$ pip install -r requirements-test.txt
5164
```
5265

@@ -87,5 +100,6 @@ $ mkdocs build
87100
[oauth2-authentication]: authentication.md#oauth2authentication
88101
[token-has-read-write-scope]: permissions.md#tokenhasreadwritescope
89102
[django-oauth-plus]: http://code.larlet.fr/django-oauth-plus/wiki/Home
103+
[oauth2]: https://github.com/joestump/python-oauth2
90104
[django-oauth2-provider]: http://django-oauth2-provider.readthedocs.org/
91105
[jpadilla]: https://twitter.com/jpadilla_

requirements-test.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
Django>=1.6
1+
Django>=1.6,<1.8
22
djangorestframework>=2.4.3
3+
django-oauth-plus>=2.2.1
4+
django-oauth2-provider>=0.2.4
5+
flake8==2.2.2
6+
oauth2==1.5.211
7+
pytest-cov==1.6
38
pytest-django==2.6
49
pytest==2.5.2
5-
pytest-cov==1.6
6-
flake8==2.2.2

requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
author = 'José Padilla'
1515
author_email = '[email protected]'
1616
license = 'BSD'
17-
install_requires = open('requirements.txt').read().split('\n')
1817

1918

2019
# This command has been borrowed from
@@ -88,7 +87,6 @@ def get_package_data(package):
8887
packages=get_packages(package),
8988
package_data=get_package_data(package),
9089
cmdclass={'test': PyTest},
91-
install_requires=install_requires,
9290
classifiers=[
9391
'Development Status :: 5 - Production/Stable',
9492
'Environment :: Web Environment',

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ deps =
1515
drf30: djangorestframework==3.0.0
1616
drf31: djangorestframework==3.1.0
1717
pytest-django==2.6.1
18+
django-oauth-plus>=2.2.1
19+
oauth2==1.5.211
20+
django-oauth2-provider>=0.2.4
1821

1922
[testenv:py27-flake8]
2023
commands = ./runtests.py --lintonly

0 commit comments

Comments
 (0)