-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from City-of-Helsinki/YM-470-add-initial-separa…
…ted-library YM-470 | Add initial separated GDPR library
- Loading branch information
Showing
30 changed files
with
1,201 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
max_line_length = 120 | ||
|
||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{json,toml,yaml,yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Continuous integration | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Cache pip packages | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-pip-modules | ||
with: | ||
path: ~/.pip-cache | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/requirements-dev.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements-dev.txt codecov | ||
pip install -e . | ||
- name: Run tests | ||
run: pytest -ra -vv --doctest-modules --cov=. | ||
|
||
- name: Coverage | ||
run: codecov | ||
|
||
build: | ||
name: Build package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: pip install -U setuptools wheel build | ||
- name: Build | ||
run: python -m build . | ||
|
||
black: | ||
name: Coding style - black | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Run black | ||
uses: psf/black@stable | ||
with: | ||
args: ". --check" | ||
|
||
flake8: | ||
name: Coding style - flake8 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: pip install flake8 pep8-naming flake8-bugbear | ||
- name: Run flake8 | ||
uses: liskin/gh-problem-matcher-wrap@v1 | ||
with: | ||
linters: flake8 | ||
run: flake8 | ||
|
||
isort: | ||
name: Coding style - isort | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: pip install isort | ||
- name: Run isort | ||
uses: liskin/gh-problem-matcher-wrap@v1 | ||
with: | ||
linters: isort | ||
run: isort -c . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'release-*' | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build and publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: pip install -U setuptools wheel build | ||
- name: Build | ||
run: python -m build . | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Publish to TestPyPI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build and publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: pip install -U setuptools wheel build | ||
- name: Build | ||
run: python -m build . | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
default_language_version: | ||
python: python3 | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.4 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [pep8-naming, flake8-bugbear] | ||
- repo: https://github.com/timothycrosley/isort | ||
rev: 5.7.0 | ||
hooks: | ||
- id: isort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Contributions are accepted as pull requests. Contributions should be in line with | ||
the best practices described in this repo. Please also observe our coding | ||
practices at https://dev.hel.fi/. | ||
Please make your pull requests short, elegant and only handling one | ||
issue at a time! | ||
|
||
If you make a pull request, you may also want to notify our developers on | ||
[Gitter](https://gitter.im/City-of-Helsinki/heldev) to tell about your contribution. | ||
|
||
Please also observe our [contribution handling guidelines](https://dev.hel.fi/accepting-contributions) | ||
for contributing to City of Helsinki open source projects in general. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include LICENSE | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# helsinki-profile-gdpr-api | ||
Django app for implementing Helsinki profile GDPR API | ||
# Helsinki profile GDPR API | ||
|
||
Django app for implementing Helsinki profile GDPR API. | ||
|
||
This library will allow a service using Helsinki profile to implement the GDPR | ||
functionality required by [open-city-profile](https://github.com/City-of-Helsinki/open-city-profile) | ||
backend. | ||
|
||
## Installation | ||
|
||
1. `pip install helsinki-profile-gdpr-api` | ||
|
||
## Usage | ||
|
||
1. Authentication needs to be configured for the required `django-heluser` | ||
|
||
2. Model which is to be used for GDPR operations should inherit `SerializableMixin` and | ||
include the required `serialize_fields` property. | ||
|
||
3. Define the following settings in your Django configuration. | ||
|
||
| Setting | Example | Description | | ||
|---|---|---| | ||
| GDPR_API_MODEL | "youths.YouthProfile" | GDPR profile model in the form `app_label.model_name`. model_name is case-insensitive. | | ||
| GDPR_API_QUERY_SCOPE | "jassariapi.gdprquery" | API scope required for the query operation. | | ||
| GDPR_API_DELETE_SCOPE | "jassariapi.gdprdelete" | API scope required for the delete operation. | | ||
|
||
4. Add the GDPR API urls into your url config: | ||
|
||
```python | ||
urlpatterns = [ | ||
... | ||
path("gdpr-api/", include("helsinki_gdpr.urls")), | ||
] | ||
``` | ||
|
||
## Code format | ||
|
||
This project uses | ||
[`black`](https://github.com/ambv/black), | ||
[`flake8`](https://gitlab.com/pycqa/flake8) and | ||
[`isort`](https://github.com/timothycrosley/isort) | ||
for code formatting and quality checking. Project follows the basic black config, without any modifications. | ||
|
||
Basic `black` commands: | ||
|
||
* To let `black` do its magic: `black .` | ||
* To see which files `black` would change: `black --check .` | ||
|
||
[`pre-commit`](https://pre-commit.com/) can be used to install and run all the formatting tools as git hooks | ||
automatically before a commit. |
Empty file.
Oops, something went wrong.