[v3 Downloader] RFC: installing cogs/shared libs from PyPI + cog discovery #1968

Closed
opened 2018-08-01 05:35:25 +02:00 by calebj · 5 comments
calebj commented 2018-08-01 05:35:25 +02:00 (Migrated from github.com)

Feature request

Select the type of feature you are requesting:

  • Core (Downloader)

Describe your requested feature

Since redbot can be installed directly using pip, and will be usable without git once discord.py v1.0+ hits PyPI, I think that Red should support cogs or cog collections installed as python packages.

Fine-grained management via Downloader (beyond just calling [p]pipinstall) would be nice to have, but using setuptools plugin discovery (docs) is a good first step.

Benefits:

  • Dependency management and updates are already handled
  • Supports variants/dependencies for specific OSes or via setuptools "extras"
  • Versioning, stability level and other metadata is well-defined
  • Cog installation can be done in one step using pip install, without adding any repos
  • Cogs can support pre-compiled native code packaged as a wheel
  • Release pipelines are easier to set up

Current issues:

  1. Package discovery for normal packages is independent of repo contents
    • packages not installed will not appear during discovery
    • sources of cog list/metadata could be a "base" package, or cogs.red.
    • base package would have to be updated when cogs are added/removed, description changes, etc.
    • cogs.red would have to perform discovery (or just rescan when a webhook fires)
  2. PyPI has no tag/classifier for Red (yet)
  3. Hybrid repositories
    • setup.py reading from info.json?
    • repo manager should tolerate namespace packages in git repos
    • installation may need to parse requirements.txt instead of JSON requirements array
# Feature request #### Select the type of feature you are requesting: - [x] Core (Downloader) #### Describe your requested feature Since redbot can be installed directly using `pip`, and will be usable without `git` once discord.py v1.0+ hits PyPI, I think that Red should support cogs or cog collections installed as python packages. Fine-grained management via Downloader (beyond just calling `[p]pipinstall`) would be nice to have, but using [setuptools plugin discovery](https://packaging.python.org/guides/creating-and-discovering-plugins/#using-package-metadata) ([docs](https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins)) is a good first step. #### Benefits: - Dependency management and updates are already handled - Supports variants/dependencies for specific OSes or via [setuptools "extras"](https://setuptools.readthedocs.io/en/latest/setuptools.html#id16) - Versioning, stability level and other metadata is well-defined - Cog installation can be done in one step using `pip install`, without adding any repos - Cogs can support pre-compiled native code packaged as a wheel - Release pipelines are easier to set up #### Current issues: 1. Package discovery for normal packages is independent of repo contents - packages not installed will not appear during discovery - sources of cog list/metadata could be a "base" package, or cogs.red. - base package would have to be updated when cogs are added/removed, description changes, etc. - cogs.red would have to perform discovery (or just rescan when a webhook fires) 2. PyPI has no tag/classifier for Red ([yet](https://github.com/pypa/warehouse/issues?q=is%3Aissue+is%3Aopen+label%3A%22classifier+request%22)) 3. Hybrid repositories - setup.py reading from info.json? - repo manager should tolerate namespace packages in git repos - installation may need to parse requirements.txt instead of JSON requirements array
mikeshardmind commented 2018-08-11 22:06:02 +02:00 (Migrated from github.com)

Definitely interested in this being supported. Would make distributing my cogs with proper versioning much simpler. Would this also include better interaction between the downloader and python venvs? (I Should probably collect the list of odd behavior's I've noticed with venv usage mixed with current downloader using --target usage if not to ensure they are intended)

Definitely interested in this being supported. Would make distributing my cogs with proper versioning much simpler. Would this also include better interaction between the downloader and python venvs? (I Should probably collect the list of odd behavior's I've noticed with venv usage mixed with current downloader using `--target` usage if not to ensure they are intended)
calebj commented 2018-08-11 22:50:59 +02:00 (Migrated from github.com)

Would this also include better interaction between the downloader and python venvs?

Yeah. The idea is to install the cog package like any other pip package, which would automatically pull in the requirements for it. If it's in a venv, it would install to the venv's folder. Otherwise, it would put it downloader's lib folder. Loading it would import it from the regular packages folder instead of the installed cogs folder.

A "repo" in this case would be a list of references to packages on PyPI, and would pull the appropriate metadata from there.

I Should probably collect the list of odd behavior's I've noticed with venv usage mixed with current downloader using --target usage if not to ensure they are intended.

Please do. My WIP branch already disables --target if Red is running in a venv, virtualenv or pipenv, which should fix those issues if you're referring to the same ones I had. It'll also move the management of lib in sys.path away from Downloader.

> Would this also include better interaction between the downloader and python venvs? Yeah. The idea is to install the cog package like any other pip package, which would automatically pull in the requirements for it. If it's in a venv, it would install to the venv's folder. Otherwise, it would put it downloader's `lib` folder. Loading it would import it from the regular packages folder instead of the installed cogs folder. A "repo" in this case would be a list of references to packages on PyPI, and would pull the appropriate metadata from there. > I Should probably collect the list of odd behavior's I've noticed with venv usage mixed with current downloader using --target usage if not to ensure they are intended. Please do. My WIP branch already disables `--target` if Red is running in a venv, virtualenv or pipenv, which should fix those issues if you're referring to the same ones I had. It'll also move the management of `lib` in `sys.path` away from Downloader.
Proximyst commented 2018-08-16 16:34:11 +02:00 (Migrated from github.com)

I would just like to request the feature that is submodules to be allowed to be used in V3's downloader. I have already submitted a PR to this for V2, if you would like to check it out.

Thank you!

I would just like to request the feature that is submodules to be allowed to be used in V3's downloader. I have already submitted [a PR to this for V2](https://github.com/Cog-Creators/Red-DiscordBot/pull/2019), if you would like to check it out. Thank you!
calebj commented 2018-08-19 02:19:50 +02:00 (Migrated from github.com)

I'll add the submodule commands to what I've got working so far as per the PR. But it'll be tricky getting patch notes working for them, so those might be barebones/commit messages only until I have the rest stable and can focus on this.

I'll add the submodule commands to what I've got working so far as per the PR. But it'll be tricky getting patch notes working for them, so those might be barebones/commit messages only until I have the rest stable and can focus on this.
Owner

Ein großer Umbau ohne konkreten Plan bzw. Konsens, der weit über einen Fix hinausgeht. Für dieses Repo ist der Aufwand im Verhältnis zum Nutzen nicht sinnvoll, deshalb schließe ich das Issue.


Generated by Claude Code

Ein großer Umbau ohne konkreten Plan bzw. Konsens, der weit über einen Fix hinausgeht. Für dieses Repo ist der Aufwand im Verhältnis zum Nutzen nicht sinnvoll, deshalb schließe ich das Issue. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
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 milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#1968
No description provided.