-
Notifications
You must be signed in to change notification settings - Fork 134
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
For more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
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 |
…nto new-extension-version-manager
@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 |
There was a problem hiding this 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 !
doc/source/User_guide/pyaedt_extensions_doc/project/version_manager.rst
Outdated
Show resolved
Hide resolved
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]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you have a look at what is done in customize_automation_tab.py, specifically
def is_git_installed(): | ||
try: | ||
# Run the command `git --version` | ||
result = subprocess.run(["git", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
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) |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comment
There was a problem hiding this comment.
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)}", |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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?
@SMoraisAnsys I fixed what I can, please review again. |
Description
New extension Version manager.
Issue linked
Close #5732
Checklist