Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add globals kwarg to app and adjust ideconfig behavior #1017

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

klmcadams
Copy link
Collaborator

  • Add globals kwarg to App class
  • Import globals if the app is initialized

ideconfig

  • Raise an exception if the revision number is less than the minimum version in ansys-mechanical-stubs
  • Raise a warning if the revision number is greater than the maximum version in ansys-mechanical-stubs. Use the max version to print the autocomplete settings

@klmcadams klmcadams requested a review from a team as a code owner January 3, 2025 18:45
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 3, 2025
@@ -186,13 +196,19 @@ def __init__(self, db_file=None, private_appdata=False, **kwargs):
runtime.initialize(self._version)
connect_warnings(self)
self._poster = None
# Set the initialized flag to True
self._app._initialized = True

self._disposed = False
atexit.register(_dispose_embedded_app, INSTANCES)
INSTANCES.append(self)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@klmcadams No need to add a flag. You can check len(INSTANCES)

@@ -218,6 +234,10 @@ def _dispose(self):
self._app.Dispose()
self._disposed = True

def is_initialized(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a free function. otherwise you need an instance of the app to check if the app is initialized

# SOFTWARE.
"""Import Mechanical globals."""

import clr
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the exception here if the app hasn't been initialized yet

@koubaa
Copy link
Collaborator

koubaa commented Jan 3, 2025

Need to update examples. one should use the new globals() argument. Another should avoid globals entirely and import the types manually after constructing the app instance

@klmcadams klmcadams marked this pull request as draft January 3, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants