mastapy


Namemastapy JSON
Version 14.1.0 PyPI version JSON
download
home_pageNone
SummaryPython scripting API for MASTA.
upload_time2025-02-19 10:47:55
maintainerNone
docs_urlNone
authorGeorge Baron
requires_python<3.14,>=3.8
licenseMIT
keywords mastapy smt masta
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
<img src="https://documentation.smartmt.com/MastaAPI/14.1/images/smt_logo.png" width="150" alt="SMT"><br>
<img src="https://documentation.smartmt.com/MastaAPI/14.1/images/MASTA_14_logo.png" width="400" alt="Mastapy">
</h1><br>

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Mastapy is the Python scripting API for MASTA.

- **Website**: https://www.smartmt.com/
- **Support**: https://support.smartmt.com/
- **Documentation**: https://documentation.smartmt.com/MastaAPI/14.1/


### Features

- Powerful integration with MASTA with the ability to run Python scripts from the MASTA interface directly.
- Ability to use MASTA functionality external to the MASTA software in an independent script.
- An up-to-date and tight integration with Python. This is not a lightweight wrapper around the C# API. It is specifically designed for Python and works great in tandem with other common scientific Python packages (e.g. SciPy, NumPy, Pandas, Matplotlib, Seaborn, etc.)
- Extensive backwards compatibility support. Scripts written in older versions of mastapy will still work with new versions of MASTA.
- Full support for Linux and .NET 6 versions of the MASTA API.

### Release Information

#### Major Changes

- Added support for Python 3.13.
- Dropped support for Python 3.7.
- Added support for `ListWithSelectedItem` in scripted properties.

#### Minor Changes

- Replaced `ptvsd` with `debugpy` as a dependency for Python 3.13 onwards. MASTA will now choose `debugpy` over `ptvsd` for debugging if it is available.
- Removed the `start_debugging` method and `DebugEnvironment` enum.
- Replaced the `Range` type with `tuple[float, float]`.
- Replaced the `IntegerRange` type with `tuple[int, int]`.
- Various improvements and bug fixes.

#### List With Selected Items

This release includes a new `ListWithSelectedItem` type that can be used to add drop down menus to your custom editors in MASTA. It supports a variety of basic types (`bool`, `float`, `int`, `str` and `complex`) as well as API types (e.g. `Design`.)

The easiest way of creating a list with selected item scripted property is to specify the return type as a `ListWithSelectedItem`.

```python
from mastapy import masta_property, ListWithSelectedItem

@masta_property(...)
def my_property(...) -> ListWithSelectedItem:
    return 5.0
```

If the return type of a scripted property is `ListWithSelectedItem` then the returned value will be automatically promoted to a list with selected item.

To get correct typing information, you can use one of the built-in types. The following example demonstrates this for a `float`:

```python
@my_property.setter
def my_property(..., value: ListWithSelectedItem.Float) -> None:
    ...
```

To populate the drop-down list with values, you will need to instantiate one of the available list with selected item types yourself.

```python
from mastapy import masta_property, ListWithSelectedItem

@masta_property(...)
def my_property(...) -> ListWithSelectedItem.Float:
    return ListWithSelectedItem.Float(5.0, [1.0, 2.0, 3.0, 4.0])
```

You cannot instantiate `ListWithSelectedItem` directly. If your selected value (`5.0` in this example) is not in the list of available values, it will be automatically appended.

To get typing information for a list with selected item API type, you need to create a class stub that subclasses both your API type and `ListWithSelectedItem`. The following example shows how to do this for a `Design` list with selected item:

```python
class ListWithSelectedItemDatum(Design, ListWithSelectedItem):
    pass

@my_property.setter
def my_property(..., value: ListWithSelectedItemDesign) -> None:
    ...
```

You can also instantiate your custom type.

```python
from mastapy import masta_property, ListWithSelectedItem

class ListWithSelectedItemDatum(Design, ListWithSelectedItem):
    pass

@masta_property(...)
def my_property(...) -> ListWithSelectedItemDesign:
    ...
    return ListWithSelectedItemDesign(design0, [design1, design2])
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mastapy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.8",
    "maintainer_email": null,
    "keywords": "mastapy, smt, masta",
    "author": "George Baron",
    "author_email": "george.baron@smartmt.com",
    "download_url": "https://files.pythonhosted.org/packages/6c/89/1851b773779c0a2ecd418680be4301471674af64d04d68fa06c55f592579/mastapy-14.1.0.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n<img src=\"https://documentation.smartmt.com/MastaAPI/14.1/images/smt_logo.png\" width=\"150\" alt=\"SMT\"><br>\n<img src=\"https://documentation.smartmt.com/MastaAPI/14.1/images/MASTA_14_logo.png\" width=\"400\" alt=\"Mastapy\">\n</h1><br>\n\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nMastapy is the Python scripting API for MASTA.\n\n- **Website**: https://www.smartmt.com/\n- **Support**: https://support.smartmt.com/\n- **Documentation**: https://documentation.smartmt.com/MastaAPI/14.1/\n\n\n### Features\n\n- Powerful integration with MASTA with the ability to run Python scripts from the MASTA interface directly.\n- Ability to use MASTA functionality external to the MASTA software in an independent script.\n- An up-to-date and tight integration with Python. This is not a lightweight wrapper around the C# API. It is specifically designed for Python and works great in tandem with other common scientific Python packages (e.g. SciPy, NumPy, Pandas, Matplotlib, Seaborn, etc.)\n- Extensive backwards compatibility support. Scripts written in older versions of mastapy will still work with new versions of MASTA.\n- Full support for Linux and .NET 6 versions of the MASTA API.\n\n### Release Information\n\n#### Major Changes\n\n- Added support for Python 3.13.\n- Dropped support for Python 3.7.\n- Added support for `ListWithSelectedItem` in scripted properties.\n\n#### Minor Changes\n\n- Replaced `ptvsd` with `debugpy` as a dependency for Python 3.13 onwards. MASTA will now choose `debugpy` over `ptvsd` for debugging if it is available.\n- Removed the `start_debugging` method and `DebugEnvironment` enum.\n- Replaced the `Range` type with `tuple[float, float]`.\n- Replaced the `IntegerRange` type with `tuple[int, int]`.\n- Various improvements and bug fixes.\n\n#### List With Selected Items\n\nThis release includes a new `ListWithSelectedItem` type that can be used to add drop down menus to your custom editors in MASTA. It supports a variety of basic types (`bool`, `float`, `int`, `str` and `complex`) as well as API types (e.g. `Design`.)\n\nThe easiest way of creating a list with selected item scripted property is to specify the return type as a `ListWithSelectedItem`.\n\n```python\nfrom mastapy import masta_property, ListWithSelectedItem\n\n@masta_property(...)\ndef my_property(...) -> ListWithSelectedItem:\n    return 5.0\n```\n\nIf the return type of a scripted property is `ListWithSelectedItem` then the returned value will be automatically promoted to a list with selected item.\n\nTo get correct typing information, you can use one of the built-in types. The following example demonstrates this for a `float`:\n\n```python\n@my_property.setter\ndef my_property(..., value: ListWithSelectedItem.Float) -> None:\n    ...\n```\n\nTo populate the drop-down list with values, you will need to instantiate one of the available list with selected item types yourself.\n\n```python\nfrom mastapy import masta_property, ListWithSelectedItem\n\n@masta_property(...)\ndef my_property(...) -> ListWithSelectedItem.Float:\n    return ListWithSelectedItem.Float(5.0, [1.0, 2.0, 3.0, 4.0])\n```\n\nYou cannot instantiate `ListWithSelectedItem` directly. If your selected value (`5.0` in this example) is not in the list of available values, it will be automatically appended.\n\nTo get typing information for a list with selected item API type, you need to create a class stub that subclasses both your API type and `ListWithSelectedItem`. The following example shows how to do this for a `Design` list with selected item:\n\n```python\nclass ListWithSelectedItemDatum(Design, ListWithSelectedItem):\n    pass\n\n@my_property.setter\ndef my_property(..., value: ListWithSelectedItemDesign) -> None:\n    ...\n```\n\nYou can also instantiate your custom type.\n\n```python\nfrom mastapy import masta_property, ListWithSelectedItem\n\nclass ListWithSelectedItemDatum(Design, ListWithSelectedItem):\n    pass\n\n@masta_property(...)\ndef my_property(...) -> ListWithSelectedItemDesign:\n    ...\n    return ListWithSelectedItemDesign(design0, [design1, design2])\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python scripting API for MASTA.",
    "version": "14.1.0",
    "project_urls": {
        "Documentation": "https://documentation.smartmt.com/MastaAPI/14.1/",
        "Homepage": "https://www.smartmt.com/"
    },
    "split_keywords": [
        "mastapy",
        " smt",
        " masta"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c8039c5ade4aa9151dc4b8e2e6317a07cf15c41cf01f76fea7774455cb042ffa",
                "md5": "b336c5745adbfcc41b61ea48e7eff158",
                "sha256": "c65922234d7f0ffc6ff179ef9ea6c552490acdba5def986071d7220e4f5955b8"
            },
            "downloads": -1,
            "filename": "mastapy-14.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b336c5745adbfcc41b61ea48e7eff158",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.8",
            "size": 15585911,
            "upload_time": "2025-02-19T10:47:49",
            "upload_time_iso_8601": "2025-02-19T10:47:49.593759Z",
            "url": "https://files.pythonhosted.org/packages/c8/03/9c5ade4aa9151dc4b8e2e6317a07cf15c41cf01f76fea7774455cb042ffa/mastapy-14.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6c891851b773779c0a2ecd418680be4301471674af64d04d68fa06c55f592579",
                "md5": "78c6dfab9b0fbd9544894f3970fb78ec",
                "sha256": "8822feb380767ce42159d2df47060674417d5a4b76e4af8dcf8dd60b18319748"
            },
            "downloads": -1,
            "filename": "mastapy-14.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "78c6dfab9b0fbd9544894f3970fb78ec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.8",
            "size": 4947342,
            "upload_time": "2025-02-19T10:47:55",
            "upload_time_iso_8601": "2025-02-19T10:47:55.047982Z",
            "url": "https://files.pythonhosted.org/packages/6c/89/1851b773779c0a2ecd418680be4301471674af64d04d68fa06c55f592579/mastapy-14.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-19 10:47:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mastapy"
}
        
Elapsed time: 0.41691s