Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing main with changes from release/v1.3.0 #32

Merged
merged 46 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a755d29
Added authorization instructions for sheet2linkml.
gaurav Dec 7, 2021
43a7612
Added test to check for google_api_credentials file.
gaurav Dec 7, 2021
d289617
Cleaned up code with black.
gaurav Dec 7, 2021
66c1741
Update README.md
turbomam Dec 9, 2021
7e4fe03
Add instructions for authorizing sheet2linkml on Google Drive (PR #27)
sujaypatil96 Dec 9, 2021
11c2c5f
Google Sheet ID updated in README.md (PR #29)
sujaypatil96 Dec 9, 2021
f3ca061
Updated packages with `poetry update`.
gaurav Dec 7, 2021
f33dc72
Added `pytest` for testing.
gaurav Dec 7, 2021
20efe9a
Added a test for `--help` to the command line test.
gaurav Dec 7, 2021
edf356c
Added check for a missing Google Sheet ID.
gaurav Dec 7, 2021
943fe89
Added `--google-sheet-id` as a command line argument.
gaurav Dec 7, 2021
c4c60aa
Added check for logging_config before using it.
gaurav Dec 7, 2021
3736d8b
Updated sheet2linkml to explicitly return 0 as an exit code.
gaurav Dec 7, 2021
3af8e51
Added tests for generating a schema from a Google Sheet.
gaurav Dec 7, 2021
17cbcd7
Replaced unnecessary print() with logging.debug().
gaurav Dec 7, 2021
75f9ba9
Updated TCCM API and invocation.
gaurav Dec 7, 2021
6b831b1
Updated tests in line with CCDH Terminology Service changes.
gaurav Dec 7, 2021
f85927e
Fixed source code style with black.
gaurav Dec 7, 2021
f0bedd5
Add support for a 404 response from the TCCM Terminology Service.
gaurav Dec 3, 2021
8ae8e25
Fixed code syntax using black.
gaurav Dec 3, 2021
26d64ff
Updated CHANGELOG.
gaurav Dec 5, 2021
6786b43
Clarified Poetry installation in GitHub Action.
gaurav Dec 9, 2021
5423320
Updated pytest.yaml to run pytest.
gaurav Dec 9, 2021
20894c4
Added support for SHEET2LINKML_GOOGLE_SERVICE_ACCT.
gaurav Dec 9, 2021
f1a395f
Updated PyTest to use SHEET2LINKML_GOOGLE_SERVICE_ACCT.
gaurav Dec 9, 2021
0877d91
Renamed GitHub test and style check workflow.
gaurav Dec 9, 2021
e6f6bb4
Fixed code style with black.
gaurav Dec 9, 2021
2870a01
Improved PyTest workflow file.
gaurav Dec 9, 2021
c59a7e5
Improved GitHub Action testing workflow.
gaurav Dec 9, 2021
242303c
Moved `black` to a developmental dependency.
gaurav Dec 9, 2021
df5bb02
Attempt to fix PyTest workflow.
gaurav Dec 9, 2021
7294901
Printed out stderr to debug GitHub Action workflow issue.
gaurav Dec 9, 2021
91f2c41
Replaced @cached_property with @property @lru_cache.
gaurav Dec 9, 2021
95d9e6e
Updated CHANGELOG.
gaurav Dec 9, 2021
553d210
Added explicit maxsize to @lru_cache.
gaurav Dec 9, 2021
9914327
Removed unnecessary @lru_cache annotations.
gaurav Dec 9, 2021
5f50428
Removed unexpected @property annotation.
gaurav Dec 9, 2021
6ba77e6
Recorded change in CHANGELOG.
gaurav Dec 9, 2021
b1a9893
Removed incorrect @property.
gaurav Dec 9, 2021
d34b6e9
Fixed some descriptions in pytest.yaml.
gaurav Dec 10, 2021
c6f6e30
Added logging.basicConfig() in case of a missing logging config.
gaurav Dec 10, 2021
8ebf86e
Replaced exit() with sys.exit().
gaurav Dec 10, 2021
dd03185
Improved logging.
gaurav Dec 10, 2021
162028e
Reformatted code using black.
gaurav Dec 10, 2021
b23a539
Merge pull request #28 from cancerDHC/add-dummy-sheet-test
gaurav Dec 10, 2021
96f0c2b
pre release changes for v1.3.0
sujaypatil96 Dec 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions .github/workflows/main.yaml → .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Built from:
# https://docs.github.com/en/actions/guides/building-and-testing-python

name: black
name: Test and check code style

on: [push, pull_request]

jobs:
black:

test:
runs-on: ubuntu-latest

strategy:
Expand All @@ -17,7 +16,7 @@ jobs:
steps:

#----------------------------------------------
# check-out repo and set-up python
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
Expand All @@ -28,41 +27,39 @@ jobs:
python-version: ${{ matrix.python-version }}

#----------------------------------------------
# install & configure poetry
# cache poetry installation
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.1
- name: Cache Poetry files
id: cache-poetry
uses: actions/cache@v2
with:
virtualenvs-create: true
virtualenvs-in-project: true
path: ~/.local
key: ${{ runner.os }}-python-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# load cached venv if cache exists
# install & configure poetry
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
uses: snok/install-poetry@v1

#----------------------------------------------
# install dependencies if cache does not exist
# install dependencies
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
run: poetry install --no-interaction

#----------------------------------------------
# install your root project, if required
# run tests
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Run tests
env:
SHEET2LINKML_GOOGLE_SERVICE_ACCT: ${{ secrets.Sheet2LinkMLGoogleServiceAcct }}
run: poetry run pytest -svvv

#----------------------------------------------
# check formatting
# check formatting
#----------------------------------------------
- name: Code formatting with black
- name: Code style with black
run: |
# run black in check mode
# if files are not formatted correctly, the build will not go through
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Releases](https://github.com/cancerDHC/sheet2linkml/releases)

## [Unreleased]
* Bugs or Features yet to be resolved.

## [v1.3.0]
* Feature: added a dummy Google Sheet, the expected schema, and a test to compare them.
* Feature: cleaned up GitHub Action for style checks and added PyTest.
* Feature: added support for storing Google API credentials in an environmental variable, and added it to
GitHub Actions.
* Feature: added check for Google Sheet ID.
* Feature: updated @cached_property with @property @lru_cache to support Python 3.7.
* Bug: updated CCDH Terminology API endpoint for enumerations.
* Bug: fixed code to correctly handle 404 responses from the TCCM Terminology Service.
* Bug: replaced unnecessary print() in GSheetModel with logging.error().

## [v1.2.0] - 2021-11-29

Expand Down
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ git checkout -b release-1.2 develop # Switched to a new branch "release-1.2"
# minor bug fixes and preparing metadata for a release
# e.g., version number, build dates
# commit changes
```

Update the version number of the release in [CHANGELOG.md](CHANGELOG.md) and document some of the new changes that will be
part of the release.

```
# merge changes into "main"
git checkout main # switched to branch "main"
git merge --no-ff release-1.2 # merge into "main" with summary of changes
Expand All @@ -85,7 +90,8 @@ Once the code has been merged into the `main` branch on this repo, there are two
to ensure a release is complete.

- You should create a GitHub tag, with the appropriate version number.
- You should push the package to PyPI.
- You should push the package to PyPI. Before pushing the package to PyPI make sure you have updated the version number in the
[pyproject.toml](pyproject.toml) file so that it matches the version number of the release you described in the CHANGELOG.

### Release to Test PyPI _(optional)_
The purpose of this section is to verify that the package looks and works as intended, by viewing it on Test PyPI and
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,27 @@ source .venv/bin/activate
python -m pip install sheet2linkml
```

## Authorization

sheet2linkml uses the [`pygsheets` library](https://github.com/nithinmurali/pygsheets) in order to access sheets in
Google Drive. To authorize it to access your Google Sheets, you will need to create and download Google Drive client credentials. First,
[enable the Google Drive API](https://developers.google.com/drive/api/v3/enable-drive-api). After the API is enabled,
[create and download the client credentials](https://www.iperiusbackup.net/en/how-to-enable-google-drive-api-and-get-client-credentials/)
from the [Google API Console](https://console.developers.google.com/). Save the file as `google_api_credentials.json` in
the root directory of this project. [Detailed instructions and screenshots](https://pygsheets.readthedocs.io/en/stable/authorization.html)
are also available from the [`pygsheets` documentation](https://pygsheets.readthedocs.io/).

## Command Line Client Usage

Identify the Google Sheet that you want to convert to LinkML. Note that sheet2linkml is not currently a general-purpose Google Sheet to LinkML converter. It will only work with Google Sheets that have been written in a particular, currently undefined format.

Contact your CCDH colleagues to obtain the correct sheet ID and assert it either in a `.env` file or in the shell, like this:

```shell
export CDM_GOOGLE_SHEET_ID=WbM2Jr869ofmdcSmhX_1E0aLWvnK2-gr47Mo_tzuQKWy
export CDM_GOOGLE_SHEET_ID=1oWS7cao-fgz2MKWtyr8h2dEL9unX__0bJrWKv6mQmM4
```

A `google_api_credentials.json` file is also required in the root of this repo. Documentation is forthcoming.
A `google_api_credentials.json` file is also required in the root of this repo as detailed in the Authorization section above.

And the user is responsible for defining
- `~/path/to/crdch_model.yaml`
Expand Down
Loading