-
Notifications
You must be signed in to change notification settings - Fork 10
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
[change] Move python dependencies to requirements.txt file #60
[change] Move python dependencies to requirements.txt file #60
Conversation
Added all dependencies, such as Flask, Werkzeug, and uwsgi, into this file to keep things organized.
Adjusted the Ansible tasks to install dependencies from requirements.txt instead of listing them directly in the file & updated pip and related tools like setuptools and wheel.
tasks/pip.yml
Outdated
- name: Install Flask, Werkzeug and uWSGI | ||
- name: Read local requirements.txt | ||
local_action: command cat requirements.txt | ||
register: requirements |
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.
Are you sure this is correct? Did you try running the tests locally?
https://github.com/openwisp/ansible-wireguard-openwisp?tab=readme-ov-file#how-to-run-tests
Using `{{ role_path }}` instead of absolute paths, this variable points to the root directory of our Ansible role, where requirements.txt is located.
@pandafy , I've fixed the path for requirements.txt file, now it's working.. can you please check nd lmk, Thanks! |
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.
See my comment below, please also take a look at the message returned by the QA checks failure regarding the lack of capital letter after the square bracket, eg:
[prefix] done something
should be [prefix] Done something
.
tasks/pip.yml
Outdated
- wheel | ||
- attrs | ||
- importlib-metadata | ||
- packaging |
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 wouldn't move these because we're always upgrade to the latest version available.
The aim is to move only the python packages that we are pinning to as pecific version range, so that dependabot can help us update those more with less intervention from our end.
( `setuptools`, `wheel`, `attrs`, `importlib-metadata`, `packaging`) are removed from req file
- I've ensured `setuptools`, `wheel`, `attrs`, `importlib-metadata`, and `packaging` are installed directly via pip task - Replaced reading `requirements.txt` via `local_action` with explicit file copy to virtualenv - Changed package installation to use the copied `requirements.txt` file - Added condition to install packages only if `requirements.txt` changes
Hey @pandafy @nemesifier I've modified the changes can you please review this once. Thanks!
|
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.
Great progress @shwetd19!
See my comments below.
Again I want to bring to your attention to please also take a look at the message returned by the QA checks failure regarding the lack of capital letter after the square bracket, eg:
[prefix] done something
should be [prefix] Done something
.
- Kept --- line - Maintained all other functionality
@nemesifier I've made the suggested changes, please let me know if any changes are required, also pls forgive me if I'm making silly mistakes here, it's just I'm testing everything I can locally.. |
Hey @pandafy @nemesifier can you please test this with QA checks.. nd let me know if any changes are required also can you pls tell me where I can contribute more ? |
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.
Small adjustments for consistency
@nemesifier Thanks you very much for this! I'll try to learn as much as I can for never miss an oversight like this |
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.
LGTM!
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 took a closer look and found the following area for improvements.
requirements.txt
Outdated
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.
This file should be inside the files/ directory.
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.
Good point, thanks!
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.
Moved requirements.txt
from the root directory to files/requirements.txt
tasks/pip.yml
Outdated
@@ -36,3 +38,4 @@ | |||
delay: 10 | |||
register: result | |||
until: result is success | |||
when: requirements_copy is changed |
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.
This should be run always.
when: requirements_copy is changed |
Hey @nemesifier @pandafy I've made the suggested changes
I've tested the code locally too at my end, pls let me know if any change is required, Thanks! |
Hey @nemesifier @pandafy both suggested fixes are done! pls can you check once |
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.
LGTM!
Thanks for contributing @shwetd19 🚀
Checklist
Reference to Existing Issue
Closes #52.
Description of Changes
This pull request moves Python dependencies from
pip.yml
to arequirements.txt
file for easier management. Here’s what was done:Created a
requirements.txt
file:Flask
,Werkzeug
, anduwsgi
, into this file to keep things organized.Updated
pip.yml
:requirements.txt
instead of listing them directly in the file.pip
and related tools likesetuptools
andwheel
.requirements.txt
file.Dependabot Integration:
requirements.txt
automatically.Tested the Changes:
These changes make it easier to manage and update dependencies while keeping the setup clean and consistent.