Skip to main content

MMS-Python-Adapter

This is a collection of "quality of life" improvements for using the Python client for the Model Management System (MMS).

Purpose

The purpose of the MMS-Python adapter is to wrap the complex REST API functions into easy to use Python functions allowing users to interact with a system model in a familiar tool. Access to model elements can allow users to run analyses or even model in Python.

Classes

MMSAdapter(server, project id, ref id)

Initializing a project object allows the user to set the server, reference ID, and project ID then run methods on that project.

login()

This method prompts for the users MMS credentials (username/password) then requests and stores a ticket to allow the user to run operations without having to log in constantly. Note the username and password are destryed once the ticket is retrived.

logout()

This function clears any stored tickets.

check_login()

This function returns True if the user is logged in and False otherwise.

get_element(element id,depth=depth)

Returns an Element() object (defined in the MMS client) with the given ID. This is a dictionary of the attributes of the retrived element and can be used to get the elements name, ID, documentation, etc. The depth parameter is an optional input and its default value is set to '0'. Note: depth= -1 is the same as recurse=true

update_element_documentation(element id, content)

Sets the given elements documentation to content.

update_element_name(element id, name)

Sets the given elements name to name.

publish_table(element id, table)

Posts a table to the given elements documentation. Here, table should be an HTML table.

update_element_value(element id, content)

Sets the given elements default value to content. Note, content must be JSON which contatins all appropriate fields for default value (not just the one to be updated).

Installation Instructions

for pip: pip install mms-python-adapter

Update Conda to Latest Version

Ensure Conda is updated to its latest version on the BASE environment in order to prevent dependency discrepancies. Enter via terminal:

conda update conda -y

Pulling from conda-forge and Installation

The mms-python-adapter conda package will be on conda-forge. In order to pull and install the package onto a desired platform, such as JupyterLabs, first add the channel via Terminal:

conda config --add channels conda-forge

After the channel has been added, install the mms-python-adapter package with:

conda install mms-python-adapter -y

Using MMS-Python-Adapter

Within your python script, import the adapter with:

from mms_python_adapter import MMSAdapter

Note: Although the package is named "mms-python-adapter", the base script is "adapter," and the actual functions are called through the "Adapter" class.

Finally, the Adapter is initialized with:

  1. Server
  2. ProjectID
  3. RefID

adap = MMSAdapter(server, projectID, refID)

The functions are listed above under "Classes."

Release files for mms-python-adapter 1.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mms-python-adapter 1.2.5
File Size Uploaded
mms-python-adapter-1.2.5.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mms-python-adapter 1.2.5
File Interpreter ABI Platform
mms_python_adapter-1.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / mms-python-adapter-1.2.5.tar.gz

Download URL mms-python-adapter-1.2.5.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
dded9d59246be03a8fb1f299b1b70b2dbf85dcea87076316e65d23f7bbc7fa7d
BLAKE2b-256 checksum
How to use checksums
58d1760e8503ab765680dcbe9db955fd4d99a6750047f51ed587076771126bc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / mms_python_adapter-1.2.5-py3-none-any.whl

Download URL mms_python_adapter-1.2.5-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
150b2f17e9e058af4b2e40ae92f2524d1b6a70d26b1a7472c2f9160b02252dce
BLAKE2b-256 checksum
How to use checksums
24482b4120f0a76b1a5c9ef82341abd9cc5567ffb2d45b78b62995f2438acbc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

1.2.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page