Skip to content

Conversation

Paillat-dev
Copy link
Member

The general goal of these changes is to lower the amount of code we have to maintain across te library.

Changes include:

Separated utils function in:

  • utils.private for private utils that are to be used in the library code
  • utils for user facing utils

Removed over specific utils

Removed overly specific public utils that wouldn't commonly be used by users and aren't hard to re implement in any project. See CHANGELOG-V3.md for a comprehensive list.

Removed unused (or lesser used) utils

Remove utils that were used less than once or twice in the library in favor of:

  • Moving them to a specific file if they were specific to a part of the library and shouldn't have been in utils in the first place
  • For utils that implemented a one-liner, replace the util's usage with said one liner
  • For utils similar to other utils, use another util

Merged overlapping utils

Merge utils with common goals or with same goal with one another, e.g. see changes to utils.time_snowflake -> utils.generate_snowflake

Paillat-dev and others added 30 commits May 29, 2025 20:25
* Start migration to uv

* Setup ruff and hatch

* Change pre-commit to use ruff

* Format with ruff

* Fix mistake

* Add dev deps

* Change workflows to use uv and ruff

* ➕ Add colorlog and remove requirements folder and fix build

* 💚 Fix sphinx build ?

* 🐛 Add __version.py for version management and update import in __init__.py

* ✏️ Update lib-checks.yml to run ruff on ubuntu-latest

* 🐛 Update lib-checks.yml to run mypy with uv

* 🔥 Delete MANIFEST.in

* ✨ Enhance lib-checks.yml to include ruff formatter check

* ♻️ Refactor pyproject.toml and uv.lock to use optional-dependencies for voice and speed
* chore: Update localization workflows to use 'uv' for dependency management

* chore: refactor Read the Docs configuration to use uv
It was used twice, and once it wasn't even necessary
Co-authored-by: Lumouille <[email protected]>
Signed-off-by: Paillat <[email protected]>
@Paillat-dev Paillat-dev requested review from Lumabots and a team August 4, 2025 11:56
Co-authored-by: Ice Wolfy <[email protected]>
Signed-off-by: Paillat <[email protected]>
Paillat-dev and others added 6 commits August 7, 2025 00:53
@Paillat-dev Paillat-dev requested a review from Icebluewolf August 6, 2025 23:09
@Paillat-dev Paillat-dev requested a review from Copilot August 26, 2025 21:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Discord library's utils module to improve code organization and reduce maintenance burden by separating private utilities from user-facing APIs.

Key changes include:

  • Splitting utils into utils.public for user-facing utilities and utils.private for internal functions
  • Removing overly specific or rarely used utilities
  • Consolidating overlapping utilities (like merging time_snowflake into generate_snowflake)

Reviewed Changes

Copilot reviewed 61 out of 61 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
discord/utils/public.py New file containing user-facing utility functions
discord/utils/private.py New file containing internal utility functions
discord/utils/init.py New module initialization file exporting public utilities
discord/utils.py Removed monolithic utils file
Multiple source files Updated imports to use new utils structure
Documentation files Updated to reflect removed utilities and new import patterns
Test files Updated imports and removed deprecated function tests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Paillat-dev and others added 3 commits August 27, 2025 00:00
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paillat <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paillat <[email protected]>
Copy link

read-the-docs-community bot commented Aug 26, 2025

Documentation build overview

📚 pycord-next | 🛠️ Build #29349387 | 📁 Comparing 0df56df against latest (dacdc70)


🔍 Preview build

Show files changed (61 files in total): 📝 60 modified | ➕ 1 added | ➖ 0 deleted
File Status
faq.html 📝 modified
genindex.html 📝 modified
migrating_to_v1.html 📝 modified
old_changelog.html 📝 modified
_modules/index.html 📝 modified
api/application_commands.html 📝 modified
api/async_iter.html 📝 modified
api/audit_logs.html 📝 modified
api/data_classes.html 📝 modified
api/models.html 📝 modified
api/ui_kit.html 📝 modified
api/utils.html 📝 modified
_modules/discord/abc.html 📝 modified
_modules/discord/activity.html 📝 modified
_modules/discord/appinfo.html 📝 modified
_modules/discord/asset.html 📝 modified
_modules/discord/audit_logs.html 📝 modified
_modules/discord/bot.html 📝 modified
_modules/discord/channel.html 📝 modified
_modules/discord/client.html 📝 modified
_modules/discord/components.html 📝 modified
_modules/discord/embeds.html 📝 modified
_modules/discord/emoji.html 📝 modified
_modules/discord/guild.html 📝 modified
_modules/discord/integrations.html 📝 modified
_modules/discord/interactions.html 📝 modified
_modules/discord/invite.html 📝 modified
_modules/discord/member.html 📝 modified
_modules/discord/message.html 📝 modified
_modules/discord/monetization.html 📝 modified
_modules/discord/onboarding.html 📝 modified
_modules/discord/partial_emoji.html 📝 modified
_modules/discord/poll.html 📝 modified
_modules/discord/role.html 📝 modified
_modules/discord/scheduled_events.html 📝 modified
_modules/discord/stage_instance.html 📝 modified
_modules/discord/sticker.html 📝 modified
_modules/discord/team.html 📝 modified
_modules/discord/template.html 📝 modified
_modules/discord/threads.html 📝 modified
_modules/discord/user.html 📝 modified
_modules/discord/utils.html 📝 modified
_modules/discord/voice_client.html 📝 modified
_modules/discord/welcome_screen.html 📝 modified
_modules/discord/widget.html 📝 modified
ext/commands/api.html 📝 modified
ext/pages/index.html 📝 modified
_modules/discord/commands/context.html 📝 modified
_modules/discord/commands/core.html 📝 modified
_modules/discord/ext/tasks.html 📝 modified
_modules/discord/ui/view.html 📝 modified
_modules/discord/utils/public.html ➕ added
modules/discord/webhook/async.html 📝 modified
_modules/discord/webhook/sync.html 📝 modified
_modules/discord/ext/bridge/core.html 📝 modified
_modules/discord/ext/commands/bot.html 📝 modified
_modules/discord/ext/commands/context.html 📝 modified
_modules/discord/ext/commands/converter.html 📝 modified
_modules/discord/ext/commands/core.html 📝 modified
_modules/discord/ext/commands/flags.html 📝 modified
_modules/discord/ext/commands/help.html 📝 modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants