Privatize APIs by renaming or removing them from __all__ #6021

Merged
Jackenmen merged 28 commits from improve_all_in_some_modules into V3/develop 2023-04-17 23:44:34 +02:00
Jackenmen commented 2023-04-15 20:30:49 +02:00 (Migrated from github.com)

Description of the changes

  • write down new version guarantees
  • add __all__ to public modules that are missing it
  • add missing items in modules that already have __all__
  • remove names that aren't supposed to be public from __all__:
    • removed create_temp_config(), load_basic_configuration(), core_data_path() from redbot.core.data_manager.__all__
    • removed set_locale(), reload_locales() from redbot.core.i18n.__all__
    • removed _update_event_loop_policy() and MIN_PYTHON_VERSION from redbot.__all__
  • keep redbot.core.data_manager.storage_details() as public API but update it to deep copy underlying storage details dict
  • (can be reverted) add data_path() and metadata_file() functions to redbot.core.data_manager module
  • (can be reverted) remove long deprecated redbot.core.data_manager.load_bundled_data()
  • privatize modules in redbot.core by adding _ prefix to them:
    • cog_manager
    • settings_caches
    • global_checks
    • events
    • cli
    • rpc
    • drivers
  • privatize Config.driver
  • add notes about unsupported instantiation to redbot.core.config and redbot.core.modlog classes

Have the changes in this PR been tested?

Yes

### Description of the changes - write down new version guarantees - add `__all__` to public modules that are missing it - add missing items in modules that already have `__all__` - remove names that aren't supposed to be public from `__all__`: - removed `create_temp_config()`, `load_basic_configuration()`, `core_data_path()` from `redbot.core.data_manager.__all__` - removed `set_locale()`, `reload_locales()` from `redbot.core.i18n.__all__` - removed `_update_event_loop_policy()` and `MIN_PYTHON_VERSION` from `redbot.__all__` - keep `redbot.core.data_manager.storage_details()` as public API but update it to deep copy underlying storage details dict - (can be reverted) add `data_path()` and `metadata_file()` functions to `redbot.core.data_manager` module - (can be reverted) remove long deprecated `redbot.core.data_manager.load_bundled_data()` - privatize modules in `redbot.core` by adding `_` prefix to them: - `cog_manager` - `settings_caches` - `global_checks` - `events` - `cli` - `rpc` - `drivers` - privatize `Config.driver` - add notes about unsupported instantiation to `redbot.core.config` and `redbot.core.modlog` classes ### Have the changes in this PR been tested? Yes
Flame442 (Migrated from github.com) reviewed 2023-04-17 22:59:51 +02:00
Flame442 (Migrated from github.com) left a comment
No description provided.
This is all set as is, but I've listed a few things that might make sense to add/remove.
Jackenmen (Migrated from github.com) reviewed 2023-04-17 23:26:16 +02:00
@ -10,0 +15,4 @@
"BalanceTooHigh",
"BankPruneError",
"ConfigError",
"StoredTypeError",
Jackenmen (Migrated from github.com) commented 2023-04-17 23:26:16 +02:00

Purposefully omitted, I want to move it to redbot.core._drivers at a later time.

Purposefully omitted, I want to move it to `redbot.core._drivers` at a later time.
Jackenmen (Migrated from github.com) reviewed 2023-04-17 23:26:23 +02:00
@ -3,6 +3,26 @@ Contains generic mod action casetypes for use in Red and 3rd party cogs.
These do not need to be registered to the modlog, as it is done for you.
Jackenmen (Migrated from github.com) commented 2023-04-17 23:26:23 +02:00

Good idea.

Good idea.
Jackenmen (Migrated from github.com) reviewed 2023-04-17 23:32:46 +02:00
@ -24,2 +20,4 @@
"data_path",
"metadata_file",
"storage_details",
"storage_type",
Jackenmen (Migrated from github.com) commented 2023-04-17 23:32:46 +02:00

The idea behind it was that 3rd-party cogs should be using cog_data_path() so there should be no reason to use core_data_path() but the use case of core_data_path() / "logs" is not a bad one. Of course there's the data_path() / "core/logs" but I don't see a reason to have API users jump through these hoops. Gonna revert this removal.

The idea behind it was that 3rd-party cogs should be using `cog_data_path()` so there should be no reason to use `core_data_path()` but the use case of `core_data_path() / "logs"` is not a bad one. Of course there's the `data_path() / "core/logs"` but I don't see a reason to have API users jump through these hoops. Gonna revert this removal.
Flame442 (Migrated from github.com) approved these changes 2023-04-17 23:44:09 +02:00
Sign in to join this conversation.
No reviewers
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!6021
No description provided.