Skip to content

Commit 4b7c2d1

Browse files
Merge pull request #38 from pepkit/dev
Release 0.4.1
2 parents 5389da7 + e10550c commit 4b7c2d1

File tree

9 files changed

+88
-68
lines changed

9 files changed

+88
-68
lines changed

.github/workflows/cli-coverage.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: test coverage
2+
3+
on:
4+
push:
5+
branches: [master, dev]
6+
7+
jobs:
8+
cli-coverage-report:
9+
strategy:
10+
matrix:
11+
python-version: [ "3.11" ]
12+
os: [ ubuntu-latest ]
13+
r: [ release ]
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- uses: actions/setup-python@v1
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install test dependencies
23+
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi
24+
25+
- run: pip install .
26+
27+
- name: Run tests
28+
run: coverage run -m pytest
29+
30+
- name: build coverage
31+
run: coverage html -i
32+
33+
- run: smokeshow upload htmlcov
34+
env:
35+
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
36+
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 80
37+
SMOKESHOW_GITHUB_CONTEXT: coverage
38+
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
40+
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}

.github/workflows/run-codecov.yml

-38
This file was deleted.

README.md

+29-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
1-
# `PEPHubClient`
1+
<h1 align="center">PEPHubClient</h1>
22

33
[![PEP compatible](https://pepkit.github.io/img/PEP-compatible-green.svg)](https://pepkit.github.io)
44
![Run pytests](https://github.com/pepkit/pephubclient/workflows/Run%20pytests/badge.svg)
5-
[![codecov](https://codecov.io/gh/pepkit/pephubclient/branch/dev/graph/badge.svg)](https://codecov.io/gh/pepkit/pephubclient)
6-
[![pypi-badge](https://img.shields.io/pypi/v/pephubclient)](https://pypi.org/project/pephubclient)
5+
[![pypi-badge](https://img.shields.io/pypi/v/pephubclient?color=%2334D058)](https://pypi.org/project/pephubclient)
6+
[![pypi-version](https://img.shields.io/pypi/pyversions/pephubclient.svg?color=%2334D058)](https://pypi.org/project/pephubclient)
7+
[![Coverage](https://coverage-badge.samuelcolvin.workers.dev/pepkit/pephubclient.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/pepkit/pephubclient)
8+
[![Github badge](https://img.shields.io/badge/source-github-354a75?logo=github)](https://github.com/pepkit/pephubclient)
79
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
810

11+
912
`PEPHubClient` is a tool to provide Python API and CLI for [PEPhub](https://pephub.databio.org).
1013

11-
`pephubclient` features:
14+
15+
---
16+
17+
**Documentation**: <a href="https://pep.databio.org/" target="_blank">https://pep.databio.org</a>
18+
19+
**Source Code**: <a href="https://github.com/pepkit/pephubclient" target="_blank">https://github.com/pepkit/pephubclient</a>
20+
21+
---
22+
23+
## Installation
24+
To install `pepdbagent` use this command:
25+
```
26+
pip install pephubclient
27+
```
28+
or install the latest version from the GitHub repository:
29+
```
30+
pip install git+https://github.com/pepkit/pephubclient.git
31+
```
32+
33+
---
34+
35+
### `pephubclient` features:
1236
1) `push` (upload) projects)
1337
2) `pull` (download projects)
1438

@@ -17,7 +41,7 @@ The authorization process is based on pephub device authorization protocol.
1741
To upload projects or to download private projects, user must be authorized through pephub.
1842

1943
If you want to use your own pephub instance, you can specify it by setting `PEPHUB_BASE_URL` environment variable.
20-
e.g. `export PEPHUB_BASE_URL=https://pephub.databio.org` (This is original pephub instance)
44+
e.g. `export PEPHUB_BASE_URL=https://pephub.databio.org/` (This is original pephub instance)
2145

2246
To login, use the `login` argument; to logout, use `logout`.
2347

codecov.yml

-21
This file was deleted.

docs/changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
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.
44

5+
## [0.4.1] - 2024-03-07
6+
### Fixed
7+
- Expired token error handling ([#17](https://github.com/pepkit/pephubclient/issues/17))
8+
59
## [0.4.0] - 2024-02-12
610
### Added
711
- a parameter that points to where peps should be saved ([#32](https://github.com/pepkit/pephubclient/issues/32))

pephubclient/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import coloredlogs
55

66
__app_name__ = "pephubclient"
7-
__version__ = "0.4.0"
7+
__version__ = "0.4.1"
88
__author__ = "Oleksandr Khoroshevskyi, Rafal Stepien"
99

1010

pephubclient/helpers.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def send_request(
3737
params: Optional[dict] = None,
3838
json: Optional[dict] = None,
3939
) -> requests.Response:
40-
return requests.request(
40+
request_return = requests.request(
4141
method=method,
4242
url=url,
4343
verify=False,
@@ -46,6 +46,15 @@ def send_request(
4646
params=params,
4747
json=json,
4848
)
49+
if request_return.status_code == 401:
50+
if (
51+
RequestManager.decode_response(request_return, output_json=True).get(
52+
"detail"
53+
)
54+
== "JWT has expired"
55+
):
56+
raise ResponseError("JWT has expired. Please log in again.")
57+
return request_return
4958

5059
@staticmethod
5160
def decode_response(

requirements/requirements-test.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ pytest-mock
66
flake8
77
coveralls
88
pytest-cov
9-
pre-commit
9+
pre-commit
10+
coverage
11+
smokeshow

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ def read_reqs(reqs_name):
4949
keywords="project, bioinformatics, metadata",
5050
url=f"https://github.com/databio/{PACKAGE}/",
5151
author=AUTHOR,
52+
author_email="[email protected]",
5253
license="BSD2",
5354
entry_points={
5455
"console_scripts": [
5556
"phc = pephubclient.__main__:main",
5657
],
5758
},
5859
package_data={PACKAGE: ["templates/*"]},
59-
scripts=None,
6060
include_package_data=True,
6161
test_suite="tests",
6262
tests_require=read_reqs("test"),

0 commit comments

Comments
 (0)