Add redbot-update command for updating Red #6734
No reviewers
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!6734
Loading…
Reference in a new issue
No description provided.
Delete branch "redbot_update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description of the changes
Depends on #6711, #6704, #6710, #6705, #6709
Fixes #3103
Here's an asciicast previewing the update process (note that some parts are skipped depending on the conditions + you can skip a lot of steps with command flags):

Notes
RuntimeError: Event loop is closedignored exception. This is something we work around inredbot, but I don't think it's worth complicatingredbot-updateto do the same. The workaround is not needed on 3.10+, so the problem will fully disappear with Red 3.6. This is cosmetic only; it does not affect the exit code.Have the changes in this PR been tested?
Yes
How to test this?
Due to the fact that there are no releases with redbot-update in them yet, it's not possible to test some of this without additional dev configuration.
Here are env vars available for overriding:
_RED_UPDATE_PRETEND_VERSION- sets the version thatredbot-updatewill assume to be the current version_RED_UPDATE_PRETEND_SPECIFIER_TEMPLATE- a dependency specifier that will be passed topip installwhen "updating".format()-ted with{extras}(e.g.[postgres]) and{versionspec}(e.g.==3.5.24) placeholdersRed-DiscordBot {extras} {versionspec}github.com/Cog-Creators/Red-DiscordBot@22fca3c589/redbot/_update/common.py (L50-L59)_RED_RTD_CANONICAL_URL- base URL of the docs (https://docs.discord.red/en/stable/by default)RED_SIMPLE_API_URL,_RED_SIMPLE_API_ENDPOINT_PATH- allow to specify a different location that should be queried for available versions (by default,https://pypi.org/simple/andRed-DiscordBotrespectively)Basic env var configuration may look like this (note that I did not include any of the
export/$env:/setprefixes that are needed for these to actually be set in a shell, make sure to do that!):If you want to test what happens when the current Python interpreter is incompatible or when a major update is released, you'll want to set the following to a custom Simple API endpoint:
The above URL hosts a JSON file with an example
3.5.25and3.6.0restricted to Python >= 3.10 (for demonstration purposes), which means you can test updating to a Red version requiring a different Python version from what you have (assuming you, e.g. use Python 3.8) and updating to a new major release.You can also locally host a dir with a JSON file as described in the comment, if there are other scenarios you are interested in:
github.com/Jackenmen/Red-DiscordBot@5849354a44/redbot/core/utils/_internal_utils.py (L76-L82)