Skip to content

Commit a466390

Browse files
committed
Add mypy configuration and export types
ASIM-5899
1 parent 8e207bc commit a466390

File tree

59 files changed

+1605
-1151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1605
-1151
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
run: |
3636
python -m pip install --upgrade pip
3737
pip install tox codecov
38+
- name: Type-check
39+
run: tox -e type-check
3840
- name: Run tests
3941
run: tox -e py
4042
- name: Upload codecov

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,4 @@ docs/alfasim_sdk_api/
114114

115115
# PyCharm
116116
.idea/
117+
/.dmypy.json

.pre-commit-config.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
# Ruff version.
1515
rev: v0.14.0
1616
hooks:
17-
- id: ruff
17+
- id: ruff-check
1818
args: [--fix]
1919
- id: ruff-format
2020
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -23,14 +23,3 @@ repos:
2323
- id: trailing-whitespace
2424
- id: end-of-file-fixer
2525
- id: debug-statements
26-
- repo: https://github.com/PyCQA/flake8
27-
rev: 7.3.0
28-
hooks:
29-
- id: flake8
30-
additional_dependencies:
31-
- pep8-naming
32-
- flake8-typing-imports==1.14.0
33-
language_version: python3
34-
args:
35-
- --ignore=E,W,N803
36-
- --per-file-ignores=src/alfasim_sdk/_internal/hook_specs.py:F722,F821

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ CHANGELOG
66
1.4.0 (UNRELEASED)
77
==================
88

9+
* Types are now exported and can be verified by type-checkers such as ``mypy``.
10+
911

1012
1.3.0 (2025-10-07)
1113
==================

docs/source/alfacase_definitions/LengthAndElevationDescription.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
.. parsed-literal::
66

77
class LengthAndElevationDescription
8-
length: \ :class:`Optional <typing.Optional>`\[\ :class:`Array <barril.units.Array>`\] = None
9-
elevation: \ :class:`Optional <typing.Optional>`\[\ :class:`Array <barril.units.Array>`\] = None
8+
length: \ :class:`Array <barril.units.Array>`
9+
elevation: \ :class:`Array <barril.units.Array>`
1010

1111
.. tab:: Schema
1212

1313
.. parsed-literal::
1414

15-
length: # optional
15+
length:
1616
values: [number]
1717
unit: string
18-
elevation: # optional
18+
elevation:
1919
values: [number]
2020
unit: string

docs/source/alfacase_definitions/PipeSegmentsDescription.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
start_positions: \ :class:`Array <barril.units.Array>`
99
diameters: \ :class:`Array <barril.units.Array>`
1010
roughnesses: \ :class:`Array <barril.units.Array>`
11-
wall_names: \ :class:`Optional <typing.Optional>`\[\ :class:`List <typing.List>`\[str]] = None
11+
wall_names: \ :class:`Optional <typing.Optional>`\[\ :class:`List <typing.List>`\[\ :class:`Optional <typing.Optional>`\[str]]] = None
1212

1313
.. tab:: Schema
1414

@@ -24,4 +24,4 @@
2424
values: [number]
2525
unit: string
2626
wall_names: # optional
27-
- str
27+
- string

docs/source/alfacase_definitions/PluginDescription.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.. parsed-literal::
66

77
class PluginDescription
8-
name: \ :class:`Optional <typing.Optional>`\[str] = None
8+
name: str
99
version: \ :class:`Optional <typing.Optional>`\[str] = None
1010
gui_models: \ :class:`Dict <typing.Dict>`\[str, Any] = {}
1111
is_enabled: bool = True
@@ -14,7 +14,7 @@
1414

1515
.. parsed-literal::
1616

17-
name: string # optional
17+
name: string
1818
version: string # optional
1919
gui_models: # optional
2020
string: Any

docs/source/alfacase_definitions/ProfileOutputDescription.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class ProfileOutputDescription
88
curve_names: \ :class:`List <typing.List>`\[str]
99
location: \ :class:`OutputAttachmentLocation <alfasim_sdk._internal.constants.OutputAttachmentLocation>`
10-
element_name: str
10+
element_name: \ :class:`Optional <typing.Optional>`\[str] = None
1111

1212
.. tab:: Schema
1313

@@ -16,4 +16,4 @@
1616
curve_names:
1717
- str
1818
location: \ :class:`OutputAttachmentLocation <alfasim_sdk._internal.constants.OutputAttachmentLocation>`
19-
element_name: string
19+
element_name: string # optional

docs/source/alfacase_definitions/PumpEquipmentDescription.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
esp_speed_curve: \ :class:`Curve <barril.curve.curve.Curve>`\ = Curve(Hz, s)[]
2323
esp_number_of_stages: int = 1
2424
esp_reference_density: \ :class:`Scalar <barril.units.Scalar>`\ = Scalar(0.0, 'kg/m3', 'density')
25-
esp_manufacturer: str = ''
25+
esp_manufacturer: \ :class:`Optional <typing.Optional>`\[str] = ''
2626
esp_model: str = ''
2727
esp_viscosity_model: \ :class:`PumpViscosityModel <alfasim_sdk._internal.constants.PumpViscosityModel>`\ = PumpViscosityModel.NoModel
2828
density_correction_enabled: bool = False

docs/source/alfacase_definitions/WallLayerDescription.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class WallLayerDescription
88
thickness: \ :class:`Scalar <barril.units.Scalar>`
9-
material_name: str
9+
material_name: \ :class:`Optional <typing.Optional>`\[str] = None
1010
has_annulus_flow: bool = False
1111

1212
.. tab:: Schema
@@ -16,5 +16,5 @@
1616
thickness:
1717
value: number
1818
unit: string
19-
material_name: string
19+
material_name: string # optional
2020
has_annulus_flow: boolean # optional

0 commit comments

Comments
 (0)