[Trivia] Move Trivia lists back home #2028

Merged
Tobotimus merged 4 commits from V3/vendor_trivia into V3/develop 2018-08-26 15:39:46 +02:00
Tobotimus commented 2018-08-18 15:02:22 +02:00 (Migrated from github.com)

This still needs discussion, but this means saying no to namespace packages (yay) and also everything I listed on #1973. Discussion on that issue still needs to occur, but I want to get it rolling and make a decision on this soon.

What I've done is move the trivia lists to the redbot/cogs/trivia/data/lists directory. The reason I chose and extra data sub-directory is for the interest of ease of extensibility, the distribution will now include all files in an existing data sub-directory of a package.

This also fixes our issue (which has only just been recently discovered) that locale files haven't been included with the distribution since beta 9, due to a line added in #1420: include_package_data=True. This reverts that change and also greatly simplifies the data file discovery for the distribution. I'm for more maintainable and straightforward code where possible.

This still needs discussion, but this means saying no to namespace packages (*yay*) and also everything I listed on #1973. Discussion on that issue still needs to occur, but I want to get it rolling and make a decision on this soon. What I've done is move the trivia lists to the `redbot/cogs/trivia/data/lists` directory. The reason I chose and extra `data` sub-directory is for the interest of ease of extensibility, the distribution will now include all files in an existing `data` sub-directory of a package. This also fixes our issue (which has only just been recently discovered) that locale files haven't been included with the distribution since beta 9, due to a line added in #1420: `include_package_data=True`. This reverts that change and also greatly simplifies the data file discovery for the distribution. I'm for more maintainable and straightforward code where possible.
palmtree5 (Migrated from github.com) reviewed 2018-08-18 15:02:22 +02:00
tekulvw (Migrated from github.com) reviewed 2018-08-18 15:02:22 +02:00
Twentysix26 (Migrated from github.com) reviewed 2018-08-18 15:02:22 +02:00
Tobotimus (Migrated from github.com) reviewed 2018-08-18 15:18:51 +02:00
Tobotimus (Migrated from github.com) left a comment

Here are just some explanatory comments.

Here are just some explanatory comments.
Tobotimus (Migrated from github.com) commented 2018-08-18 15:08:02 +02:00

The discord/bin/*.dll files don't need to be in our manifest as they're not part of our distribution.

As for the redbot/cogs/audio/application.yml file, I've moved it to redbot/cogs/audio/data/application.yml as we're now including everything in the data/ sub-directory of all packages if it exists (much like we do with 3rd party cogs). This reduces boilerplate and maintains consistency.

The `discord/bin/*.dll` files don't need to be in our manifest as they're not part of our distribution. As for the `redbot/cogs/audio/application.yml` file, I've moved it to `redbot/cogs/audio/data/application.yml` as we're now including everything in the data/ sub-directory of all packages if it exists (much like we do with 3rd party cogs). This reduces boilerplate and maintains consistency.
Tobotimus (Migrated from github.com) commented 2018-08-18 15:05:18 +02:00

Just a comment: The Pipfile.lock was simply updated as Red-Trivia is no longer a dependency. For some reason it has also included some extra markers - these have no effect so please disregard.

Just a comment: The Pipfile.lock was simply updated as Red-Trivia is no longer a dependency. For some reason it has also included some extra markers - these have no effect so please disregard.
Tobotimus (Migrated from github.com) commented 2018-08-18 15:10:24 +02:00

Since this is literally just aliasing a single function call, I removed the function and placed the raw one directly in the setup function for clarity.

Since this is literally just aliasing a single function call, I removed the function and placed the raw one directly in the setup function for clarity.
Tobotimus (Migrated from github.com) commented 2018-08-18 15:12:59 +02:00

So this might be your biggest question, why did I remove this function: it's over-complicated, doesn't encourage extensibility of our data files and objects to maintainability. It is achieved in a much simpler manner with the usage explained below.

So this might be your biggest question, why did I remove this function: it's over-complicated, doesn't encourage extensibility of our data files and objects to maintainability. It is achieved in a much simpler manner with the usage explained below.
Tobotimus (Migrated from github.com) commented 2018-08-18 15:17:19 +02:00

include_package_data is a very misleading argument which we should never use in the interest of remaining sane. It actually forces setuptools to ignore the package_data argument. Please, for the sake of any future maintainers' sanity, don't bring it back (It's not clearly documented in setuptools' documentation, if you're unconvinced that this is the behaviour, test it on a local machine).

The new package_data argument is used in the way which is recommended in setuptools' documentation, where an empty string as a key applies the rule to all included packages.

`include_package_data` is a very misleading argument which we should never use in the interest of remaining sane. It actually forces setuptools to *ignore* the `package_data` argument. Please, for the sake of any future maintainers' sanity, don't bring it back (It's not clearly documented in setuptools' documentation, if you're unconvinced that this is the behaviour, test it on a local machine). The new `package_data` argument is used in the way which is [recommended in setuptools' documentation](https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files), where an empty string as a key applies the rule to all included packages.
@ -0,0 +5,4 @@
from redbot.cogs.trivia import get_core_lists
list_names = get_core_lists()
assert list_names
Tobotimus (Migrated from github.com) commented 2018-08-18 15:17:52 +02:00

This test came straight from the Red-Trivia repo.

This test came straight from the Red-Trivia repo.
mikeshardmind commented 2018-08-19 01:51:53 +02:00 (Migrated from github.com)

I think I'd prefer trivia be loaded in as a submodule (still not a namespace package) here for a few practical reasons. The trivia lists don't seem to need to be under the same level of QA scrutiny as the rest of the project. They need to be kept accurate, but there aren't code paths in the questions. Leaving them in their current repo, but pulled in as a submodule allows the more lax review process for those, while gaining the other benefits.

I think I'd prefer trivia be loaded in as a submodule (still not a namespace package) here for a few practical reasons. The trivia lists don't seem to need to be under the same level of QA scrutiny as the rest of the project. They need to be kept accurate, but there aren't code paths *in the questions*. Leaving them in their current repo, but pulled in as a submodule allows the more lax review process for those, while gaining the other benefits.
calebj commented 2018-08-19 02:22:04 +02:00 (Migrated from github.com)

+1 to what @mikeshardmind said. IMO, trivia lists shouldn't be in the main repo.

+1 to what @mikeshardmind said. IMO, trivia lists shouldn't be in the main repo.
Tobotimus commented 2018-08-19 05:21:11 +02:00 (Migrated from github.com)

@mikeshardmind @calebj If the only incentive to keep them out is to bypass QA, that can easily be done by us devs simply not assigning QA members to trivia lists PRs. Besides, as we know, @MiniJennJenn manages the trivia lists, is the only one who makes PRs to add trivia lists, and those trivia lists come from #12. I don't see how this is worth separating the repos or overengineering the solution to this "problem".

Finally, does this argument stack up against those I made in #1973? If you have disagreements with what I've stated there, you're welcome to point them out.

@mikeshardmind @calebj If the only incentive to keep them out is to bypass QA, that can easily be done by us devs simply not assigning QA members to trivia lists PRs. Besides, as we know, @MiniJennJenn manages the trivia lists, is the only one who makes PRs to add trivia lists, and those trivia lists come from #12. I don't see how this is worth separating the repos or overengineering the solution to this "problem". Finally, does this argument stack up against those I made in #1973? If you have disagreements with what I've stated there, you're welcome to point them out.
Tobotimus commented 2018-08-19 07:59:39 +02:00 (Migrated from github.com)

I should probably think again before responding. For some reason I wasn't even thinking about git submodules, personally I've never used them but I understand now.

This would flatten the versioning system and it would keep them in the Red-DiscordBot distribution, which are both good things and solve two of the problems on #1973. The 3rd problem (neglect and separation) I could resolve by simply linking the ZenHub boards for the two repos (although I'm not convinced why we should separate the repos in the first place, esp. if we're only going to link their issue/PR boards back up again).

I'll look into using submodules. Thanks for your suggestions guys.

I should probably think again before responding. For some reason I wasn't even thinking about git submodules, personally I've never used them but I understand now. This would flatten the versioning system and it would keep them in the Red-DiscordBot distribution, which are both good things and solve two of the problems on #1973. The 3rd problem (neglect and separation) I could resolve by simply linking the ZenHub boards for the two repos (although I'm not convinced why we should separate the repos in the first place, esp. if we're only going to link their issue/PR boards back up again). I'll look into using submodules. Thanks for your suggestions guys.
Tobotimus commented 2018-08-19 09:08:31 +02:00 (Migrated from github.com)

After a bit of research and testing, I've decided against the proposition of using submodules. These are my reasons:

  • Cloning submodules includes everything which would be located in that submodule, as shown in the following image:
    image
    This means we'd have to be more specific in our globs for package_data in setup.py - part of this PR was to make that more general to simplify the process of adding data files in the future.
  • (the main reason) When the submodule is added and pushed to this main repo, it points to a specific commit on the submodule's repo, so if there any updates to the trivia lists we'd like to include in the next release, we'd have to open a new PR over here to update them. This is annoying and is a similar problem to the one we have now of maintaining separate release cycles on PyPI, and having to update the version pin on this repo every time Red-Trivia makes a new release.

So for those reasons I'm sticking to this approach here.

After a bit of research and testing, I've decided against the proposition of using submodules. These are my reasons: - Cloning submodules includes *everything* which would be located in that submodule, as shown in the following image: ![image](https://user-images.githubusercontent.com/7438501/44306421-ec22dc00-a3d1-11e8-84eb-311186ee68f0.png) This means we'd have to be more specific in our globs for `package_data` in `setup.py` - part of this PR was to make that more general to simplify the process of adding data files in the future. - (the main reason) When the submodule is added and pushed to this main repo, it points to a specific commit on the submodule's repo, so if there any updates to the trivia lists we'd like to include in the next release, we'd have to open a new PR over here to update them. This is annoying and is a similar problem to the one we have now of maintaining separate release cycles on PyPI, and having to update the version pin on this repo every time Red-Trivia makes a new release. So for those reasons I'm sticking to this approach here.
mikeshardmind commented 2018-08-19 17:02:30 +02:00 (Migrated from github.com)

While that's correct, we don't actually need anything but the yml files to exist in that repo if we go that route. I'm still going to advocate the submodule route due to this, but I'm not strictly opposed to simply moving it all back here.

While that's correct, we don't actually need anything but the yml files to exist in that repo if we go that route. I'm still going to advocate the submodule route due to this, but I'm not strictly opposed to simply moving it all back here.
Tobotimus commented 2018-08-19 17:26:43 +02:00 (Migrated from github.com)

We'd need the tests and Travis config in there at the least since we're not removing the CI on the lists. Besides, that wasn't my main gripe, it was more having to update the head of the submodule every time the trivia lists change.

We'd need the tests and Travis config in there at the least since we're not removing the CI on the lists. Besides, that wasn't my main gripe, it was more having to update the head of the submodule every time the trivia lists change.
mikeshardmind commented 2018-08-19 19:06:57 +02:00 (Migrated from github.com)

Right... Just move them back then.

Right... Just move them back then.
Tobotimus commented 2018-08-24 16:00:56 +02:00 (Migrated from github.com)

Despite the mixed feelings about this I'm putting it into beta 20 as a possibly temporary fix for the namespace package issues. It's also a permanent fix for all of our missing translations, and that certainly needs to be fixed for beta 20. Personally I think the trivia files are going to stay where they are regardless.

Despite the mixed feelings about this I'm putting it into beta 20 as a *possibly temporary* fix for the namespace package issues. It's also a permanent fix for all of our missing translations, and that certainly needs to be fixed for beta 20. Personally I think the trivia files are going to stay where they are regardless.
Kowlin (Migrated from github.com) approved these changes 2018-08-26 15:02:52 +02:00
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
1 participant
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!2028
No description provided.