Skip to content

fix: add workaround for windows store - #1153

Merged
koubaa merged 9 commits into
mainfrom
windows-store
May 1, 2025
Merged

fix: add workaround for windows store#1153
koubaa merged 9 commits into
mainfrom
windows-store

Conversation

@koubaa

@koubaa koubaa commented Apr 30, 2025

Copy link
Copy Markdown
Contributor

The windows store python uses windows secure DLL loading (via the Win32 API SetDefaultDllDirectories), which is not enabled in the python.org distribution. PyMechanical internally changes the process PATH environment variable for DLL loading, which does not work if secure DLL loading is used.

A future version of Mechanical may support secure DLL loading, but for the current releases PyMechanical can work around the issue by calling os.add_dll_directory()

Fixes #1136

@koubaa
koubaa requested a review from a team as a code owner April 30, 2025 15:34
@koubaa
koubaa requested a review from klmcadams April 30, 2025 15:34
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 30, 2025
@codacy-production

codacy-production Bot commented Apr 30, 2025

Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for e82df191 26.67%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e82df19) Report Missing Report Missing Report Missing
Head commit (d51ab98) 2535 2201 86.82%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1153) 15 4 26.67%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@codecov

codecov Bot commented Apr 30, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 25.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 86.79%. Comparing base (45a53f6) to head (b4a07d1).
Report is 2 commits behind head on main.

❌ Your patch status has failed because the patch coverage (25.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1153      +/-   ##
==========================================
- Coverage   87.08%   86.79%   -0.30%     
==========================================
  Files          39       39              
  Lines        2517     2536      +19     
==========================================
+ Hits         2192     2201       +9     
- Misses        325      335      +10     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@koubaa

koubaa commented Apr 30, 2025

Copy link
Copy Markdown
Contributor Author

@klmcadams Are you familiar with this quarto error in the doc build?

2025-04-30T15:47:17.1149867Z       File "/env/lib/python3.11/site-packages/sphinx/events.py", line 415, in emit
2025-04-30T15:47:17.1150252Z         raise ExtensionError(
2025-04-30T15:47:17.1151324Z     sphinx.errors.ExtensionError: Handler <function build_quarto_cheatsheet at 0x7fab935c4360> for event 'builder-inited' threw an exception (exception: Failed to run the command: Command '['quarto', 'remove', 'ansys/pyansys-quarto-cheatsheet', '--no-prompt']' returned non-zero exit status 1.)****

@klmcadams

Copy link
Copy Markdown
Contributor

@koubaa Is it possible to add tests for this or would we have to download Python from the Windows store?

@koubaa

koubaa commented May 1, 2025

Copy link
Copy Markdown
Contributor Author

@koubaa Is it possible to add tests for this or would we have to download Python from the Windows store?

I asked @MaxJPRey about this. We can't install python from the windows store on our desktops, so we may need a special machine set up to do this

Comment thread src/ansys/mechanical/core/embedding/initializer.py
@MaxJPRey

MaxJPRey commented May 1, 2025

Copy link
Copy Markdown
Contributor

@koubaa Is it possible to add tests for this or would we have to download Python from the Windows store?

I asked @MaxJPRey about this. We can't install python from the windows store on our desktops, so we may need a special machine set up to do this

Yes, we will test the entire metapackage against the Python distribution provided by Windows store.
@koubaa We will confirm you as soon as it is done.

@codacy-production

Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for e82df191 25.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e82df19) Report Missing Report Missing Report Missing
Head commit (b4a07d1) 2536 2201 86.79%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1153) 16 4 25.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@koubaa
koubaa merged commit 1ef7ff3 into main May 1, 2025
@koubaa
koubaa deleted the windows-store branch May 1, 2025 15:09
dependency.

PyMechanical loads the embedding library which automatically sets
these Paths, but this uses the PATH environment variable which doesn't

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
these Paths, but this uses the PATH environment variable which doesn't
these paths, but this uses the PATH environment variable which doesn't

@MaxJPRey MaxJPRey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

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.

SEHException in embedded instance

4 participants