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

Release 0.4.1 #38

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 40 additions & 0 deletions .github/workflows/cli-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: test coverage

on:
push:
branches: [master, dev]

jobs:
cli-coverage-report:
strategy:
matrix:
python-version: [ "3.11" ]
khoroshevskyi marked this conversation as resolved.
Show resolved Hide resolved
os: [ ubuntu-latest ]
r: [ release ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v1
with:
python-version: '3.10'

- name: Install test dependencies
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi

- run: pip install .

- name: Run tests
run: coverage run -m pytest

- name: build coverage
run: coverage html -i

- run: smokeshow upload htmlcov
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 80
SMOKESHOW_GITHUB_CONTEXT: coverage
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}
38 changes: 0 additions & 38 deletions .github/workflows/run-codecov.yml

This file was deleted.

34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
# `PEPHubClient`
<h1 align="center">PEPHubClient</h1>

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


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

`pephubclient` features:

---

**Documentation**: <a href="https://pep.databio.org/" target="_blank">https://pep.databio.org</a>

**Source Code**: <a href="https://github.com/pepkit/pephubclient" target="_blank">https://github.com/pepkit/pephubclient</a>

---

## Installation
To install `pepdbagent` use this command:
```
pip install pephubclient
```
or install the latest version from the GitHub repository:
```
pip install git+https://github.com/pepkit/pephubclient.git
```

---

### `pephubclient` features:
1) `push` (upload) projects)
2) `pull` (download projects)

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

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

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

Expand Down
21 changes: 0 additions & 21 deletions codecov.yml

This file was deleted.

4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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.

## [0.4.1] - 2024-03-07
### Fixed
- Expired token error handling ([#17](https://github.com/pepkit/pephubclient/issues/17))

## [0.4.0] - 2024-02-12
### Added
- a parameter that points to where peps should be saved ([#32](https://github.com/pepkit/pephubclient/issues/32))
Expand Down
2 changes: 1 addition & 1 deletion pephubclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import coloredlogs

__app_name__ = "pephubclient"
__version__ = "0.4.0"
__version__ = "0.4.1"
__author__ = "Oleksandr Khoroshevskyi, Rafal Stepien"


Expand Down
11 changes: 10 additions & 1 deletion pephubclient/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def send_request(
params: Optional[dict] = None,
json: Optional[dict] = None,
) -> requests.Response:
return requests.request(
request_return = requests.request(
khoroshevskyi marked this conversation as resolved.
Show resolved Hide resolved
method=method,
url=url,
verify=False,
Expand All @@ -46,6 +46,15 @@ def send_request(
params=params,
json=json,
)
if request_return.status_code == 401:
khoroshevskyi marked this conversation as resolved.
Show resolved Hide resolved
if (
RequestManager.decode_response(request_return, output_json=True).get(
"detail"
)
== "JWT has expired"
):
raise ResponseError("JWT has expired. Please log in again.")
return request_return

@staticmethod
def decode_response(
Expand Down
4 changes: 3 additions & 1 deletion requirements/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ pytest-mock
flake8
coveralls
pytest-cov
pre-commit
pre-commit
coverage
smokeshow
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ def read_reqs(reqs_name):
keywords="project, bioinformatics, metadata",
url=f"https://github.com/databio/{PACKAGE}/",
author=AUTHOR,
author_email="khorosh@virginia.edu",
khoroshevskyi marked this conversation as resolved.
Show resolved Hide resolved
license="BSD2",
entry_points={
"console_scripts": [
"phc = pephubclient.__main__:main",
],
},
package_data={PACKAGE: ["templates/*"]},
scripts=None,
include_package_data=True,
test_suite="tests",
tests_require=read_reqs("test"),
Expand Down
Loading