Skip to content

Conversation

@Piyushrathoree
Copy link

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #572

Description of Changes

update the pip.yml file with extra-args:"--upgrade" which make sure that every dependency is updated.

@Piyushrathoree Piyushrathoree changed the title [ansible-openwisp2] Upgrade pip deps from requiremeents on rerun #572 [ansible-openwisp2] Upgrade pip deps from requirements on rerun #572 Dec 4, 2025
@Piyushrathoree Piyushrathoree changed the title [ansible-openwisp2] Upgrade pip deps from requirements on rerun #572 [ansible-openwisp2] Upgrade pip deps from requirements on rerun Dec 4, 2025
@Piyushrathoree
Copy link
Author

@pandafy PTAL

Copy link
Member

@pandafy pandafy left a comment

Choose a reason for hiding this comment

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

Good start @Piyushrathoree!

I am afraid that --upgrade might not always work when we use tarball URL as source. E.g. when we set openwisp-controller version in the ansible playbook

openwisp2_controller_version: openwisp-controller @ https://github.com/openwisp/openwisp-controller/tarball/master

In such scenarios, we would need to use state: forcereinstall.

Using forcereinstall by default will slow down the playbook, since it will make pip reinstall packages even when the latest package have been installed.

I can think of exposing pip.extra_args argument through ansible variable openwisp2_pip_extra_args. The default value for this argument will be openwisp2_pip_extra_args: "--upgrade". When needed, the user can override the variable in the playbook to use `openwisp2_pip_extra_args: "--upgrade --force-reinstall" which will force-reinstall the packages.

We will need to add this new variable in https://github.com/openwisp/ansible-openwisp2/blob/master/docs/user/role-variables.rst, and explain the usage with a comment. You can take reference from other settings mentioned in the file.

value --upgrade and can be overridden with
--upgrade --force-reinstall
@Piyushrathoree
Copy link
Author

Piyushrathoree commented Dec 10, 2025

Good start @Piyushrathoree!

I am afraid that --upgrade might not always work when we use tarball URL as source. E.g. when we set openwisp-controller version in the ansible playbook

openwisp2_controller_version: openwisp-controller @ https://github.com/openwisp/openwisp-controller/tarball/master

In such scenarios, we would need to use state: forcereinstall.

Using forcereinstall by default will slow down the playbook, since it will make pip reinstall packages even when the latest package have been installed.

I can think of exposing pip.extra_args argument through ansible variable openwisp2_pip_extra_args. The default value for this argument will be openwisp2_pip_extra_args: "--upgrade". When needed, the user can override the variable in the playbook to use `openwisp2_pip_extra_args: "--upgrade --force-reinstall" which will force-reinstall the packages.

We will need to add this new variable in https://github.com/openwisp/ansible-openwisp2/blob/master/docs/user/role-variables.rst, and explain the usage with a comment. You can take reference from other settings mentioned in the file.

thanks @pandafy
made some changes according to what you've said , please take a look .

Comment on lines +34 to +37
# Extra arguments passed to pip when reinstalling Python packages with --force-reinstall
# By default, packages are upgraded on each playbook run.
# Can be overridden, for example:
# openwisp2_pip_extra_args: "--upgrade --force-reinstall"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Extra arguments passed to pip when reinstalling Python packages with --force-reinstall
# By default, packages are upgraded on each playbook run.
# Can be overridden, for example:
# openwisp2_pip_extra_args: "--upgrade --force-reinstall"
# Extra arguments passed to pip when installing Python packages.
# By default, packages are upgraded on each playbook run.
# Can be overridden, for example:
# openwisp2_pip_extra_args: "--upgrade --force-reinstall"

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.

[feature] Ensure all Python dependencies update on existing installs when playbook runs

2 participants