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: New extension version manager #5702

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

Conversation

hui-zhou-a
Copy link
Contributor

@hui-zhou-a hui-zhou-a commented Jan 29, 2025

Description

New extension Version manager.

Issue linked

Close #5732

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

@hui-zhou-a hui-zhou-a linked an issue Jan 29, 2025 that may be closed by this pull request
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 0% with 352 lines in your changes missing coverage. Please review.

Project coverage is 84.73%. Comparing base (d4e2859) to head (31c01f5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5702      +/-   ##
==========================================
+ Coverage   81.55%   84.73%   +3.18%     
==========================================
  Files         156      157       +1     
  Lines       61181    61533     +352     
==========================================
+ Hits        49894    52141    +2247     
+ Misses      11287     9392    -1895     

@Samuelopez-ansys
Copy link
Member

@hui-zhou-a This extension is great! But could you please use the same style than the others? I think you can see the choke designer one which has already multi tabs like this one and probably it will be easier for you to adapt.

The icon of the app when it is opened, is not the PyAnsys logo, and to respect consistency with the other extension you should also import it.

In summary, I think you could check the choke_designer toolkit and try to adapt the style

@hui-zhou-a hui-zhou-a changed the title New extension version manager FEAT: New extension version manager Feb 3, 2025
@Samuelopez-ansys Samuelopez-ansys enabled auto-merge (squash) February 4, 2025 17:01
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.

I left some minor comments. Thanks for the contribution @hui-zhou-a !

Comment on lines 316 to 328
for product in toolkits_path.iterdir():
if not product.is_dir():
continue
xml_file = product / "TabConfig.xml"
if xml_file.exists():
tree = ET.parse(xml_file)
root = tree.getroot()
panel_label = "Panel_PyAEDT_Extensions"
for panel in root.findall("panel"):
if panel.get("label") == panel_label:
for button in panel.findall("button"):
name = button.get("label")
temp.append([product, name])
Copy link
Collaborator

Choose a reason for hiding this comment

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

def is_git_installed():
try:
# Run the command `git --version`
result = subprocess.run(["git", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
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
result = subprocess.run(["git", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
result = subprocess.run(["git", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

Add check=True ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Comment on lines 364 to 373
if response.status_code == 200:
data = response.json()
released_version = data["info"]["version"]
else:
released_version = 0

if self.pyaedt_version > released_version:
subprocess.run([self.python_exe, "-m", "pip", "install", f"pyaedt=={released_version}"], check=True)
else:
subprocess.run([self.python_exe, "-m", "pip", "install", "-U", "pyaedt"], check=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about the behavior here. What's supposed to happen if released_version == 0 ? Also, does it make sense to have a pyaedt_version that is higher than the last released version ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For your first question, it is a bug. Fixed.

self.pyedb_version can be dev version.which is higher than the release. In this case, install the release version.

Comment on lines +426 to +429
if self.pyedb_version > released_version:
subprocess.run([self.python_exe, "-m", "pip", "install", f"pyedb=={released_version}"], check=True)
else:
subprocess.run([self.python_exe, "-m", "pip", "install", "-U", "pyedb"], check=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as previous comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same fix

"install",
"--no-cache-dir",
"--no-index",
f"--find-links=file:///{str(unzipped_path)}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure that f strings are working correctly with extensions, can you double check ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked it is working on my machine. Is there a more reliable way?

@hui-zhou-a
Copy link
Contributor Author

@SMoraisAnsys I fixed what I can, please review again.

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.

Need an extension to manage PyAEDT/PyEDB version Add an extension to manage pyaedt pyedb versions
4 participants