Skip to content

Commit d216554

Browse files
Merge pull request #40 from pepkit/dev
Release 0.4.2
2 parents 4b7c2d1 + 8317c8d commit d216554

File tree

8 files changed

+109
-3
lines changed

8 files changed

+109
-3
lines changed

docs/changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
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.2] - 2024-04-16
6+
### Updated
7+
- View creation, by adding description and no_fail flag
8+
9+
510
## [0.4.1] - 2024-03-07
611
### Fixed
712
- Expired token error handling ([#17](https://github.com/pepkit/pephubclient/issues/17))

docs/templates/usage.template

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Usage reference
2+
3+
pephubclient is a command line tool that can be used to interact with the PEPhub API.
4+
It can be used to create, update, delete PEPs in the PEPhub database.
5+
6+
Below are usage examples for the different commands that can be used with pephubclient.

docs/usage.md

+65
Large diffs are not rendered by default.

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.1"
7+
__version__ = "0.4.2"
88
__author__ = "Oleksandr Khoroshevskyi, Rafal Stepien"
99

1010

pephubclient/helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def send_request(
3535
headers: Optional[dict] = None,
3636
cookies: Optional[dict] = None,
3737
params: Optional[dict] = None,
38-
json: Optional[dict] = None,
38+
json: Optional[Union[dict, list]] = None,
3939
) -> requests.Response:
4040
request_return = requests.request(
4141
method=method,

pephubclient/modules/view.py

+9
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,25 @@ def create(
7171
name: str,
7272
tag: str,
7373
view_name: str,
74+
description: str = None,
7475
sample_list: list = None,
76+
no_fail: bool = False,
7577
):
7678
"""
7779
Create view in project in PEPhub.
7880
7981
:param namespace: namespace of project
8082
:param name: name of project
8183
:param tag: tag of project
84+
:param description: description of the view
8285
:param view_name: name of the view
8386
:param sample_list: list of sample names
87+
:param no_fail: whether to raise an error if view was not added to the project
8488
"""
89+
90+
if not sample_list or not isinstance(sample_list, list):
91+
raise ValueError("Sample list must be a list of sample names.")
92+
8593
url = self._build_view_request_url(
8694
namespace=namespace, name=name, view_name=view_name
8795
)
@@ -92,6 +100,7 @@ def create(
92100
method="POST",
93101
url=url,
94102
headers=self.parse_header(self.__jwt_data),
103+
params={"description": description, "no_fail": no_fail},
95104
json=sample_list,
96105
)
97106
if response.status_code == ResponseStatusCodes.ACCEPTED:

requirements/requirements-test.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ coveralls
88
pytest-cov
99
pre-commit
1010
coverage
11-
smokeshow
11+
smokeshow

scripts/update_usage_docs.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
cp ../docs/templates/usage.template usage.template
3+
4+
for cmd in "--help" "pull --help" "push --help"; do
5+
echo $cmd
6+
echo -e "## \`phc $cmd\`" > USAGE_header.temp
7+
phc $cmd --help > USAGE.temp 2>&1
8+
# sed -i 's/^/\t/' USAGE.temp
9+
sed -i.bak '1s;^;\`\`\`console\
10+
;' USAGE.temp
11+
# sed -i '1s/^/\n\`\`\`console\n/' USAGE.temp
12+
echo -e "\`\`\`\n" >> USAGE.temp
13+
#sed -i -e "/\`looper $cmd\`/r USAGE.temp" -e '$G' usage.template # for -in place inserts
14+
cat USAGE_header.temp USAGE.temp >> usage.template # to append to the end
15+
done
16+
rm USAGE.temp
17+
rm USAGE_header.temp
18+
rm USAGE.temp.bak
19+
mv usage.template ../docs/usage.md
20+
#cat usage.template
21+
# rm USAGE.temp

0 commit comments

Comments
 (0)