Skip to content

Commit 98c4a4d

Browse files
Merge pull request #31 from pepkit/dev
v0.3.0 release
2 parents fa51a20 + 16d734a commit 98c4a4d

File tree

7 files changed

+28
-30
lines changed

7 files changed

+28
-30
lines changed

.github/workflows/python-publish.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
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-
41
name: Upload Python Package
52

63
on:
@@ -9,9 +6,10 @@ on:
96

107
jobs:
118
deploy:
12-
9+
name: upload release to PyPI
1310
runs-on: ubuntu-latest
14-
11+
permissions:
12+
id-token: write
1513
steps:
1614
- uses: actions/checkout@v2
1715
- name: Set up Python
@@ -23,9 +21,7 @@ jobs:
2321
python -m pip install --upgrade pip
2422
pip install setuptools wheel twine
2523
- name: Build and publish
26-
env:
27-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2924
run: |
3025
python setup.py sdist bdist_wheel
31-
twine upload dist/*
26+
- name: Publish package distributions to PyPI
27+
uses: pypa/gh-action-pypi-publish@release/v1

docs/changelog.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
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.2.2] - 2024-01-06
5+
## [0.3.0] - 2024-01-17
66
### Added
77
- customization of the base pephub URL. [#22](https://github.com/pepkit/pephubclient/issues/22)
88

9+
### Updated
10+
- PEPhub API URL
11+
- Increased the required pydantic version to >2.5.0
12+
913
## [0.2.1] - 2023-11-01
1014
### Added
1115
- is_registry_path checker function

pephubclient/constants.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
from typing import Optional
33
import os
44

5-
import pydantic
6-
from pydantic import BaseModel
5+
from pydantic import BaseModel, field_validator
76

8-
PEPHUB_BASE_URL = os.getenv("PEPHUB_BASE_URL", default="https://pephub.databio.org/")
7+
PEPHUB_BASE_URL = os.getenv(
8+
"PEPHUB_BASE_URL", default="https://pephub-api.databio.org/"
9+
)
910
# PEPHUB_BASE_URL = "http://0.0.0.0:8000/"
1011
PEPHUB_PEP_API_BASE_URL = f"{PEPHUB_BASE_URL}api/v1/projects/"
1112
PEPHUB_PEP_SEARCH_URL = f"{PEPHUB_BASE_URL}api/v1/namespaces/{{namespace}}/projects"
@@ -19,7 +20,7 @@ class RegistryPath(BaseModel):
1920
subitem: Optional[str]
2021
tag: Optional[str] = "default"
2122

22-
@pydantic.validator("tag")
23+
@field_validator("tag")
2324
def tag_should_not_be_none(cls, v):
2425
return v or "default"
2526

pephubclient/helpers.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import json
2-
from typing import Any, Callable, NoReturn, Optional
2+
from typing import Any, Callable, Optional
33

44
import requests
55
from requests.exceptions import ConnectionError
66

77
from ubiquerg import parse_registry_path
8-
from pydantic.error_wrappers import ValidationError
8+
from pydantic import ValidationError
99

1010
from pephubclient.exceptions import PEPExistsError, ResponseError
1111
from pephubclient.constants import RegistryPath
@@ -57,15 +57,15 @@ class MessageHandler:
5757
GREEN = 40
5858

5959
@staticmethod
60-
def print_error(text: str) -> NoReturn:
60+
def print_error(text: str) -> None:
6161
print(f"\033[38;5;9m{text}\033[0m")
6262

6363
@staticmethod
64-
def print_success(text: str) -> NoReturn:
64+
def print_success(text: str) -> None:
6565
print(f"\033[38;5;40m{text}\033[0m")
6666

6767
@staticmethod
68-
def print_warning(text: str) -> NoReturn:
68+
def print_warning(text: str) -> None:
6969
print(f"\033[38;5;11m{text}\033[0m")
7070

7171

pephubclient/models.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import datetime
22
from typing import Optional, List
33

4-
import pydantic
5-
from pydantic import BaseModel, Extra, Field
4+
from pydantic import BaseModel, Field, field_validator, ConfigDict
65
from peppy.const import CONFIG_KEY, SUBSAMPLE_RAW_LIST_KEY, SAMPLE_RAW_DICT_KEY
76

87

@@ -15,9 +14,7 @@ class ProjectDict(BaseModel):
1514
subsample_list: Optional[list] = Field(alias=SUBSAMPLE_RAW_LIST_KEY)
1615
sample_list: list = Field(alias=SAMPLE_RAW_DICT_KEY)
1716

18-
class Config:
19-
allow_population_by_field_name = True
20-
extra = Extra.allow
17+
model_config = ConfigDict(populate_by_name=True, extra="allow")
2118

2219

2320
class ProjectUploadData(BaseModel):
@@ -30,7 +27,7 @@ class ProjectUploadData(BaseModel):
3027
is_private: Optional[bool] = False
3128
overwrite: Optional[bool] = False
3229

33-
@pydantic.validator("tag")
30+
@field_validator("tag")
3431
def tag_should_not_be_none(cls, v):
3532
return v or "default"
3633

pephubclient/pephubclient.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414
import requests
1515
import urllib3
16-
from pydantic.error_wrappers import ValidationError
16+
from pydantic import ValidationError
1717
from ubiquerg import parse_registry_path
1818

1919
from pephubclient.constants import (
@@ -170,7 +170,7 @@ def upload(
170170
method="POST",
171171
url=self._build_push_request_url(namespace=namespace),
172172
headers=self._get_header(jwt_data),
173-
json=upload_data.dict(),
173+
json=upload_data.model_dump(),
174174
cookies=None,
175175
)
176176
if pephub_response.status_code == ResponseStatusCodes.ACCEPTED:
@@ -345,7 +345,7 @@ def _load_raw_pep(
345345
correct_proj_dict = ProjectDict(**json.loads(decoded_response))
346346

347347
# This step is necessary because of this issue: https://github.com/pepkit/pephub/issues/124
348-
return correct_proj_dict.dict(by_alias=True)
348+
return correct_proj_dict.model_dump(by_alias=True)
349349

350350
if pephub_response.status_code == ResponseStatusCodes.NOT_EXIST:
351351
raise ResponseError("File does not exist, or you are unauthorized.")

requirements/requirements-all.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
typer>=0.7.0
2-
peppy>=0.35.7
2+
peppy>=0.40.0
33
requests>=2.28.2
4-
pydantic<2.0
4+
pydantic>2.5.0
55
pandas>=2.0.0
66
ubiquerg>=0.6.3

0 commit comments

Comments
 (0)