Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.4] - 2026-01-14
### Security
- Upgraded internal dependency `urllib3` to version `urllib3 >= 2.6.3, <3.0.0` since `2.5.0` has [these](https://security.snyk.io/package/pip/urllib3/2.5.0) vulnerabilities
### Fixed
- Fixed issue with `MAX_RETRY_COUNT`


## [2.0.3] - 2025-12-08
### Fixed
- Fix some deprecation warnings raised by Pydantic V2
Expand Down
2 changes: 1 addition & 1 deletion docs/antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ content:
start_path: docs
branches: []
# branches: HEAD # Use this for local development
tags: [v2.0.3]
tags: [v2.0.4]
asciidoc:
attributes:
page-toclevels: 5
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: corva-sdk
version: ~
version: 2.0.4
nav: [modules/ROOT/nav.adoc]
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "corva-sdk"
description = "SDK for building Corva DevCenter Python apps."
readme = "README.md"
version = "2.0.3"
version = "2.0.4"
license = { text = "The Unlicense" }
authors = [
{ name = "Jordan Ambra", email = "jordan.ambra@corva.ai" }
Expand All @@ -19,7 +19,7 @@ dependencies = [
"pydantic-settings >= 2.0, <3.0",
"redis == 6.4.0",
"requests >= 2.32.3, <3.0.0",
"urllib3 == 2.5.0",
"urllib3 >= 2.6.3, <3.0.0",
"semver == 3.0.4"
]
classifiers = [
Expand Down
32 changes: 30 additions & 2 deletions src/corva/configuration.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
import datetime
import logging

import pydantic_settings
from pydantic import AnyHttpUrl, BeforeValidator, TypeAdapter
from typing_extensions import Annotated

logger = logging.getLogger("corva")


def validate_http_url_to_str(v: str) -> str:
TypeAdapter(AnyHttpUrl).validate_python(v)
return v


def _parse_max_retry_count(value) -> int:

if value is None or value == "":
return DEFAULT_MAX_RETRY_COUNT
try:
if isinstance(value, bool):
raise TypeError
if isinstance(value, int):
return value
if isinstance(value, str):
return int(value.strip())
except (TypeError, ValueError):
pass

logger.warning(
"Invalid MAX_RETRY_COUNT value %r; using default %d.",
value,
DEFAULT_MAX_RETRY_COUNT,
)
return DEFAULT_MAX_RETRY_COUNT


HttpUrlStr = Annotated[str, BeforeValidator(validate_http_url_to_str)]
MaxRetryValidator = Annotated[int, BeforeValidator(lambda v: _parse_max_retry_count(v))]

DEFAULT_MAX_RETRY_COUNT = 3


class Settings(pydantic_settings.BaseSettings):
Expand Down Expand Up @@ -39,8 +67,8 @@ class Settings(pydantic_settings.BaseSettings):
POOL_MAX_SIZE: int = 20 # Max connections count per pool/host
POOL_BLOCK: bool = True # Wait until connection released

# retry
MAX_RETRY_COUNT: int = 3 # If `0` then retries will be disabled
# retry. If `0` then retries will be disabled
MAX_RETRY_COUNT: MaxRetryValidator = DEFAULT_MAX_RETRY_COUNT
BACKOFF_FACTOR: float = 1.0

# OTEL
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.0.3"
VERSION = "2.0.4"