Skip to content

FEAT: Install pyaedt via uv #6338

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

eblanco-ansys
Copy link
Contributor

Description

Use uv to install pyaedt dependencies

Issue linked

#6317

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue or issues that are solved by the PR if any.
  • I have agreed with the Contributor License Agreement (CLA).

@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

Copy link

codecov bot commented Jun 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.96%. Comparing base (967c72f) to head (7818c01).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6338      +/-   ##
==========================================
- Coverage   84.27%   81.96%   -2.31%     
==========================================
  Files         175      175              
  Lines       65983    65983              
==========================================
- Hits        55606    54083    -1523     
- Misses      10377    11900    +1523     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

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

Could you give a try at making the whole project moving to uv instead of only this installation file ? Also, could you consider using UV_HTTP_TIMEOUT in order to keep the previous behavior with ``--default-timeout` ? It has a larger scope but if I understand well the documentation it should be helping for this.

Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

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

Here are some comments, thanks for the contribution !
Note that we might have issues when using pyaedt with uv. In particular for those still leveraging the dotnet target.
See ansys/pymechanical#1143 and the associated uv issue astral-sh/python-build-standalone#596

env = os.environ.copy()
env["VIRTUAL_ENV"] = str(venv_dir)
env["PATH"] = str(venv_dir / "Scripts") + os.pathsep + env.get("PATH", "")
env["UV_HTTP_TIMEOUT "] = "1000" # Increase timeout for uv
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
env["UV_HTTP_TIMEOUT "] = "1000" # Increase timeout for uv
env["UV_HTTP_TIMEOUT"] = "1000" # Increase timeout for uv


if args.version <= "231":
subprocess.run([str(pip_exe), "uninstall", "-y", "pywin32"], check=True) # nosec
subprocess.run([str(uv_exe), "pip", "uninstall", "-y", "pywin32"], check=True, env=env) # nosec
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
subprocess.run([str(uv_exe), "pip", "uninstall", "-y", "pywin32"], check=True, env=env) # nosec
subprocess.run([str(uv_exe), "pip", "uninstall", "-y", "pywin32"], check=True) # nosec

Not defined here

subprocess.call([str(pip_exe), "uninstall", "-y", "pyaedt"], check=True) # nosec
# Ensure uv is installed in the venv
subprocess.run([str(pip_exe), "install", "uv"], check=True) # nosec
subprocess.call([str(uv_exe), "pip", "uninstall", "-y", "pyaedt"], check=True, env=env) # nosec
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
subprocess.call([str(uv_exe), "pip", "uninstall", "-y", "pyaedt"], check=True, env=env) # nosec
subprocess.call([str(uv_exe), "pip", "uninstall", "-y", "pyaedt"], check=True) # nosec

Not defined here

@@ -301,16 +314,16 @@ def install_pyaedt():
command.append("pyaedt[all,dotnet]=='0.9.0'")
else:
command.append("pyaedt[all]")
subprocess.run(command, check=True) # nosec
subprocess.run(command, check=True, env=env) # nosec
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
subprocess.run(command, check=True, env=env) # nosec
subprocess.run(command, check=True) # nosec

else:
print("Installing PyAEDT using online sources")
print("Installing PyAEDT using online sources with uv...")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to define the env variable here too or possibly sooner in your script.

@eblanco-ansys eblanco-ansys marked this pull request as ready for review July 8, 2025 15:52
@eblanco-ansys eblanco-ansys requested a review from a team as a code owner July 8, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the 'PyAEDT Installer Python file' to use 'uv' package manager
4 participants