Skip to content

Commit

Permalink
JazzBand project guidelines (#166)
Browse files Browse the repository at this point in the history
* Add JazzBand

* Add Usage section

* Add JazzBand badge

* Indicate supported Python versions

* Add PyPI download shield

* Contributing section; Contributor Code of Conduct

* Create CONTRIBUTING.md

* Add license information to the setup.py

* Migrate from Travis to GH actions

* NEW: Release pipeline

Co-authored-by: Fernando Cordeiro <[email protected]>
  • Loading branch information
brylie and MrCordeiro authored Feb 1, 2022
1 parent 9069002 commit 966b855
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 46 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:
if: github.repository == 'jazzband/django-invitations'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools twine wheel
- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
twine check dist/*
- name: Upload packages to Jazzband
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: jazzband
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
repository_url: https://jazzband.co/projects/django-invitations/upload
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test

on: [push, pull_request]

jobs:
build:
name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.5', '3.6', '3.7', '3.8']
django-version: ['1.1', '2.2', '3.2']

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}


- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/tox.ini') }}
restore-keys: |
${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: tox -v
env:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[![Jazzband](https://jazzband.co/static/img/jazzband.svg)](https://jazzband.co/)

This is a [Jazzband](https://jazzband.co/) project. By contributing you agree to abide by the [Contributor Code of Conduct](https://jazzband.co/about/conduct) and follow the [guidelines](https://jazzband.co/about/guidelines).
44 changes: 28 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
## Django-invitations - Generic invitations app
# Django-invitations - Generic invitations app

[![Jazzband](https://jazzband.co/static/img/badge.svg)](https://jazzband.co/)
[![PyPI Download](https://img.shields.io/pypi/v/django-invitations.svg)](https://pypi.python.org/pypi/django-invitations)
[![PyPI Python Versions](https://img.shields.io/pypi/pyversions/django-invitations.svg)](https://pypi.python.org/pypi/django-invitations)
[![Build Status](https://travis-ci.org/bee-keeper/django-invitations.svg?branch=master)](https://travis-ci.org/bee-keeper/django-invitations)

[![Coverage Status](https://coveralls.io/repos/bee-keeper/django-invitations/badge.svg?branch=master&service=github)](https://coveralls.io/github/bee-keeper/django-invitations?branch=master)

### About
## About

Generic invitations solution with adaptable backend and support for django-allauth. All emails and messages are fully customisable.

Originally written as an invitations solution for the excellent [django-allauth](https://github.com/pennersr/django-allauth), this app has been refactored to remove the allauth dependency whilst retaining 100% backwards compatibility.

Generic Invitation flow:

* Priviledged user invites prospective user by email (via either Django admin, form post, JSON post or programmatically)
* User receives invitation email with confirmation link
* User clicks link and is redirected to a preconfigured url (default is accounts/signup)
## Contributing

As we are members of a [JazzBand project](https://jazzband.co/projects), `django-invitations` contributors should adhere to the [Contributor Code of Conduct](https://jazzband.co/about/conduct).

Allauth Invitation flow:

* As above but..
* User clicks link, their email is confirmed and they are redirected to signup
* The signup URL has the email prefilled and upon signing up the user is logged into the site


### Generic Installation
## Installation

```
pip install django-invitations
Expand All @@ -39,6 +32,24 @@ url(r'^invitations/', include('invitations.urls', namespace='invitations')),
python manage.py migrate
```

## Usage

There are two primary ways to use `django-invitations` described below.

Generic Invitation flow:

* Priviledged user invites prospective user by email (via either Django admin, form post, JSON post or programmatically)
* User receives invitation email with confirmation link
* User clicks link and is redirected to a preconfigured url (default is accounts/signup)

Allauth Invitation flow:

* As above but..
* User clicks link, their email is confirmed and they are redirected to signup
* The signup URL has the email prefilled and upon signing up the user is logged into the site

Further details can be found in the following sections.

### Allauth Integration

As above but note that invitations must come after allauth in the INSTALLED_APPS
Expand Down Expand Up @@ -150,6 +161,7 @@ The following signals are emitted:


### Management Commands

Expired and accepted invites can be cleared as so:

`python manage.py clear_expired_invitations`
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Django>=1.1.*
coverage==4.5.4
flake8==3.7.9
freezegun==0.3.12
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
download_url='https://github.com/'
'bee-keeper/django-invitations/tarball/1.9.3',
keywords=['django', 'invitation', 'django-allauth', 'invite'],
license='GPL-3.0-only',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
Expand All @@ -25,6 +26,7 @@
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: GPL-3.0-only',
'Framework :: Django',
],
)
29 changes: 20 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
[gh-actions]
python =
3.5: py35
3.6: py36
3.7: py37
3.8: py38, flake8

[gh-actions:env]
DJANGO =
1.1: django111
2.2: django22
3.2: django32

[tox]
envlist =
py35-django{111}-backend{Basic}
py36-django{111}-backend{Basic}
py37-django{111}-backend{Basic}
py35-django22-backend{Basic,Allauth}
py36-django{22,3}-backend{Basic,Allauth}
py37-django{22,3}-backend{Basic,Allauth}
py38-django{22,3}-backend{Basic,Allauth}
py{35,36,37}-django111-backendBasic
py35-django22-backendAllauth
py{36,37,38}-django32-backend{Basic,Allauth}
flake8

[pytest]
python_files = tests.py test_*.py

[testenv]
description = Unit tests
setenv =
PYTHONWARNINGS = all
deps =
-r requirements.txt
django111: Django>=1.11.17,<2.0
django22: Django>=2.2.6
django3: Django>=3.0.1
django22: Django>=2.2.6,<3.0
django32: Django>=3.2,<3.3
backendAllauth: django-allauth
commands =
python -V
Expand All @@ -28,6 +38,7 @@ commands =
coverage report

[testenv:flake8]
description = Static code analysis and code style checker
skip_install = True
deps=flake8
commands=flake8 invitations --exclude=migrations

0 comments on commit 966b855

Please sign in to comment.