Skip to content

Commit 3087c52

Browse files
Merge pull request #15 from pepkit/device_login
First release 🥳
2 parents 3655f16 + 4af98bd commit 3087c52

Some content is hidden

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

42 files changed

+1174
-484
lines changed

.github/workflows/black.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: psf/black@stable

.github/workflows/pytest-windows.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run pytests windows
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
pull_request:
7+
branches: [main, dev]
8+
9+
jobs:
10+
pytest:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
python-version: ["3.10"]
15+
os: [windows-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install all dependencies
26+
run: pip install -r requirements/requirements-all.txt
27+
28+
- name: Install test dependencies
29+
run: pip install -r requirements/requirements-test.txt
30+
31+
- name: Install package
32+
run: python -m pip install .
33+
34+
- name: Run pytest tests
35+
run: pytest tests -v

.github/workflows/pytest.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run pytests
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
pull_request:
7+
branches: [main, dev]
8+
9+
jobs:
10+
pytest:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.11"]
15+
os: [ubuntu-20.04]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install all dependencies
26+
run: if [ -f requirements/requirements-all.txt ]; then pip install -r requirements/requirements-all.txt; fi
27+
28+
- name: Install test dependencies
29+
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi
30+
31+
- name: Install package
32+
run: python -m pip install .
33+
34+
- name: Run pytest tests
35+
run: pytest tests -v

.github/workflows/python-publish.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: '3.x'
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install setuptools wheel twine
25+
- name: Build and publish
26+
env:
27+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29+
run: |
30+
python setup.py sdist bdist_wheel
31+
twine upload dist/*

LICENSE.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Copyright 2023 Nathan Sheffield
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include requirements/*
2+
include README.md
3+
include pephubclient/pephub_oauth/*

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
lint:
2-
black . && isort . && flake8
2+
# black should be last in the list, as it lint the code. Tests can fail if order will be different
3+
flake8 && isort . && black .
34

45
run-coverage:
56
coverage run -m pytest

README.md

+73-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,80 @@
11
# `PEPHubClient`
22

3-
`PEPHubClient` is a tool to provide Python and CLI interface for `pephub`.
4-
Authorization is based on `OAuth` with using GitHub.
3+
[![PEP compatible](https://pepkit.github.io/img/PEP-compatible-green.svg)](https://pepkit.github.io)
4+
![Run pytests](https://github.com/pepkit/pephubclient/workflows/Run%20pytests/badge.svg)
5+
[![pypi-badge](https://img.shields.io/pypi/v/pephubclient)](https://pypi.org/project/pephubclient)
6+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
57

6-
The authorization process is slightly complex and needs more explanation.
7-
The explanation will be provided based on two commands:
8+
`PEPHubClient` is a tool to provide Python API and CLI for [PEPhub](https://pephub.databio.org).
89

10+
`pephubclient` features:
11+
1) `push` (upload) projects)
12+
2) `pull` (download projects)
913

10-
## 1. `pephubclient login`
11-
To authenticate itself user must execute `pephubclient login` command (1).
12-
Command triggers the process of authenticating with GitHub.
13-
`PEPHubClient` sends the request for user and device verification codes (2), and
14-
GitHub responds with the data (3). Next, if user is not logged in, GitHub
15-
asks for login (4), user logs in (5) and then GitHub asks to input
16-
verification code (6) that is shown to user in the CLI.
17-
After inputting the correct verification code (7), `PEPHubClient`
18-
sends the request to GitHub and asks about access token (8), which is then
19-
provided by GitHub based on data from authentication (9).
20-
![](static/pephubclient_login.png)
14+
Additionally, our client supports pephub authorization.
15+
The authorization process is based on pephub device authorization protocol.
16+
To upload projects or to download private projects, user must be authorized through pephub.
2117

18+
To login, use the `login` argument; to logout, use `logout`.
2219

23-
## 2. `pephubclient pull project/name:tag`
24-
![](static/pephubclient_pull.png)
20+
----
21+
```text
22+
$ phc --help
23+
24+
Usage: pephubclient [OPTIONS] COMMAND [ARGS]...
25+
26+
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
27+
│ --version -v │
28+
│ --install-completion Install completion for the current shell. │
29+
│ --show-completion Show completion for the current shell, to copy it or customize the │
30+
│ installation. │
31+
│ --help Show this message and exit. │
32+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
33+
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────╮
34+
│ login Login to PEPhub │
35+
│ logout Logout │
36+
│ pull Download and save project locally. │
37+
│ push Upload/update project in PEPhub │
38+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
39+
```
40+
41+
```text
42+
$ phc pull --help
43+
44+
Usage: pephubclient pull [OPTIONS] PROJECT_REGISTRY_PATH
45+
46+
Download and save project locally.
47+
48+
╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────╮
49+
│ * project_registry_path TEXT [default: None] [required] │
50+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
51+
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
52+
│ --force --no-force Overwrite project if it exists. [default: no-force] │
53+
│ --help Show this message and exit. │
54+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
55+
```
56+
57+
```text
58+
$ phc push --help
59+
60+
Usage: pephubclient push [OPTIONS] CFG
61+
62+
Upload/update project in PEPhub
63+
64+
╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────╮
65+
│ * cfg TEXT Project config file (YAML) or sample table (CSV/TSV)with one row per sample to constitute │
66+
│ project │
67+
│ [default: None] │
68+
│ [required] │
69+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
70+
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
71+
│ * --namespace TEXT Project namespace [default: None] [required] │
72+
│ * --name TEXT Project name [default: None] [required] │
73+
│ --tag TEXT Project tag [default: None] │
74+
│ --force --no-force Force push to the database. Use it to update, or upload project. │
75+
│ [default: no-force] │
76+
│ --is-private --no-is-private Upload project as private. [default: no-is-private] │
77+
│ --help Show this message and exit. │
78+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
79+
80+
```

docs/changelog.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.
4+
5+
6+
7+
## [0.1.0] - 2023-04-16
8+
### Added
9+
- First release

error_handling/constants.py

-7
This file was deleted.

error_handling/error_handler.py

-16
This file was deleted.

error_handling/models.py

-6
This file was deleted.

github_oauth_client/constants.py

-8
This file was deleted.

0 commit comments

Comments
 (0)