django-sync-github-teams is ...
Project description
django-sync-github-teams
django-sync-github-teams adds the ability to sync between Github teams and groups in a Django application. It assumes and requires having users logging in to the Django application using their GitHub accounts via django-allauth. Check the django-allauth documentation for details on how to set it up.
Installing and configuring
Install the package
pip install django-sync-github-teams
The in Django settings:
INSTALLED_APPS = [
...
"django_sync_github_teams",
"allauth",
"allauth.account",
"allauth.socialaccount",
...
]
AUTH_SOCIALACCOUNT = {
...
"github": {
"SCOPE": ["user"]
},
...
}
SYNC_GITHUB_TEAMS = ["myorg/myteam"]
SYNC_GITHUB_TEAMS_TOKEN = "*********************"
SYNC_GITHUB_TEAMS_ON_LOGIN = False
The follwing settings can be used:
SYNC_GITHUB_TEAMS
: list of strings containing the GitHub teams in the formatORGANIZATION/TEAM
to be synced from GitHub. Each team listed will be synced to a local Django group with same name. Only users who have logged in locally using their GitHub accounts get added to the group.SYNC_GITHUB_TEAMS
can also be a string with teams in the formatORGANIZATION/TEAM
separated by commas with optional surounding whitespace, e.g.SYNC_GITHUB_TEAMS = "myorg/team1, myorg/team2"
, or just by whitespace, e.g.SYNC_GITHUB_TEAMS = "myorg/team1 myorg/team2"
.
SYNC_GITHUB_TEAMS_TOKEN
: string containing a GitHub API Personal access token to be used to read the team members. This token must have permissions to read the members of all of the teams listed inSYNC_GITHUB_TEAMS
. See the GitHub API documentation for more details about this.SYNC_GITHUB_TEAMS_ON_LOGIN
: boolean; if set to True, a user's group will be populated when they login.
Usage
There's a management command to trigger the sync, which can be used in cronjobs and the like:
./manage.py sync-github-teams
You can also trigger this in some other way from your application somehow:
from django_sync_github_teams.sync import sync_github_teams
sync_github_teams()
This needs to run as often as your application requires. Note that even if you enable syncing teams on login, you still need to sync them offline like this from time to time, because users might leave the teams there where members of when they first logged in.
Contributing
Send merge requests at https://gitlab.com/Linaro/django-sync-github-teams.
Follow the existing coding conventions in the code (PEP-8, black), and make
sure the all the tests pass and that any new code is covered by tests. Just
running make
will run all relevant tests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-sync-github-teams-0.2.0.tar.gz
.
File metadata
- Download URL: django-sync-github-teams-0.2.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95cd44837095685168e1c9993014624e2c68371d0828d110964d17f170f61d81 |
|
MD5 | 3fd6fdfa145b21956ee0759f10a02f93 |
|
BLAKE2b-256 | 674a18938159187e3784b811edd283b755d124e69c057b1a67bf816cd357dda7 |
File details
Details for the file django_sync_github_teams-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: django_sync_github_teams-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7809e56a410de34927503e1235fead4022096279afc03ee95eac37711df39a2 |
|
MD5 | 389f46097f9e9554fcd4eee3c6ff86e3 |
|
BLAKE2b-256 | 4e065b5fadbddacecc5debfe23e0f10404f4cf4f72f7cbaaacc527bb8f2ef924 |