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

Create template new_python_tool_pip #1232

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

sara-rn
Copy link
Contributor

@sara-rn sara-rn commented Jan 9, 2025

Closes #1080
Create new template to automatically install Python packages with pip and update script.
The dropdown field type is mandatory in the new issue template

@sara-rn sara-rn force-pushed the python-package-template branch from 29a1f7c to 689f5ed Compare January 9, 2025 12:34
Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

You need to add in this PR the workflow for the automation, as you need to ensure the template and the workflow work well together. For example, pkg_name is missing and it will make it fail.

.github/ISSUE_TEMPLATE/new_python_tool_pip.yml Outdated Show resolved Hide resolved
.github/ISSUE_TEMPLATE/new_python_tool_pip.yml Outdated Show resolved Hide resolved
attributes:
label: Tool Name
description: |
The name of the tool being installed (usually the file name with the `.exe`), normally different from the package name. Example: `FakeNet-NG` (tool name) vs `fakenet-ng` (package name).
Copy link
Member

Choose a reason for hiding this comment

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

There is no file with exe in this kind of tools. Use examples of current tools installed with pip (vs tools installed in a different way). Please adapt the rest of the file to refer to Pip tools.

.github/ISSUE_TEMPLATE/new_python_tool_pip.yml Outdated Show resolved Hide resolved
@sara-rn
Copy link
Contributor Author

sara-rn commented Jan 10, 2025

Thanks @Ana06 for the review, I am addressing the changes in the template. I should not have created the PR until I finish updating the create_package_template.py and therefore test the automation.

@sara-rn sara-rn force-pushed the python-package-template branch 6 times, most recently from 08edb20 to a7b766c Compare January 15, 2025 12:39
@sara-rn
Copy link
Contributor Author

sara-rn commented Jan 15, 2025

@Ana06 github action runs for the automatic creation of uncompyle6 package:
https://github.com/sara-rn/VM-Packages/actions/runs/12790181995

for rat-king-parser:
https://github.com/sara-rn/VM-Packages/actions/runs/12786294921

@sara-rn sara-rn self-assigned this Jan 15, 2025
Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

Awesome work @sara-rn! 😊 You need to add the version because (as mentioned in #1080 (comment), now tracked as #1240 that I have assigned to you) we need to fix the version of the tools installed with Pip.

$toolName = '{tool_name}'
$category = '{category}'

VM-Install-With-Pip -toolName $toolName -category $category
Copy link
Member

Choose a reason for hiding this comment

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

The version should be added here as well so that it is used by pip when installing the tool (otherwise you install the latest version). The template should look the same as the already existent magika package:

.github/ISSUE_TEMPLATE/new_python_tool_pip.yml Outdated Show resolved Hide resolved
.github/ISSUE_TEMPLATE/new_python_tool_pip.yml Outdated Show resolved Hide resolved
.github/ISSUE_TEMPLATE/new_python_tool_pip.yml Outdated Show resolved Hide resolved
.github/ISSUE_TEMPLATE/new_python_tool_pip.yml Outdated Show resolved Hide resolved
@sara-rn sara-rn force-pushed the python-package-template branch 2 times, most recently from e9c3d10 to 77674b3 Compare January 16, 2025 12:31
Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

Just some nitpicks and we are ready to go! Also, please squash the commits (as the second one is adding something needed by the code in the first commit to work) and ensure to follow good commit practices such as limiting the subject line to 50 characters and using the body to explain what and why you make the changes. I recommend reading https://cbea.ms/git-commit for more info on best practices to write good commit messages. 😉

scripts/utils/create_package_template.py Outdated Show resolved Hide resolved
scripts/utils/create_package_template.py Outdated Show resolved Hide resolved
@sara-rn sara-rn force-pushed the python-package-template branch from 72cfe60 to aceaf84 Compare January 16, 2025 16:31
@sara-rn
Copy link
Contributor Author

sara-rn commented Jan 16, 2025

@Ana06 commits squashed
github actions run for uncompyle6: https://github.com/sara-rn/VM-Packages/actions/runs/12813405402

for rat-king-parser https://github.com/sara-rn/VM-Packages/actions/runs/12813413902

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

The code LGTM! 🎉 As said in my last comment: ensure to follow good commit practices such as limiting the subject line to 50 characters and using the body to explain what and why you make the changes. I recommend reading https://cbea.ms/git-commit for more info on best practices to write good commit messages. 😉

If you do not limit the subject line to 50 characters it is difficult to read, for example:
image

@sara-rn sara-rn force-pushed the python-package-template branch from aceaf84 to 491d0d2 Compare January 17, 2025 16:28
@sara-rn
Copy link
Contributor Author

sara-rn commented Jan 17, 2025

@Ana06 I keep forgetting about the commit message, thank you!! it's changed now

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

The commit message is still missing a body (description of what the change is/achieves). Let's keep it like this to avoid you have to change it again, but please take it into account for future PRs. 😉

Thanks for all the work @sara-rn , this automation enhancement is going to be very useful! @sara-rn after you merge the PR, please trigger the automation for rat-king-parser, so exciting to see it working! 🎉

@Ana06
Copy link
Member

Ana06 commented Jan 17, 2025

I am not sure if we can add uncompyle6, does it work with Python 3.10?

@sara-rn
Copy link
Contributor Author

sara-rn commented Jan 17, 2025

I am not sure if we can add uncompyle6, does it work with Python 3.10?

yes it does but I will test it again

@sara-rn sara-rn merged commit 52a0ed7 into mandiant:main Jan 17, 2025
4 checks passed
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.

Template + automation for Python packages installed with pip
2 participants