Skip to content

Commit d57b644

Browse files
authored
Merge pull request #48 from ambiata/update/python313-upgrade
[#patch] Dependencies Upgrade, Add Python 3.13
2 parents 87b0fcf + cb2b0b2 commit d57b644

File tree

9 files changed

+569
-547
lines changed

9 files changed

+569
-547
lines changed

.github/workflows/cicd.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ on:
1111
jobs:
1212
test:
1313
name: Install, lint and test
14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-24.04
1515
strategy:
1616
matrix:
17-
python-version: ["3.9", "3.10", "3.11", "3.12"]
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1818

1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2222

2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v5
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

2828
- name: Install Poetry
2929
uses: snok/install-poetry@v1
3030
with:
31-
version: 1.8.4
31+
version: 1.8.5
3232
virtualenvs-create: true
3333
virtualenvs-in-project: true
3434

@@ -53,7 +53,7 @@ jobs:
5353
needs: [ test ]
5454
steps:
5555
- name: Checkout
56-
uses: actions/checkout@v2
56+
uses: actions/checkout@v4
5757
with:
5858
fetch-depth: '0'
5959

@@ -72,14 +72,14 @@ jobs:
7272
DRY_RUN: true
7373

7474
- name: Set up Python ${{ matrix.python-version }}
75-
uses: actions/setup-python@v4
75+
uses: actions/setup-python@v5
7676
with:
77-
python-version: 3.12
77+
python-version: 3.13
7878

7979
- name: Install Poetry
8080
uses: snok/install-poetry@v1
8181
with:
82-
version: 1.8.4
82+
version: 1.8.5
8383
virtualenvs-create: true
8484
virtualenvs-in-project: true
8585

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Python sdk to create custom code interacting with Atmosphere.
44
Please look at each individual sub folder to find more information about
55
the libraries you need.
66

7+
# Requirements
8+
- Python 3.10.x or later.
9+
- Pydantic 2.0
10+
711
### Sub Packages
812
- [To get started with activities](/atmosphere/custom_activity)
913
- [To create a new method](/atmosphere/method)

atmosphere/custom_activity/pydantic_models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88

99
class BaseModelForbiddingExtraFields(BaseModel):
10-
class Config:
11-
extra = "forbid"
10+
model_config = {"extra": "forbid"}
1211

1312

1413
class ComputeRewardResponse(BaseModelForbiddingExtraFields):

atmosphere/method/pydantic_models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class PredictionRequest(BaseModel):
2626

2727

2828
class PredictionResponse(BaseModel):
29-
class Config:
30-
ignore_extra = False
29+
model_config = {"ignore_extra": False}
3130

3231
action_name: str = Field(
3332
..., title="Action name", description="Prediction action name"

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v6.0.2
4+
* Dropped support for Python 3.9.x
5+
* Included support for Python 3.13.x
6+
37
## v6.0.0
48

59
* Dropped support for Python 3.8.x

poetry.lock

Lines changed: 523 additions & 508 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,30 @@ readme = "README.md"
88

99

1010
[tool.poetry.dependencies]
11-
python = ">=3.9,<3.13"
11+
python = ">=3.10,<3.14"
1212
pydantic = ">=2.0,<3.0"
1313
apscheduler = ">=3.10.1,<4.0.0"
14-
fastapi = ">=0.115.2,<1.0.0"
15-
httpx = ">=0.27.2,<1.0.0"
16-
pyjwt = ">=2.9.0,<3.0.0"
14+
fastapi = ">=0.115.8,<1.0.0"
15+
httpx = ">=0.28.1,<1.0.0"
16+
pyjwt = ">=2.10.1,<3.0.0"
1717
pyyaml = ">=6.0.2,<7.0"
18-
simplejson = ">=3.19.3,<4.0.0"
19-
uvicorn = ">=0.32.0,<1.0.0"
18+
pytz = ">=2025.1"
19+
simplejson = ">=3.20.1,<4.0.0"
20+
uvicorn = ">=0.34.0,<1.0.0"
2021

2122
[tool.poetry.group.dev.dependencies]
22-
autoflake = "2.3.1"
23-
autopep8 = "2.3.1"
24-
black = "24.10.0"
25-
coverage = "7.6.4"
26-
httpretty = "1.1.4"
27-
isort = "5.13.2"
28-
mypy-extensions = "1.0.0"
29-
pylint = "3.3.1"
30-
pytest = "8.3.3"
31-
pytest-cov = "5.0.0"
32-
pytest-env = "1.1.5"
33-
requests-mock = "1.12.1"
23+
autoflake = ">=2.3.1,<3.0"
24+
autopep8 = ">=2.3.2,<3.0"
25+
black = ">=25.1.0,<26.0"
26+
coverage = ">=7.6.12,<8.0"
27+
httpretty = ">=1.1.4,<2.0"
28+
isort = ">=6.0.0,<7.0"
29+
mypy-extensions = ">=1.0.0,<2.0"
30+
pylint = ">=3.3.4,<4.0"
31+
pytest = ">=8.3.4,<9.0"
32+
pytest-cov = ">=6.0.0,<7.0"
33+
pytest-env = ">=1.1.5,<2.0"
34+
requests-mock = ">=1.12.1,<2.0"
3435

3536
[build-system]
3637
requires = ["poetry-core"]

tests/custom_activity/activity_for_tests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212

1313
class ExpectedModel(BaseModel):
14-
class Config:
15-
extra = "forbid"
16-
14+
model_config = {
15+
"extra": "forbid"
16+
}
1717
a: str
1818
b: int
1919

@@ -23,13 +23,13 @@ class ActivityCustomCodeForTest(BaseActivityCustomCode):
2323
expected_module_version = "0.4.2"
2424

2525
def validate_prediction_request(self, prediction_request: dict) -> None:
26-
ExpectedModel.validate(prediction_request)
26+
ExpectedModel.model_validate(prediction_request)
2727

2828
def validate_outcome_request(self, outcome_request: dict) -> None:
29-
ExpectedModel.validate(outcome_request)
29+
ExpectedModel.model_validate(outcome_request)
3030

3131
def compute_reward(self, outcome_request: dict) -> ComputeRewardResponse:
32-
outcome = ExpectedModel.parse_obj(outcome_request)
32+
outcome = ExpectedModel.model_validate(outcome_request)
3333
return ComputeRewardResponse(reward=outcome.b)
3434

3535
def get_module_version(self) -> str:

tests/custom_activity/api/test_endpoints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ def test_compute_rewards(client: TestClient, example) -> None:
4040
response = client.post("/compute-reward", json=example.good_prediction.model_dump())
4141
assert response.status_code == 200
4242
# Raise an exception if not if the model does not validate the payload
43-
compute_reward_response = ComputeRewardResponse.parse_obj(response.json())
43+
compute_reward_response = ComputeRewardResponse.model_validate(response.json())
4444
assert compute_reward_response.reward == example.b
4545

4646

4747
def test_versions(client: TestClient) -> None:
4848
response = client.get("/versions")
4949
assert response.status_code == 200
5050
# Raise an exception if not if the model does not validate the payload
51-
compute_reward_response = Versions.parse_obj(response.json())
51+
compute_reward_response = Versions.model_validate(response.json())
5252
assert len(compute_reward_response.base_version) > 0
5353
assert (
5454
compute_reward_response.module_version

0 commit comments

Comments
 (0)