Skip to content

Commit

Permalink
Merge pull request #5 from pennlabs/cleanup
Browse files Browse the repository at this point in the history
Conform to Penn Labs' PyPI template
  • Loading branch information
ArmaanT committed Oct 10, 2019
2 parents 00d3688 + 073e33e commit 89c5297
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 135 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
jobs:
build:
working_directory: ~/django-labs-accounts
working_directory: ~/pennlabs
docker:
- image: pennlabs/tox
steps:
Expand All @@ -20,8 +20,9 @@ jobs:
path: test_results
destination: trl
publish:
working_directory: ~/pennlabs
docker:
- image: circleci/python:3.7.1
- image: circleci/python:3.7
steps:
- checkout
- restore_cache:
Expand Down
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

15 changes: 10 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
dist/
__pycache__/
*/__pycache__/
# IDEs and OSs
.vscode
.DS_Store

# Python
build/
*.egg-info
.coverage
dist/
*.egg-info
*.pyc
__pycache__/
.tox
test-results/
test-results/
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ 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.
SOFTWARE.
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

91 changes: 91 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Django Labs Accounts

[![CircleCI](https://circleci.com/gh/pennlabs/django-labs-accounts.svg?style=shield)](https://circleci.com/gh/pennlabs/django-labs-accounts)
[![Coverage Status](https://coveralls.io/repos/github/pennlabs/django-labs-accounts/badge.svg?branch=master)](https://coveralls.io/github/pennlabs/django-labs-accounts?branch=master)
[![PyPi Package](https://img.shields.io/pypi/v/django-labs-accounts.svg)](https://pypi.org/project/django-labs-accounts/)

## Requirements

* Python 3.5+
* Django 2.0+

## Installation

Install with pip `pip install django-labs-accounts`

Add `accounts` to `INSTALLED_APPS`

```python
INSTALLED_APPS = (
...
'accounts.apps.AccountsConfig',
...
)
```

Add the new accounts backend to `AUTHENTICATION_BACKENDS`

```python
AUTHENTICATION_BACKENDS = (
...
'accounts.backends.LabsUserBackend',
'django.contrib.auth.backends.ModelBackend',
...
)
```

Add the following to `urls.py`

```python
urlpatterns = [
...
path('accounts/', include('accounts.urls', namespace='accounts')),
...
]
```

## Documentation

All settings are handled within a `PLATFORM_ACCOUNTS` dictionary.

Example:

```python
PLATFORM_ACCOUNTS = {
'CLIENT_ID': 'id',
'CLIENT_SECRET': 'secret',
'REDIRECT_URI': 'example',
'ADMIN_PERMISSION': 'example_admin'
'CUSTOM_ADMIN': True
}
```

The available settings are:

`CLIENT_ID` the client ID to connect to platform with. Defaults to `LABS_CLIENT_ID` environment variable.

`CLIENT_SECRET` the client secret to connect to platform with. Defaults to `LABS_CLIENT_SECRET` environment variable.

`REDIRECT_URI` the redirect uri to send to platform. Defaults to `LABS_REDIRECT_URI` environment variable.

`SCOPE` the scope for this applications tokens. Must include `introspection`. Defaults to `['read', 'introspection']`.

`PLATFORM_URL` URL of platform server to connect to. Should be `https://platform(-dev).pennlabs.org` (no trailing slash)

`ADMIN_PERMISSION` The name of the permission on platform to grant admin access. Defaults to `example_admin`

`CUSTOM_ADMIN` enable the custom admin login page to log in users through platform. Defaults to `True`

When developing locally with an http (not https) callback URL, it may be helpful to set the `OAUTHLIB_INSECURE_TRANSPORT` environment variable.

```python
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = "1"
```

## Changelog

See [CHANGELOG.md](https://github.com/pennlabs/django-labs-accounts/blob/master/CHANGELOG.md)

## License

See [LICENSE.md](https://github.com/pennlabs/django-labs-accounts/blob/master/LICENSE.md)
96 changes: 0 additions & 96 deletions README.rst

This file was deleted.

25 changes: 0 additions & 25 deletions setup.cfg

This file was deleted.

25 changes: 25 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


VERSION = '0.3.7'
DESCRIPTION = open('README.md', encoding='utf-8').read()


class VerifyVersionCommand(install):
Expand All @@ -23,7 +24,31 @@ def run(self):


setup(
name='django-labs-accounts',
version=VERSION,
packages=['accounts'],
url='https://github.com/pennlabs/django-labs-accounts',
project_urls={
'Changelog': ('https://github.com/pennlabs/django-labs-accounts/blob/master/CHANGELOG.md')
},
license='MIT',
author='Penn Labs',
author_email='admin@pennlabs.org',
description='Reusable Django app for Penn Labs accounts',
long_description=DESCRIPTION,
long_description_content_type='text/markdown',
install_requires=[
'django>=2.0.0',
'requests-oauthlib>=1.2.0'
],
classifiers=[
'Framework :: Django',
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
python_requires='>=3.5',
cmdclass={
'verify': VerifyVersionCommand,
}
Expand Down
9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist =
lint,
py35-django{20,21,22},
py36-django{20,21,22},
py37-django{20,21,22},
lint
py37-django{20,21,22}

[testenv]
commands = coverage run -a runtests.py
Expand All @@ -12,6 +12,7 @@ setenv =
deps =
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2
coverage
unittest-xml-reporting

Expand All @@ -23,7 +24,6 @@ deps =
flake8-isort
flake8-quotes


[flake8]
max-line-length = 120
exclude = docs/, accounts/migrations/, .tox/, build/
Expand All @@ -36,3 +36,6 @@ known_first_party = accounts
line_length = 120
lines_after_imports = 2
multi_line_output = 0

[coverage:run]
source = accounts

0 comments on commit 89c5297

Please sign in to comment.