Skip to content

Commit 0ac9e07

Browse files
committed
feat: Add backend plugin from the cookiecutter.
1 parent 11b5530 commit 0ac9e07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3265
-0
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches:
8+
- "**"
9+
10+
defaults:
11+
run:
12+
working-directory: "./backend"
13+
14+
jobs:
15+
run_tests:
16+
name: tests
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest]
21+
python-version: ["3.12"]
22+
toxenv: [quality, docs, pii_check, django42]
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: setup python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install pip
31+
run: pip install -r requirements/pip.txt
32+
33+
- name: Install Dependencies
34+
run: pip install -r requirements/ci.txt
35+
36+
- name: Run Tests
37+
env:
38+
TOXENV: ${{ matrix.toxenv }}
39+
run: tox
40+
41+
- name: Run coverage
42+
if: matrix.python-version == '3.12' && matrix.toxenv == 'django42'
43+
uses: codecov/codecov-action@v4
44+
working-directory: "./backend"
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}
47+
flags: unittests
48+
fail_ci_if_error: true

.github/workflows/commitlint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Run commitlint on the commit messages in a pull request.
2+
3+
name: Lint Commit Messages
4+
5+
on:
6+
- pull_request
7+
8+
jobs:
9+
commitlint:
10+
uses: openedx/.github/.github/workflows/commitlint.yml@master

.github/workflows/pypi-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish package to PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
defaults:
8+
run:
9+
working-directory: "./backend"
10+
11+
jobs:
12+
push:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: setup python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: 3.12
22+
23+
- name: Install pip
24+
run: pip install -r requirements/pip.txt
25+
26+
- name: Build package
27+
run: python setup.py sdist bdist_wheel
28+
29+
- name: Publish to PyPi
30+
uses: pypa/gh-action-pypi-publish@release/v1
31+
working-directory: "./backend"
32+
with:
33+
user: __token__
34+
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Upgrade Python Requirements
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * 1"
6+
workflow_dispatch:
7+
inputs:
8+
branch:
9+
description: "Target branch against which to create requirements PR"
10+
required: true
11+
default: 'main'
12+
13+
jobs:
14+
call-upgrade-python-requirements-workflow:
15+
uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master
16+
with:
17+
branch: ${{ github.event.inputs.branch || 'main' }}
18+
# optional parameters below; fill in if you'd like github or email notifications
19+
# user_reviewers: ""
20+
# team_reviewers: ""
21+
# email_address: ""
22+
# send_success_notification: false
23+
secrets:
24+
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
25+
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
26+
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
27+
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}

backend/.annotation_safe_list.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This is a Code Annotations automatically-generated Django model safelist file.
2+
# These models must be annotated as follows in order to be counted in the coverage report.
3+
# See https://code-annotations.readthedocs.io/en/latest/safelist.html for more information.
4+
#
5+
# fake_app_1.FakeModelName:
6+
# ".. no_pii:": "This model has no PII"
7+
# fake_app_2.FakeModel2:
8+
# ".. choice_annotation:": foo, bar, baz
9+
10+
admin.LogEntry:
11+
".. no_pii:": "This model has no PII"
12+
auth.Group:
13+
".. no_pii:": "This model has no PII"
14+
auth.Permission:
15+
".. no_pii:": "This model has no PII"
16+
auth.User:
17+
".. pii": "This model minimally contains a username, password, and email"
18+
".. pii_types": "username, email_address, password"
19+
".. pii_retirement": "consumer_api"
20+
contenttypes.ContentType:
21+
".. no_pii:": "This model has no PII"
22+
sessions.Session:
23+
".. no_pii:": "This model has no PII"
24+
social_django.Association:
25+
".. no_pii:": "This model has no PII"
26+
social_django.Code:
27+
".. pii:": "Email address"
28+
".. pii_types:": other
29+
".. pii_retirement:": local_api
30+
social_django.Nonce:
31+
".. no_pii:": "This model has no PII"
32+
social_django.Partial:
33+
".. no_pii:": "This model has no PII"
34+
social_django.UserSocialAuth:
35+
".. no_pii:": "This model has no PII"
36+
waffle.Flag:
37+
".. no_pii:": "This model has no PII"
38+
waffle.Sample:
39+
".. no_pii:": "This model has no PII"
40+
waffle.Switch:
41+
".. no_pii:": "This model has no PII"

backend/.coveragerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[run]
2+
branch = True
3+
data_file = .coverage
4+
source=sample_plugin
5+
omit =
6+
test_settings.py
7+
*/migrations/*
8+
*admin.py
9+
*/static/*
10+
*/templates/*

backend/.editorconfig

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# ***************************
2+
# ** DO NOT EDIT THIS FILE **
3+
# ***************************
4+
#
5+
# This file was generated by edx-lint: https://github.com/openedx/edx-lint
6+
#
7+
# If you want to change this file, you have two choices, depending on whether
8+
# you want to make a local change that applies only to this repo, or whether
9+
# you want to make a central change that applies to all repos using edx-lint.
10+
#
11+
# Note: If your .editorconfig file is simply out-of-date relative to the latest
12+
# .editorconfig in edx-lint, ensure you have the latest edx-lint installed
13+
# and then follow the steps for a "LOCAL CHANGE".
14+
#
15+
# LOCAL CHANGE:
16+
#
17+
# 1. Edit the local .editorconfig_tweaks file to add changes just to this
18+
# repo's file.
19+
#
20+
# 2. Run:
21+
#
22+
# $ edx_lint write .editorconfig
23+
#
24+
# 3. This will modify the local file. Submit a pull request to get it
25+
# checked in so that others will benefit.
26+
#
27+
#
28+
# CENTRAL CHANGE:
29+
#
30+
# 1. Edit the .editorconfig file in the edx-lint repo at
31+
# https://github.com/openedx/edx-lint/blob/master/edx_lint/files/.editorconfig
32+
#
33+
# 2. install the updated version of edx-lint (in edx-lint):
34+
#
35+
# $ pip install .
36+
#
37+
# 3. Run (in edx-lint):
38+
#
39+
# $ edx_lint write .editorconfig
40+
#
41+
# 4. Make a new version of edx_lint, submit and review a pull request with the
42+
# .editorconfig update, and after merging, update the edx-lint version and
43+
# publish the new version.
44+
#
45+
# 5. In your local repo, install the newer version of edx-lint.
46+
#
47+
# 6. Run:
48+
#
49+
# $ edx_lint write .editorconfig
50+
#
51+
# 7. This will modify the local file. Submit a pull request to get it
52+
# checked in so that others will benefit.
53+
#
54+
#
55+
#
56+
#
57+
#
58+
# STAY AWAY FROM THIS FILE!
59+
#
60+
#
61+
#
62+
#
63+
#
64+
# SERIOUSLY.
65+
#
66+
# ------------------------------
67+
# Generated by edx-lint version: 5.2.5
68+
# ------------------------------
69+
[*]
70+
end_of_line = lf
71+
insert_final_newline = true
72+
charset = utf-8
73+
indent_style = space
74+
indent_size = 4
75+
max_line_length = 120
76+
trim_trailing_whitespace = true
77+
78+
[{Makefile, *.mk}]
79+
indent_style = tab
80+
indent_size = 8
81+
82+
[*.{yml,yaml,json}]
83+
indent_size = 2
84+
85+
[*.js]
86+
indent_size = 2
87+
88+
[*.diff]
89+
trim_trailing_whitespace = false
90+
91+
[.git/*]
92+
trim_trailing_whitespace = false
93+
94+
[COMMIT_EDITMSG]
95+
max_line_length = 72
96+
97+
[*.rst]
98+
max_line_length = 79
99+
100+
# f2f02689fced7a2e0c62c2f9803184114dc2ae4b

backend/.gitignore

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
*.py[cod]
2+
__pycache__
3+
.pytest_cache
4+
5+
# C extensions
6+
*.so
7+
8+
# Packages
9+
*.egg
10+
*.egg-info
11+
/dist
12+
/build
13+
/eggs
14+
/parts
15+
/bin
16+
/var
17+
/sdist
18+
/develop-eggs
19+
/.installed.cfg
20+
/lib
21+
/lib64
22+
23+
# Installer logs
24+
pip-log.txt
25+
26+
# Unit test / coverage reports
27+
.cache/
28+
.pytest_cache/
29+
.coverage
30+
.coverage.*
31+
.tox
32+
coverage.xml
33+
htmlcov/
34+
35+
# Virtual environments
36+
/venv/
37+
/venv-*/
38+
/.venv/
39+
/.venv-*/
40+
41+
# The Silver Searcher
42+
.agignore
43+
44+
# OS X artifacts
45+
*.DS_Store
46+
47+
# Logging
48+
log/
49+
logs/
50+
chromedriver.log
51+
ghostdriver.log
52+
53+
# Complexity
54+
output/*.html
55+
output/*/index.html
56+
57+
# Sphinx
58+
docs/_build
59+
docs/modules.rst
60+
docs/sample_plugin.rst
61+
docs/sample_plugin.*.rst
62+
63+
# Private requirements
64+
requirements/private.in
65+
requirements/private.txt

backend/.pii_annotations.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
source_path: ./
2+
report_path: pii_report
3+
safelist_path: .annotation_safe_list.yml
4+
coverage_target: 100.0
5+
annotations:
6+
".. no_pii:":
7+
"pii_group":
8+
- ".. pii:":
9+
- ".. pii_types:":
10+
choices:
11+
- id # Unique identifier for the user which is shared across systems
12+
- name # Used for any part of the user's name
13+
- username
14+
- password
15+
- location # Used for any part of any type address or country stored
16+
- phone_number # Used for phone or fax numbers
17+
- email_address
18+
- birth_date # Used for any part of a stored birth date
19+
- ip # IP address
20+
- external_service # Used for external service ids or links such as social media links or usernames, website links, etc.
21+
- biography # Any type of free-form biography field
22+
- gender
23+
- sex
24+
- image
25+
- video
26+
- other
27+
- ".. pii_retirement:":
28+
choices:
29+
- retained # Intentionally kept for legal reasons
30+
- local_api # An API exists in this repository for retiring this information
31+
- consumer_api # The data's consumer must implement an API for retiring this information
32+
- third_party # A third party API exists to retire this data
33+
extensions:
34+
python:
35+
- py

0 commit comments

Comments
 (0)