Skip to content

Commit 9c27431

Browse files
committed
feat: initial sdk checkin
0 parents  commit 9c27431

File tree

139 files changed

+17798
-0
lines changed

Some content is hidden

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

139 files changed

+17798
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @openfga/core
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Report an issue
3+
about: Create a bug report about an existing issue.
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Please do not report security vulnerabilities here**. See the [Responsible Disclosure Program](https://github.com/openfga/python-sdk/blob/main/.github/SECURITY.md).
11+
12+
**Thank you in advance for helping us to improve this library!** Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible.
13+
14+
By submitting an issue to this repository, you agree to the terms within the [OpenFGA Code of Conduct](https://github.com/openfga/rfcs/blob/main/CODE-OF-CONDUCT.md).
15+
16+
### Description
17+
18+
> Provide a clear and concise description of the issue, including what you expected to happen.
19+
20+
### Reproduction
21+
22+
> Detail the steps taken to reproduce this error, what was expected, and whether this issue can be reproduced consistently or if it is intermittent.
23+
>
24+
> Where applicable, please include:
25+
>
26+
> - Code sample to reproduce the issue
27+
> - Log files (redact/remove sensitive information)
28+
> - Application settings (redact/remove sensitive information)
29+
> - Screenshots
30+
31+
### Environment
32+
33+
> Please provide the following:
34+
35+
- **Version of this library used:**
36+
- **Version of the platform or framework used, if applicable:**
37+
- **Other relevant versions (language, server software, OS, browser):**
38+
- **Other modules/plugins/libraries that might be involved:**
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Feature request
3+
about: Suggest new functionality for this project.
4+
title: ''
5+
labels: 'feature'
6+
assignees: ''
7+
8+
---
9+
10+
**Please do not report security vulnerabilities here**. See the [Responsible Disclosure Program](https://github.com/openfga/python-sdk/blob/main/.github/SECURITY.md).
11+
12+
**Thank you in advance for helping us to improve this library!** Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible.
13+
14+
By submitting an issue to this repository, you agree to the terms within the [OpenFGA Code of Conduct](https://github.com/openfga/rfcs/blob/main/CODE-OF-CONDUCT.md).
15+
16+
### Describe the problem you'd like to have solved
17+
18+
> A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
19+
20+
### Describe the ideal solution
21+
22+
> A clear and concise description of what you want to happen.
23+
24+
## Alternatives and current workarounds
25+
26+
> A clear and concise description of any alternatives you've considered or any workarounds that are currently in place.
27+
28+
### Additional context
29+
30+
> Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
We are not accepting new Pull Requests for the time being. Please raise an issue or contact us in the [support community](https://discord.gg/8naAwJfWN6) instead.

.github/SECURITY.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Security Policy
2+
3+
This document outlines the Responsible Disclosure Program for OpenFGA.
4+
5+
## Responsible Disclosure Policy
6+
7+
8+
## Reporting a vulnerability

.github/workflows/main.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Build, Test and Publish
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
fossa:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.x
17+
cache: 'pip'
18+
cache-dependency-path: |
19+
**/setup.cfg
20+
**/requirements*.txt
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install -r requirements.txt
25+
pip install setuptools wheel twine
26+
- name: Build
27+
run: python setup.py sdist bdist_wheel
28+
- name: Run FOSSA scan and upload build data
29+
uses: fossas/fossa-action@main
30+
with:
31+
api-key: ${{ secrets.FOSSA_API_KEY }}
32+
branch: ${{ github.ref_name }}
33+
- name: Run FOSSA tests
34+
uses: fossas/fossa-action@main
35+
with:
36+
api-key: ${{ secrets.FOSSA_API_KEY }}
37+
run-tests: true
38+
39+
snyk:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v3
43+
- name: Set up Python
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: 3.x
47+
cache: 'pip'
48+
cache-dependency-path: |
49+
**/setup.cfg
50+
**/requirements*.txt
51+
- name: Install dependencies
52+
run: |
53+
python -m pip install --upgrade pip
54+
python -m pip install -r requirements.txt
55+
pip install setuptools wheel twine
56+
- name: Build
57+
run: python setup.py sdist bdist_wheel
58+
- name: Run Snyk to check for vulnerabilities
59+
env:
60+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
61+
run: |
62+
npm install -g snyk
63+
snyk auth $SNYK_TOKEN
64+
snyk monitor
65+
66+
test:
67+
runs-on: ubuntu-latest
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
python-version: ["3.9", "3.10"]
72+
steps:
73+
- uses: actions/checkout@v3
74+
- name: Set up Python ${{ matrix.python-version }}
75+
uses: actions/setup-python@v4
76+
with:
77+
python-version: ${{ matrix.python-version }}
78+
cache: 'pip'
79+
cache-dependency-path: |
80+
**/setup.cfg
81+
**/requirements*.txt
82+
- name: Install dependencies
83+
run: |
84+
python -m pip install --upgrade pip
85+
python -m pip install -r test-requirements.txt
86+
- name: Test
87+
run: python -m unittest test/*
88+
- name: Flake8 on SDK
89+
run: python -m flake8 --ignore F401,E402,E501,W504 openfga_sdk
90+
- name: Flake8 on unit test
91+
run: python -m flake8 --ignore E501 test
92+
93+
create-release:
94+
runs-on: ubuntu-latest
95+
if: startsWith(github.ref, 'refs/tags/v')
96+
needs: [test, fossa, snyk]
97+
98+
steps:
99+
- uses: actions/checkout@v3
100+
101+
- uses: Roang-zero1/github-create-release-action@5cf058ddffa6fa04e5cda07c98570c757dc4a0e1
102+
with:
103+
version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/semgrep.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Semgrep
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
semgrep:
8+
name: Scan
9+
runs-on: ubuntu-latest
10+
container:
11+
image: returntocorp/semgrep
12+
if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot')
13+
steps:
14+
- uses: actions/checkout@v3
15+
- run: semgrep ci
16+
env:
17+
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

.gitignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.pyc
6+
openfga_sdk/__pycache__/
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
env/
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
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+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*,cover
48+
.hypothesis/
49+
venv/
50+
.venv/
51+
.python-version
52+
.pytest_cache
53+
test/__pycache__/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
62+
# Sphinx documentation
63+
docs/_build/
64+
65+
# PyBuilder
66+
target/
67+
68+
#Ipython Notebook
69+
.ipynb_checkpoints

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
## v0.0.1
4+
5+
### [0.0.1](https://github.com/openfga/python-sdk/releases/tag/v0.0.1) (2022-08-31)
6+
7+
Initial OpenFGA Python SDK release
8+
- Support for [OpenFGA](https://github.com/openfga/openfga) API
9+
- CRUD stores
10+
- Create, read & list authorization models
11+
- Writing and Reading Tuples
12+
- Checking authorization
13+
- Using Expand to understand why access was granted

CONTRIBUTING.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributing to OpenFGA projects
2+
3+
A big welcome and thank you for considering contributing to the OpenFGA open source projects. It’s people like you that make it a reality for users in our community.
4+
5+
Reading and following these guidelines will help us make the contribution process easy and effective for everyone involved. It also communicates that you agree to respect the time of the developers managing and developing these open source projects. In return, we will reciprocate that respect by addressing your issue, assessing changes, and helping you finalize your pull requests.
6+
7+
### Table of Contents
8+
9+
* [Code of Conduct](#code-of-conduct)
10+
* [Getting Started](#getting-started)
11+
* [Making Changes](#making-changes)
12+
* [Opening Issues](#opening-issues)
13+
* [Submitting Pull Requests](#submitting-pull-requests) [Note: We are not accepting Pull Requests at this time!]
14+
* [Getting in Touch](#getting-in-touch)
15+
* [Have a question or problem?](#have-a-question-or-problem)
16+
* [Vulnerability Reporting](#vulnerability-reporting)
17+
18+
## Code of Conduct
19+
20+
By participating and contributing to this project, you are expected to uphold our [Code of Conduct](https://github.com/openfga/rfcs/blob/main/CODE-OF-CONDUCT.md).
21+
22+
## Getting Started
23+
24+
### Making Changes
25+
26+
When contributing to a repository, the first step is to open an issue on [sdk-generator](https://github.com/openfga/sd-generator) to discuss the change you wish to make before making them.
27+
28+
### Opening Issues
29+
30+
Before you submit a new issue please make sure to search all open and closed issues. It is possible your feature request/issue has already been answered. Make sure to also check the [OpenFGA discussions](https://github.com/orgs/openfga/discussions).
31+
32+
That repo includes an issue template that will walk through all the places to check before submitting your issue here. Please follow the instructions there to make sure this is not a duplicate issue and that we have everything we need to research and reproduce this problem.
33+
34+
### Submitting Pull Requests
35+
36+
Considering that the SDKs are autogenerated, please make sure to submit your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator). We will not accept PRs to this repository because they will be overwritten on the next sdk generation.
37+
38+
## Getting in touch
39+
40+
### Have a question or problem?
41+
42+
Please do not open issues for general support or usage questions. Instead, join us over in the [OpenFGA discussions](https://github.com/orgs/openfga/discussions) or [support community](https://discord.gg/8naAwJfWN6).
43+
44+
### Vulnerability Reporting
45+
46+
Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://github.com/openfga/python-sdk/blob/main/.github/SECURITY.md) details the procedure for disclosing security issues.

0 commit comments

Comments
 (0)