Skip to content
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
18 changes: 9 additions & 9 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ on:
jobs:
test:
name: Install, lint and test
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true

Expand All @@ -53,7 +53,7 @@ jobs:
needs: [ test ]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: '0'

Expand All @@ -72,14 +72,14 @@ jobs:
DRY_RUN: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Python sdk to create custom code interacting with Atmosphere.
Please look at each individual sub folder to find more information about
the libraries you need.

# Requirements
- Python 3.10.x or later.
- Pydantic 2.0

### Sub Packages
- [To get started with activities](/atmosphere/custom_activity)
- [To create a new method](/atmosphere/method)
Expand Down
3 changes: 1 addition & 2 deletions atmosphere/custom_activity/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@


class BaseModelForbiddingExtraFields(BaseModel):
class Config:
extra = "forbid"
model_config = {"extra": "forbid"}


class ComputeRewardResponse(BaseModelForbiddingExtraFields):
Expand Down
3 changes: 1 addition & 2 deletions atmosphere/method/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class PredictionRequest(BaseModel):


class PredictionResponse(BaseModel):
class Config:
ignore_extra = False
model_config = {"ignore_extra": False}

action_name: str = Field(
..., title="Action name", description="Prediction action name"
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v6.0.2
* Dropped support for Python 3.9.x
* Included support for Python 3.13.x

## v6.0.0

* Dropped support for Python 3.8.x
Expand Down
1,031 changes: 523 additions & 508 deletions poetry.lock

Large diffs are not rendered by default.

37 changes: 19 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,30 @@ readme = "README.md"


[tool.poetry.dependencies]
python = ">=3.9,<3.13"
python = ">=3.10,<3.14"
pydantic = ">=2.0,<3.0"
apscheduler = ">=3.10.1,<4.0.0"
fastapi = ">=0.115.2,<1.0.0"
httpx = ">=0.27.2,<1.0.0"
pyjwt = ">=2.9.0,<3.0.0"
fastapi = ">=0.115.8,<1.0.0"
httpx = ">=0.28.1,<1.0.0"
pyjwt = ">=2.10.1,<3.0.0"
pyyaml = ">=6.0.2,<7.0"
simplejson = ">=3.19.3,<4.0.0"
uvicorn = ">=0.32.0,<1.0.0"
pytz = ">=2025.1"
simplejson = ">=3.20.1,<4.0.0"
uvicorn = ">=0.34.0,<1.0.0"

[tool.poetry.group.dev.dependencies]
autoflake = "2.3.1"
autopep8 = "2.3.1"
black = "24.10.0"
coverage = "7.6.4"
httpretty = "1.1.4"
isort = "5.13.2"
mypy-extensions = "1.0.0"
pylint = "3.3.1"
pytest = "8.3.3"
pytest-cov = "5.0.0"
pytest-env = "1.1.5"
requests-mock = "1.12.1"
autoflake = ">=2.3.1,<3.0"
autopep8 = ">=2.3.2,<3.0"
black = ">=25.1.0,<26.0"
coverage = ">=7.6.12,<8.0"
httpretty = ">=1.1.4,<2.0"
isort = ">=6.0.0,<7.0"
mypy-extensions = ">=1.0.0,<2.0"
pylint = ">=3.3.4,<4.0"
pytest = ">=8.3.4,<9.0"
pytest-cov = ">=6.0.0,<7.0"
pytest-env = ">=1.1.5,<2.0"
requests-mock = ">=1.12.1,<2.0"

[build-system]
requires = ["poetry-core"]
Expand Down
12 changes: 6 additions & 6 deletions tests/custom_activity/activity_for_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@


class ExpectedModel(BaseModel):
class Config:
extra = "forbid"

model_config = {
"extra": "forbid"
}
a: str
b: int

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

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

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

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

def get_module_version(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions tests/custom_activity/api/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def test_compute_rewards(client: TestClient, example) -> None:
response = client.post("/compute-reward", json=example.good_prediction.model_dump())
assert response.status_code == 200
# Raise an exception if not if the model does not validate the payload
compute_reward_response = ComputeRewardResponse.parse_obj(response.json())
compute_reward_response = ComputeRewardResponse.model_validate(response.json())
assert compute_reward_response.reward == example.b


def test_versions(client: TestClient) -> None:
response = client.get("/versions")
assert response.status_code == 200
# Raise an exception if not if the model does not validate the payload
compute_reward_response = Versions.parse_obj(response.json())
compute_reward_response = Versions.model_validate(response.json())
assert len(compute_reward_response.base_version) > 0
assert (
compute_reward_response.module_version
Expand Down