Skip to content

Commit c9b7ae7

Browse files
authored
Merge pull request #1057 from Sage-Bionetworks/develop
Schematic Release v23.1.1
2 parents ad78fd4 + 37563a1 commit c9b7ae7

30 files changed

+1195
-814
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ concurrency:
2525
cancel-in-progress: true
2626
jobs:
2727
test:
28-
2928
runs-on: ubuntu-latest
3029
env:
3130
POETRY_VERSION: 1.2.0rc1
3231
strategy:
32+
fail-fast: false
3333
matrix:
3434
python-version: ["3.7", "3.8", "3.9", "3.10"]
3535

@@ -109,16 +109,17 @@ jobs:
109109
run: >
110110
source .venv/bin/activate;
111111
pytest --cov-report=term --cov-report=html:htmlcov --cov=schematic/
112-
-m "not google_credentials_needed"
112+
-m "not (google_credentials_needed or table_operations)"
113113
114114
- name: Run tests
115115
env:
116-
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }}
116+
SYNAPSE_ACCESS_TOKEN: ${{ secrets.SYNAPSE_ACCESS_TOKEN }}
117+
SERVICE_ACCOUNT_CREDS: ${{ secrets.SERVICE_ACCOUNT_CREDS }}
117118
if: ${{ false == contains(github.event.head_commit.message, 'runcombos') }}
118119
run: >
119120
source .venv/bin/activate;
120121
pytest --cov-report=term --cov-report=html:htmlcov --cov=schematic/
121-
-m "not (google_credentials_needed or rule_combos or schematic_api)"
122+
-m "not (google_credentials_needed or rule_combos or schematic_api or table_operations)"
122123
123124
- name: Upload pytest test results
124125
uses: actions/upload-artifact@v2

.readthedocs.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
# Borrowed idea from: https://github.com/readthedocs/readthedocs.org/issues/4912
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-20.04
11+
tools:
12+
python: "3.9"
13+
jobs:
14+
post_install:
15+
- pip install poetry==1.2.0b1
16+
- poetry config virtualenvs.create false
17+
- poetry install --with doc
18+
#Poetry will install my dependencies into the virtualenv created by readthedocs if I set virtualenvs.create=false
19+
# You can also specify other tool versions:
20+
# nodejs: "16"
21+
# rust: "1.55"
22+
# golang: "1.17"
23+
24+
# Build documentation in the docs/ directory with Sphinx
25+
sphinx:
26+
configuration: docs/source/conf.py
27+
28+
# If using Sphinx, optionally build your docs in additional formats such as PDF
29+
# formats:
30+
# - pdf
31+
32+
# Optionally declare the Python requirements required to build your docs
33+
# python:
34+
# install:
35+
# - requirements: docs/requirements.txt

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM python:3.10.6
1+
# FROM python:3.10.6
2+
FROM python:3.10.8-slim-bullseye
23

34
ENV PYTHONFAULTHANDLER=1 \
45
PYTHONUNBUFFERED=1 \
@@ -12,8 +13,11 @@ WORKDIR /usr/src/app
1213

1314
RUN apt-get update -qqy \
1415
&& apt-get install -qqy \
15-
libopenblas-dev \
16-
gfortran
16+
libopenblas-dev \
17+
gfortran
18+
19+
# remove libtiff5 for security reasons
20+
RUN apt remove -y libtiff5
1721

1822
RUN pip install --no-cache-dir "poetry==$POETRY_VERSION"
1923

README.md

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,12 @@ Description of `config.yml` attributes
9494

9595
definitions:
9696
synapse_config: "~/path/to/.synapseConfig"
97-
creds_path: "~/path/to/credentials.json"
98-
token_pickle: "~/path/to/token.pickle"
9997
service_acct_creds: "~/path/to/service_account_creds.json"
10098

10199
synapse:
102100
master_fileview: "syn23643253" # fileview of project with datasets on Synapse
103101
manifest_folder: "~/path/to/manifest_folder/" # manifests will be downloaded to this folder
104102
manifest_basename: "filename" # base name of the manifest file in the project dataset, without extension
105-
token_creds: "syn23643259" # synapse ID of credentials.json file
106103
service_acct_creds: "syn25171627" # synapse ID of service_account_creds.json file
107104

108105
manifest:
@@ -139,28 +136,12 @@ synapse login -u <synapse username> -p <synapse password> --rememberMe
139136
Please make sure that you run the command before running `schematic init` below
140137

141138
7. Obtain Google credential Files
142-
143-
To obtain ``credentials.json`` and ``token.pickle``, please run:
144-
139+
To obtain ``schematic_service_account_creds.json``, please run:
145140
```
146141
schematic init --config ~/path/to/config.yml
147142
```
148-
This should prompt you with a URL that will take you through Google OAuth. Your `credentials.json` and `token.pickle` will get automatically downloaded the first time you run this command.
149-
150-
*Note* : The ``credentials.json`` file is required when you are using
151-
[OAuth2](https://developers.google.com/identity/protocols/oauth2)
152-
to authenticate with the Google APIs.
153-
154-
For details about the steps involved in the [OAuth2 authorization
155-
flow](https://github.com/Sage-Bionetworks/schematic/blob/develop/schematic/utils/google_api_utils.py#L18)
156-
refer to the ``Credentials`` section in the
157-
[docs/md/details](https://github.com/Sage-Bionetworks/schematic/blob/develop/docs/md/details.md#credentials)
158-
document.
143+
> As v22.12.1 version of schematic, using `token` mode of authentication (in other words, using `token.pickle` and `credentials.json`) is no longer supported due to Google's decision to move away from using OAuth out-of-band (OOB) flow. Click [here](https://developers.google.com/identity/protocols/oauth2/resources/oob-migration) to learn more.
159144
160-
To obtain ``schematic_service_account_creds.json``, please run:
161-
```
162-
schematic init --config ~/path/to/config.yml --auth service_account
163-
```
164145
*Notes*: Use the ``schematic_service_account_creds.json`` file for the service
165146
account mode of authentication (*for Google services/APIs*). Service accounts
166147
are special Google accounts that can be used by applications to access Google APIs
@@ -224,16 +205,19 @@ docker run --rm -p 3001:3001 \
224205
python /usr/src/app/run_api.py
225206
```
226207

227-
#### Use content of `config.yml` as an environment variable to run API endpoints:
228-
1. save content of `config.yml` as to environment variable `SCHEMATIC_CONFIG_CONTENT` by doing: `export SCHEMATIC_CONFIG_CONTENT=$(cat config.yml)`
208+
#### Use content of `config.yml` and `schematic_service_account_creds.json`as an environment variable to run API endpoints:
209+
1. save content of `config.yml` as to environment variable `SCHEMATIC_CONFIG_CONTENT` by doing: `export SCHEMATIC_CONFIG_CONTENT=$(cat /path/to/config.yml)`
210+
211+
2. Similarly, save the content of `schematic_service_account_creds.json` as `SERVICE_ACCOUNT_CREDS` by doing: `export SERVICE_ACCOUNT_CREDS=$(cat /path/to/schematic_service_account_creds.json)`
229212

230-
2. Pass `SCHEMATIC_CONFIG_CONTENT` as an environment variable by using `docker run`
213+
3. Pass `SCHEMATIC_CONFIG_CONTENT` and `schematic_service_account_creds` as environment variables by using `docker run`
231214

232215
```
233216
docker run --rm -p 3001:3001 \
234217
-v $(pwd):/schematic -w /schematic --name schematic \
235218
-e GE_HOME=/usr/src/app/great_expectations/ \
236219
-e SCHEMATIC_CONFIG_CONTENT=$SCHEMATIC_CONFIG_CONTENT \
220+
-e SERVICE_ACCOUNT_CREDS=$SERVICE_ACCOUNT_CREDS \
237221
sagebionetworks/schematic \
238222
python /usr/src/app/run_api.py
239223
```

api/openapi/api.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ paths:
4747
- Patient
4848
- Biospecimen
4949
required: true
50-
- in: query
51-
name: oauth
52-
schema:
53-
type: boolean
54-
default: true
55-
description: OAuth or Service Account
56-
required: false
5750
- in: query
5851
name: use_annotations
5952
schema:
@@ -413,8 +406,8 @@ paths:
413406
- Manifest Operations
414407
/get/datatype/manifest:
415408
get:
416-
summary: Retrieve asset view table as a dataframe.
417-
description: Retrieve asset view table as a dataframe.
409+
summary: Get datatype of attributes in manifest
410+
description: Get datatype of attributes in manifest
418411
operationId: api.routes.get_manifest_datatype
419412
parameters:
420413
- in: query

api/routes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,11 @@ def get_temp_jsonld(schema_url):
197197
return tmp_file.name
198198

199199
# @before_request
200-
def get_manifest_route(schema_url: str, oauth: bool, use_annotations: bool, dataset_ids=None, asset_view = None, output_format=None, title=None):
200+
def get_manifest_route(schema_url: str, use_annotations: bool, dataset_ids=None, asset_view = None, output_format=None, title=None):
201201
"""Get the immediate dependencies that are related to a given source node.
202202
Args:
203203
schema_url: link to data model in json ld format
204204
title: title of a given manifest.
205-
oauth: if user wants to use OAuth for Google authentication
206205
dataset_id: Synapse ID of the "dataset" entity on Synapse (for a given center/project).
207206
output_format: contains three option: "excel", "google_sheet", and "dataframe". if set to "excel", return an excel spreadsheet
208207
use_annotations: Whether to use existing annotations during manifest generation
@@ -258,7 +257,6 @@ def create_single_manifest(data_type, title, dataset_id=None, output_format=None
258257
path_to_json_ld=jsonld,
259258
title=title,
260259
root=data_type,
261-
oauth=oauth,
262260
use_annotations=use_annotations,
263261
alphabetize_valid_values = 'ascending',
264262
)

config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# Do not change the 'definitions' section unless you know what you're doing
22
definitions:
33
synapse_config: ".synapseConfig"
4-
creds_path: "credentials.json"
5-
token_pickle: "token.pickle"
64
service_acct_creds: "schematic_service_account_creds.json"
75

86
synapse:
97
master_fileview: 'syn23643253'
108
manifest_folder: 'manifests'
119
manifest_basename: 'synapse_storage_manifest'
12-
token_creds: 'syn23643259'
1310
service_acct_creds: 'syn25171627'
1411

1512
manifest:

docs/requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)