Skip to content

Commit 2ebedc1

Browse files
committed
Initial commit 🐍
0 parents  commit 2ebedc1

File tree

9 files changed

+673
-0
lines changed

9 files changed

+673
-0
lines changed

β€Ž.gitattributesβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Microsoft Graph Backend for Django CI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: ["3.9", "3.10", "3.11", "3.12"]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip setuptools
22+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
23+
- name: Ruff Check
24+
run: |
25+
pip install ruff
26+
# Stop the build if Ruff reports any violations
27+
ruff check --no-fix --output-format=github
28+
# Stop the build if Ruff would reformat any files
29+
ruff format --check
30+
- name: Build
31+
run: |
32+
pip install build
33+
python -m build
34+
- name: Upload the distribution package
35+
if: matrix.python-version == '3.12'
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: python-package-distribution
39+
path: dist/
40+
41+
publish-to-testpypi:
42+
name: Publish Python distribution to TestPyPI
43+
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
44+
needs: build
45+
runs-on: ubuntu-latest
46+
environment:
47+
name: testpypi
48+
url: https://test.pypi.org/p/django-msgraphbackend
49+
permissions:
50+
id-token: write # IMPORTANT: mandatory for trusted publishing
51+
steps:
52+
- name: Download the distribution package
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: python-package-distribution
56+
path: dist/
57+
- name: Publish distribution package to TestPyPI
58+
uses: pypa/gh-action-pypi-publish@release/v1
59+
with:
60+
repository-url: https://test.pypi.org/legacy/
61+
62+
publish-to-pypi:
63+
name: Publish Python distribution to PyPI
64+
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
65+
needs: build
66+
runs-on: ubuntu-latest
67+
environment:
68+
name: pypi
69+
url: https://pypi.org/p/django-msgraphbackend
70+
permissions:
71+
id-token: write # IMPORTANT: mandatory for trusted publishing
72+
steps:
73+
- name: Download the distribution package
74+
uses: actions/download-artifact@v4
75+
with:
76+
name: python-package-distribution
77+
path: dist/
78+
- name: Publish distribution πŸ“¦ to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1
80+
81+
github-release:
82+
name: Create GitHub Release
83+
needs: publish-to-pypi
84+
runs-on: ubuntu-latest
85+
permissions:
86+
contents: write # IMPORTANT: mandatory for making GitHub Releases
87+
id-token: write # IMPORTANT: mandatory for sigstore
88+
steps:
89+
- name: Download the distribution package
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: python-package-distribution
93+
path: dist/
94+
- name: Sign the dists with Sigstore
95+
uses: sigstore/[email protected]
96+
with:
97+
inputs: >-
98+
./dist/*.tar.gz
99+
./dist/*.whl
100+
- name: Create GitHub Release
101+
env:
102+
GITHUB_TOKEN: ${{ github.token }}
103+
run: >-
104+
gh release create
105+
'${{ github.ref_name }}'
106+
--repo '${{ github.repository }}'
107+
--notes ""
108+
- name: Upload artifact signatures to GitHub Release
109+
env:
110+
GITHUB_TOKEN: ${{ github.token }}
111+
# Upload to GitHub Release using the `gh` CLI.
112+
# `dist/` contains the built packages, and the
113+
# sigstore-produced signatures and certificates.
114+
run: >-
115+
gh release upload
116+
'${{ github.ref_name }}' dist/**
117+
--repo '${{ github.repository }}'

β€Ž.gitignoreβ€Ž

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
105+
__pypackages__/
106+
107+
# Celery stuff
108+
celerybeat-schedule
109+
celerybeat.pid
110+
111+
# SageMath parsed files
112+
*.sage.py
113+
114+
# Environments
115+
.env
116+
.venv
117+
env/
118+
venv/
119+
ENV/
120+
env.bak/
121+
venv.bak/
122+
123+
# Spyder project settings
124+
.spyderproject
125+
.spyproject
126+
127+
# Rope project settings
128+
.ropeproject
129+
130+
# mkdocs documentation
131+
/site
132+
133+
# mypy
134+
.mypy_cache/
135+
.dmypy.json
136+
dmypy.json
137+
138+
# Pyre type checker
139+
.pyre/
140+
141+
# pytype static type analyzer
142+
.pytype/
143+
144+
# Cython debug symbols
145+
cython_debug/
146+
147+
# PyCharm
148+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150+
# and can be added to the global gitignore or merged into this file. For a more nuclear
151+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
152+
#.idea/

β€Ž.vscode/launch.jsonβ€Ž

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python Debugger: Django",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"program": "${workspaceFolder}\\manage.py",
9+
"args": [
10+
"sendtestemail",
11+
12+
],
13+
"django": true,
14+
"justMyCode": true
15+
}
16+
]
17+
}

β€Ž.vscode/settings.jsonβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"[python]": {
4+
"editor.defaultFormatter": "charliermarsh.ruff",
5+
"editor.codeActionsOnSave": {
6+
"source.organizeImports": "explicit"
7+
},
8+
},
9+
"[github-actions-workflow]": {
10+
"editor.autoIndent": "keep"
11+
}
12+
}

β€ŽLICENSEβ€Ž

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Daniel Niccoli
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
Β (0)