Skip to content

Commit c15df8f

Browse files
authored
Bring back v26 changes to main (#18)
* Fix return types and color band range (#5) * fix types and remove non-existing function * fix tests * fix color band range * increment patch number * fix range and tests * changelog * bring back function * more tests * missing include * typo * better docstrings * correctness * ws * point to pypi (#3)
1 parent 3574fc0 commit c15df8f

12 files changed

Lines changed: 66 additions & 35 deletions

File tree

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
$packageName = 'moldflow'
8585
8686
try {
87-
$resp = Invoke-WebRequest -Uri "https://test.pypi.org/pypi/$packageName/json" -UseBasicParsing -ErrorAction Stop
87+
$resp = Invoke-WebRequest -Uri "https://pypi.org/pypi/$packageName/json" -UseBasicParsing -ErrorAction Stop
8888
$data = $resp.Content | ConvertFrom-Json
8989
$versions = @($data.releases.PSObject.Properties.Name)
9090
} catch {
@@ -118,9 +118,9 @@ jobs:
118118
if: steps.pypi_check.outputs.exists == 'false'
119119
env:
120120
TWINE_USERNAME: __token__
121-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
121+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
122122
run: |
123-
python run.py publish --skip-build --testpypi
123+
python run.py publish --skip-build
124124
125125
- name: Create GitHub Release
126126
if: steps.pypi_check.outputs.exists == 'false'

CHANGELOG.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
- Initial public release
12-
- Python API wrapper for Moldflow Synergy
13-
- Comprehensive test suite
14-
- Documentation with examples
15-
- CI/CD pipeline for automated testing and publishing
11+
- N/A
1612

1713
### Changed
1814
- N/A
@@ -29,13 +25,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2925
### Security
3026
- N/A
3127

32-
## [26.0.0] - 2025-XX-XX
28+
## [26.0.1] - 2025-09-12
29+
30+
### Added
31+
- N/A
32+
33+
### Changed
34+
- N/A
35+
36+
### Deprecated
37+
- N/A
38+
39+
### Removed
40+
- N/A
41+
42+
### Fixed
43+
- Fix return types for `from_list` functions in data classes
44+
- Fix color band range options to 1 to 256
45+
46+
### Security
47+
- N/A
48+
49+
## [26.0.0] - 2025-09-01
3350

3451
### Added
35-
- Initial version aligned with Moldflow Synergy 2026
36-
- Basic API functionality
37-
- Windows support
52+
- Initial version aligned with Moldflow Synergy 2026.0.1
3853
- Python 3.10-3.13 compatibility
3954

40-
[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.0...HEAD
55+
[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.1...HEAD
56+
[26.0.1]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.1
4157
[26.0.0]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.0

src/moldflow/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88

99
# Constants for color bands
10-
COLOR_BAND_RANGE = tuple(list(range(2, 65)) + [256])
10+
COLOR_BAND_RANGE = tuple(range(1, 257))
1111

1212
# Localization constants
1313
DEFAULT_THREE_LETTER_CODE = "enu"

src/moldflow/double_array.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,23 @@ def to_list(self) -> list[float]:
6767
vb_array = self.double_array.ToVBSArray()
6868
return list(vb_array)
6969

70-
def from_list(self, values: list[float]) -> None:
70+
def from_list(self, values: list[float]) -> int:
7171
"""
7272
Convert a list of floats to a double array.
7373
7474
Args:
7575
values (list[float]): The list of floats to convert.
76+
77+
Returns:
78+
int: The number of elements added to the array.
7679
"""
7780
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="from_list")
7881

7982
check_type(values, (list, tuple))
8083
for value in values:
8184
check_type(value, (int, float))
8285

83-
self.double_array.FromVBSArray(list(values))
86+
return self.double_array.FromVBSArray(list(values))
8487

8588
@property
8689
def size(self) -> int:

src/moldflow/integer_array.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,23 @@ def to_list(self) -> list[int]:
6767
vb_array = self.integer_array.ToVBSArray()
6868
return list(vb_array)
6969

70-
def from_list(self, values: list[int]) -> None:
70+
def from_list(self, values: list[int]) -> int:
7171
"""
7272
Convert a list of integers to an integer array.
7373
7474
Args:
7575
values (list[int]): The list of integers to convert.
76+
77+
Returns:
78+
int: The number of elements added to the array.
7679
"""
7780
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="from_list")
7881

7982
check_type(values, (list, tuple))
8083
for value in values:
8184
check_type(value, int)
8285

83-
self.integer_array.FromVBSArray(list(values))
86+
return self.integer_array.FromVBSArray(list(values))
8487

8588
@property
8689
def size(self) -> int:

src/moldflow/plot.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,11 @@ def extended_color(self, value: bool) -> None:
456456
@property
457457
def color_bands(self) -> int:
458458
"""
459-
The number of color bands or smooth coloring.
460-
- values between 2 through 64: banded coloring with this number of colors
461-
- 256: smooth coloring
459+
The number of color bands.
460+
- values between 1 through 256: banded coloring with this number of colors
462461
463-
464-
:getter: Get the number of color bands or smooth coloring.
465-
:setter: Set the number of color bands or smooth coloring.
462+
:getter: Get the number of color bands.
463+
:setter: Set the number of color bands.
466464
:type: int
467465
"""
468466
process_log(__name__, LogMessage.PROPERTY_GET, locals(), name="color_bands")
@@ -471,9 +469,8 @@ def color_bands(self) -> int:
471469
@color_bands.setter
472470
def color_bands(self, value: int) -> None:
473471
"""
474-
The number of color bands or smooth coloring.
475-
- values between 2 through 64: banded coloring with this number of colors
476-
- 256: smooth coloring
472+
The number of color bands.
473+
- values between 1 through 256: banded coloring with this number of colors
477474
478475
Args:
479476
value (int): number of color bands or smooth coloring to set.

src/moldflow/string_array.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,29 @@ def add_string(self, value: str) -> None:
5757
def to_list(self) -> list[str]:
5858
"""
5959
Convert the string array to a list of strings.
60-
6160
Returns:
6261
list[str]: The list of strings.
6362
"""
6463
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="to_list")
6564
return _mf_array_to_list(self)
6665

67-
def from_list(self, values: list[str]) -> None:
66+
def from_list(self, values: list[str]) -> int:
6867
"""
6968
Convert a list of strings to a string array.
7069
7170
Args:
7271
values (list[str]): The list of strings to convert.
72+
73+
Returns:
74+
int: The number of elements added to the array.
7375
"""
7476
process_log(__name__, LogMessage.FUNCTION_CALL, locals(), name="from_list")
7577
check_type(values, (list, tuple))
7678

7779
for value in values:
7880
check_type(value, str)
7981

80-
self.string_array.FromVBSArray(list(values))
82+
return self.string_array.FromVBSArray(list(values))
8183

8284
@property
8385
def size(self) -> int:

tests/api/unit_tests/test_unit_double_array.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ def test_to_list(self, mock_double_array, mock_object, values):
7272
# pylint: disable=R0801
7373
def test_from_list(self, mock_double_array, mock_object, values):
7474
"""Test the from_list method of the DoubleArray class."""
75-
mock_double_array.from_list(values)
75+
mock_object.FromVBSArray.return_value = len(values)
76+
result = mock_double_array.from_list(values)
77+
78+
assert isinstance(result, int)
79+
assert result == len(values)
7680
mock_object.FromVBSArray.assert_called_once_with(list(values))
7781

7882
@pytest.mark.parametrize("invalid_values", INVALID_MOCK_WITH_NONE)

tests/api/unit_tests/test_unit_integer_array.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ def test_to_list(self, mock_integer_array, mock_object, values):
6565
# pylint: disable=R0801
6666
def test_from_list(self, mock_integer_array, mock_object, values):
6767
"""Test the from_list method of the IntegerArray class."""
68-
mock_integer_array.from_list(values)
68+
mock_object.FromVBSArray.return_value = len(values)
69+
result = mock_integer_array.from_list(values)
6970

71+
assert isinstance(result, int)
72+
assert result == len(values)
7073
mock_object.FromVBSArray.assert_called_once_with(list(values))
7174

7275
@pytest.mark.parametrize("invalid_values", INVALID_MOCK_WITH_NONE)

tests/api/unit_tests/test_unit_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def test_invalid_properties(
441441
@pytest.mark.parametrize(
442442
"pascal_name, property_name, value",
443443
[("SetMeshFill", "mesh_fill", x) for x in [-1.0, 2.0, 3.0]]
444-
+ [("SetColorBands", "color_bands", x) for x in [1, 65, 128]]
444+
+ [("SetColorBands", "color_bands", x) for x in [-1, 0, 257, 300]]
445445
+ [("SetHistogramNumberOfBars", "histogram_number_of_bars", x) for x in [-1, -2, -3, -4]],
446446
)
447447
# pylint: disable-next=R0913, R0917

0 commit comments

Comments
 (0)