Skip to content

Commit 2965a13

Browse files
authored
Merge pull request #34 from caravancoop/feature/flit-packaging
Use flit to package project
2 parents 4659769 + d1cda68 commit 2965a13

File tree

13 files changed

+136
-106
lines changed

13 files changed

+136
-106
lines changed

.circleci/config.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- checkout
2020
- restore_cache:
21-
key: rest-auth-toolkit-py37-v1
21+
key: rest-auth-toolkit-py37-v2
2222
- run:
2323
name: Install CI tools
2424
command: |
@@ -28,7 +28,7 @@ jobs:
2828
name: Test with Python 3.7
2929
command: venv/bin/tox -e py37
3030
- save_cache:
31-
key: rest-auth-toolkit-py37-v1
31+
key: rest-auth-toolkit-py37-v2
3232
paths:
3333
- venv
3434
- .tox
@@ -40,7 +40,7 @@ jobs:
4040
steps:
4141
- checkout
4242
- restore_cache:
43-
key: rest-auth-toolkit-py36-v1
43+
key: rest-auth-toolkit-py36-v2
4444
- run:
4545
name: Install CI tools
4646
command: |
@@ -50,29 +50,32 @@ jobs:
5050
name: Test with Python 3.6
5151
command: venv/bin/tox -e py36
5252
- save_cache:
53-
key: rest-auth-toolkit-py36-v1
53+
key: rest-auth-toolkit-py36-v2
5454
paths:
5555
- venv
5656
- .tox
5757

5858
test-py27:
5959
docker:
60-
- image: circleci/python:2.7
60+
# This image contains Python 3.6 (to install flit) and 2.7 (to run tests)
61+
- image: circleci/python:3.6
6162
working_directory: ~/rest-auth-toolkit
6263
steps:
6364
- checkout
6465
- restore_cache:
65-
key: rest-auth-toolkit-py27-v1
66+
key: rest-auth-toolkit-py27-v2
6667
- run:
6768
name: Install CI tools
6869
command: |
69-
virtualenv -p python2.7 venv
70+
python3.6 -m venv venv
7071
venv/bin/pip install tox
7172
- run:
7273
name: Test with Python 2.7
73-
command: venv/bin/tox -e py27
74+
command: |
75+
venv/bin/tox --sdistonly
76+
venv/bin/tox -e py27
7477
- save_cache:
75-
key: rest-auth-toolkit-py35-v1
78+
key: rest-auth-toolkit-py27-v2
7679
paths:
7780
- venv
7881
- .tox
@@ -84,7 +87,7 @@ jobs:
8487
steps:
8588
- checkout
8689
- restore_cache:
87-
key: rest-auth-toolkit-check-v2
90+
key: rest-auth-toolkit-check-v3
8891
- run:
8992
name: Install CI tools
9093
command: |
@@ -94,7 +97,7 @@ jobs:
9497
name: Check packaging and dependencies
9598
command: venv/bin/tox -e pkg
9699
- save_cache:
97-
key: rest-auth-toolkit-check-v2
100+
key: rest-auth-toolkit-check-v3
98101
paths:
99102
- venv
100103
- .tox

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ __pycache__
66
# Test artifacts
77
/.cache/
88
/.tox/
9+
/venv/
910

1011
# Packaging litter
1112
/*.egg-info

MANIFEST.in

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

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
```
2-
__ __ __ __ ____ _ __
3-
________ _____/ /_ ____ ___ __/ /_/ /_ / /_____ ____ / / /__(_) /_
4-
/ ___/ _ \/ ___/ __/ ___/ __ `/ / / / __/ __ \ ___/ __/ __ \/ __ \/ / //_/ / __/
5-
/ / / __(__ ) /_ /__/ /_/ / /_/ / /_/ / / / /__/ /_/ /_/ / /_/ / / ,< / / /_
6-
/_/ \___/____/\__/ \__,_/\__,_/\__/_/ /_/ \__/\____/\____/_/_/|_/_/\__/
2+
__ __ __ __ ____ _ __
3+
________ _____/ /_ ____ ___ __/ /_/ /_ / /_____ ____ / / /__(_) /_
4+
/ ___/ _ \/ ___/ __/ ___/ __ `/ / / / __/ __ \ ___/ __/ __ \/ __ \/ / //_/ / __/
5+
/ / / __(__ ) /_ /__/ /_/ / /_/ / /_/ / / / /__/ /_/ /_/ / /_/ / / ,< / / /_
6+
/_/ \___/____/\__/ \__,_/\__,_/\__/_/ /_/ \__/\____/\____/_/_/|_/_/\__/
77
88
```
99

10-
Mixins and views to handle signup and login in an API built with
11-
django-rest-framework.
10+
This libary provides mixins and views to handle signup, login and
11+
logout in an API built with django-rest-framework. After login,
12+
client applications get a token for the API requests.
13+
14+
Email-based signups are supported out of the box.
15+
Other methods require you to specify an extra in your requirements;
16+
for example, to use Facebook login you need to depend on
17+
`rest-framework-auth-toolkit[facebook]`.
18+
19+
Contrary to other similar modules, rest-auth-toolkit doess not provide
20+
a set of Django apps to include and configure in your settings, but a
21+
collection of mixins, base classes, base views and simple templates
22+
that you can integrate and customize in your own apps.
23+
24+
See the [demo](demo/) app for example usage.
25+
26+
⚠️ This library is not stable yet, make sure to pin your dependencies.
27+
Recommended form: `rest-framework-auth-toolkit == 0.9.*`

demo/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Demo application for Rest-Framework-Auth-Toolkit
2+
3+
This is a minimal Django project that shows how to use
4+
the package and helps checking if changes break usage.
5+
6+
## How to install
7+
8+
Run this command once from the repository root:
9+
10+
```
11+
python setup-develop.py develop
12+
```
13+
14+
This makes the package `rest_auth_toolkit` importable by the demo app,
15+
with local changes immediately seen.
16+
17+
Go in the `demo` directory and install the other dependencies:
18+
19+
```
20+
pip install -r requirements.txt
21+
```
22+
23+
# How to run
24+
25+
Define the environment variables needed by the app:
26+
27+
```
28+
export DEMO_FACEBOOK_APP_ID="..."
29+
export DEMO_FACEBOOK_SECRET_KEY="..."
30+
```
31+
32+
(using a [virtualenvwrapper hook](https://virtualenvwrapper.readthedocs.io/en/latest/scripts.html#postactivate)
33+
or a `.env` file with [direnv](https://direnv.net/) is a good ideae to make this automatic)
34+
35+
You can then run Django commands:
36+
37+
```
38+
python manage.py migrate
39+
python manage.py runserver
40+
```

demo/requirements.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ django-debug-toolbar
77
django-model-utils
88
django-shortuuidfield
99

10-
# Note: rest-framework-auth-toolkit is not here, it should already
11-
# be importable if you do "pip install -e ." from your dev virtualenv.
12-
# We do include facepy here to make sure requirements.txt
13-
# contains all transitive dependencies.
10+
# TODO add develop install for rest-framework-auth-toolkit
11+
# (when pip supports PEP 517); see README for how to install rest-auth-toolkit
12+
#-e ..[facebook]
13+
# In the meantime we include facepy here to make sure requirements.txt
14+
# contains all transitive dependencies
1415
facepy
1516

1617
# for the browsable API

pyproject.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[build-system]
2+
requires = ["flit"]
3+
build-backend = "flit.buildapi"
4+
5+
[tool.flit.metadata]
6+
module = "rest_auth_toolkit"
7+
dist-name = "Rest_Framework_Auth_Toolkit"
8+
author = "Caravan Coop"
9+
author-email = "[email protected]"
10+
home-page = "https://github.com/caravancoop/rest-framework-auth-toolkit"
11+
description-file = "README.md"
12+
classifiers = [
13+
"Development Status :: 3 - Alpha",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: MIT License",
16+
"Programming Language :: Python :: 2.7",
17+
"Programming Language :: Python :: 3.5",
18+
"Programming Language :: Python :: 3.6",
19+
"Programming Language :: Python :: 3.7",
20+
"Framework :: Django :: 1.11",
21+
"Framework :: Django :: 2.0",
22+
"Framework :: Django :: 2.1",
23+
]
24+
requires = [
25+
"django >= 1.11",
26+
]
27+
28+
[tool.flit.metadata.requires-extra]
29+
facebook = ["facepy"]

requirements.txt

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

rest_auth_toolkit/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
"""Simple + flexible signup and login for Django APIs"""
2+
3+
__version__ = '0.9'
4+
15
default_app_config = 'rest_auth_toolkit.app.RestAuthToolkitConfig'

setup-develop.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from setuptools import setup
2+
3+
import rest_auth_toolkit
4+
5+
setup(
6+
name='Rest-Framework-Auth-Toolkit',
7+
version=rest_auth_toolkit.__version__,
8+
)

0 commit comments

Comments
 (0)