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

fix: use kwargs to add keyword args to try_running_module #19

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ and this project adheres to a _modified_ form of _[Semantic Versioning][semver]_

### Removed

## [0.7.3]

### Added

### Changed

### Fixed

- Fix `try_running_module` by adding `kwargs` instead of hardcoded parameters. ([#19])

### Removed

[#19]: https://github.com/openlawlibrary/upgrade-python-package/pull/19

## [0.7.2]

### Added
Expand Down Expand Up @@ -155,7 +169,8 @@ and this project adheres to a _modified_ form of _[Semantic Versioning][semver]_
[#5]: https://github.com/openlawlibrary/upgrade-python-package/pull/5
[#6]: https://github.com/openlawlibrary/upgrade-python-package/pull/6

[Unreleased]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.2...HEAD
[Unreleased]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.3...HEAD
[0.7.3]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.2...0.7.3
[0.7.2]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.1...0.7.2
[0.7.1]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.0...0.7.1
[0.7.0]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.6.0...0.7.0
Expand Down
6 changes: 4 additions & 2 deletions upgrade/scripts/upgrade_python_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def upgrade_and_run(
module_name = package_name.replace("-", "_")
try_running_module(
module_name,
*args,
cloudsmith_url=cloudsmith_url,
slack_webhook_url=slack_webhook_url,
*args,
)
return was_updated, response_err

Expand Down Expand Up @@ -458,7 +458,7 @@ def split_package_name_and_extra(package_install_cmd):
return package_name, extra


def try_running_module(wheel, cloudsmith_url=None, slack_webhook_url=None, *args):
def try_running_module(wheel, *args, **kwargs):
file_name = os.path.basename(wheel)
module_name = file_name.split("-", 1)[0]
# don't try running the module if it does not exists
Expand All @@ -468,7 +468,9 @@ def try_running_module(wheel, cloudsmith_url=None, slack_webhook_url=None, *args
try:
run_module_and_reload_uwsgi_app(module_name, *args)
except Exception:
slack_webhook_url = kwargs.get("slack_webhook_url")
if slack_webhook_url is not None:
cloudsmith_url = kwargs.get("cloudsmith_url")
send_upgrade_notification(
f"Failed to run module {module_name}",
cloudsmith_url,
Expand Down