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
2 changes: 1 addition & 1 deletion .github/workflows/schema-compatibility-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

- uses: actions/setup-python@v6
with:
python-version: "3.14"
python-version: "3.13"

- run: pip install --upgrade openhexa.sdk

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.19.3"
".": "2.19.4"
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [2.19.4](https://github.com/BLSQ/openhexa-sdk-python/compare/v2.19.3...v2.19.4) (2026-04-01)


### Bug Fixes

* parameter typing for File ([#371](https://github.com/BLSQ/openhexa-sdk-python/issues/371)) ([c19a404](https://github.com/BLSQ/openhexa-sdk-python/commit/c19a4048d840a849e7df0669ea100417521417e1))


### Miscellaneous

* **deps:** update dependency python to 3.14 ([#363](https://github.com/BLSQ/openhexa-sdk-python/issues/363)) ([178b0a7](https://github.com/BLSQ/openhexa-sdk-python/commit/178b0a763455393be282ca9602db25f6182b6471))

## [2.19.3](https://github.com/BLSQ/openhexa-sdk-python/compare/v2.19.2...v2.19.3) (2026-03-16)


Expand Down
22 changes: 12 additions & 10 deletions openhexa/sdk/pipelines/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def validate(self, value: typing.Any | None) -> File:
raise ParameterValueError(str(e))


class Secret:
class Secret(str):
"""Marker type for secret/password pipeline parameters.

Use as the ``type`` argument of the ``@parameter`` decorator to indicate that the parameter value is sensitive
Expand Down Expand Up @@ -418,7 +418,7 @@ def spec_type(self) -> str:
@property
def expected_type(self) -> type:
"""Returns the python type expected for values."""
return str
return Secret

@property
def accepts_choices(self) -> bool:
Expand All @@ -431,8 +431,8 @@ def accepts_multiple(self) -> bool:
return False

@staticmethod
def normalize(value: typing.Any) -> str | None:
"""Strip whitespace and convert empty strings to None."""
def normalize(value: typing.Any) -> Secret | None:
"""Strip whitespace, convert empty strings to None, and wrap as Secret."""
if isinstance(value, str):
normalized_value = value.strip()
else:
Expand All @@ -441,6 +441,9 @@ def normalize(value: typing.Any) -> str | None:
if normalized_value == "":
return None

if isinstance(normalized_value, str):
return Secret(normalized_value)

return normalized_value

def validate_default(self, value: typing.Any | None):
Expand Down Expand Up @@ -509,6 +512,7 @@ def __init__(
| S3Connection
| CustomConnection
| Dataset
| File
],
name: str | None = None,
choices: typing.Sequence | None = None,
Expand All @@ -524,10 +528,7 @@ def __init__(
self.code = code

try:
if isinstance(type, ParameterType):
self.type = type
else:
self.type = TYPES_BY_PYTHON_TYPE[type.__name__]()
self.type = TYPES_BY_PYTHON_TYPE[type.__name__]()
except (KeyError, AttributeError):
valid_parameter_types = [k for k in TYPES_BY_PYTHON_TYPE.keys()]
raise InvalidParameterError(
Expand Down Expand Up @@ -696,6 +697,7 @@ def parameter(
| S3Connection
| CustomConnection
| Dataset
| File
],
name: str | None = None,
choices: typing.Sequence | None = None,
Expand All @@ -715,7 +717,7 @@ def parameter(
----------
code : str
The parameter identifier (must be unique for a given pipeline)
type : {str, int, bool, float, DHIS2Connection, IASOConnection, PostgreSQLConnection, GCSConnection, S3Connection}
type : {str, int, bool, float, DHIS2Connection, IASOConnection, PostgreSQLConnection, GCSConnection, S3Connection, CustomConnection, Dataset, File}
The parameter Python type
name : str, optional
A name for the parameter (will be used instead of the code in the web interface)
Expand All @@ -736,7 +738,7 @@ def parameter(
Whether this parameter should be provided multiple values (if True, the value must be provided as a list of
values of the chosen type)
directory : str, optional
An optional parameter to force file selection to specific directory (only used for parater type File). If the directory does not exist, it will be ignored.
An optional parameter to force file selection to specific directory (only used for parameter type File). If the directory does not exist, it will be ignored.

Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion openhexa/sdk/pipelines/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def get_pipeline(pipeline_path: Path) -> Pipeline:
# Convert args spec to parameter kwargs
param_kwargs = {k: v["value"] for k, v in parameter_args.items()}

parameter = Parameter(type=type_class, **param_kwargs)
parameter = Parameter(type=type_class.expected_type, **param_kwargs)
pipeline_parameters.append(parameter)

except KeyError as e:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "openhexa.sdk"
version = "2.19.3"
version = "2.19.4"
description = "OpenHEXA SDK"

authors = [{ name = "Bluesquare", email = "dev@bluesquarehub.com" }]
Expand All @@ -20,7 +20,7 @@ requires-python = ">=3.11,<3.15" # the main constraint for supported Python vers
dependencies = [
"urllib3<3",
"multiprocess~=0.70.15",
"requests>=2.31,<2.33",
"requests>=2.31,<2.34",
"PyYAML~=6.0",
"click~=8.1.3",
"jinja2>3,<4",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_secret_type_normalize():
def test_secret_type_validate():
"""Check validation for SecretType."""
secret_type = SecretType()
assert secret_type.validate("my-token") == "my-token"
assert secret_type.validate(Secret("my-token")) == "my-token"
with pytest.raises(ParameterValueError):
secret_type.validate(123)

Expand Down
Loading