First off, thanks for taking the time to contribute! It makes the library substantially better. 🎉
The following is a set of guidelines for contributing to the repository. These are not necessarily hard rules, but they streamline the process for everyone involved.
- Contributing to disnake
Important
Please try your best not to create new issues in the issue tracker just to ask questions, unless they provide value to a larger audience.
Generally speaking, questions are better suited in our resources below.
- The official Discord server: https://discord.gg/disnake
- The FAQ in the documentation
- The project's discussions section
This project does not allow contributions generated by large language models (LLMs).
This includes tools like Claude Code, Codex, Copilot, Cursor, DeepSeek, and others.
This policy applies to all parts of the project, including, but not limited to, code contributions, documentation contributions, and conversations in issues/pull requests.
An exception applies specifically for translating texts to interact with issues, pull requests, or discussions in the repository.
AI-generated content is typically a detriment to the overall quality of the issue tracker and codebase, resulting in additional work for maintainers and often wasting valuable time; additionally, it raises concerns about copyright and ownership of intellectual property, and it remains unclear whether the output of LLMs is copyrightable in the first place.
Generative AI tools, by their own nature, cannot assess the accuracy or correctness of their own responses/outputs, which makes them unsuitable for environments such as this project, where the responsibility of verifying and correcting potentially entirely fabricated changes is then pushed onto the reviewers.
As such, if you encounter a bug or would like to see a new feature added, but don't feel equipped to make these changes yourself, please consider opening a bug report/feature request instead.
AI tools can be useful to find information, answer questions, or gain further understanding of a particular topic (e.g. existing code in a project), but caution should be exercised nevertheless; their responses can possibly be misleading, outdated, or plainly incorrect.
To report bugs (or to suggest new features), visit our issue tracker. The issue templates will generally walk you through the steps, but please be aware of the following things:
- Don't open duplicate issues. Before you submit an issue, search the issue tracker to see if an issue for your problem already exists. If you find a similar issue, you can add a comment with additional information or context to help us understand the problem better.
- Include the complete traceback when filing a bug report about exceptions or tracebacks. Without the complete traceback, it will be much more difficult for others to understand (and perhaps fix) your issue.
- Add a minimal reproducible code snippet that results in the behavior you're seeing. This helps us quickly confirm a bug or point out a solution to your problem. We cannot reliably investigate bugs without a way to reproduce them.
If the bug report is missing this information, it'll take us longer to fix the issue. We may ask for clarification, and if no response was given, the issue will be closed.
Creating a pull request is fairly straightforward. Make sure it focuses on a single aspect and avoids scope creep, then it's probably good to go.
If you're unsure about some aspect of development, feel free to use existing files as a guide or reach out via the Discord server.
The general workflow can be summarized as follows:
- Fork + clone the repository.
- Initialize the development environment:
uv run nox -s dev. - Create a new branch.
- Commit your changes, update documentation if required.
- Add a changelog entry (e.g.
changelog/1234.feature.rst). - Push the branch to your fork, and submit a pull request!
Specific development aspects are further explained below.
We use [uv][uv] as our dependency manager. If it isn't already installed on your system, you can follow the installation steps from astral to get started.
Once uv is installed, we have one command to run that creates our entire development environment at once.
uvx nox -s devThis will:
- create
uv.lock - create a venv at
.venv - install all dependencies to
.venv - install pre-commit hooks (via prek) at
.git/hooks/pre-commit
Other tools used in this project include ruff (formatter and linter), and pyright (type-checker). For the most part, these automatically run on every commit with no additional action required - see below for details.
All of the following checks also automatically run for every PR on GitHub, so don't worry if you're not sure whether you missed anything. A PR cannot be merged as long as there are any failing checks.
This project uses the commonly known conventional commit format. While not necessarily required (but appreciated) for individual commit messages, please make sure to title your PR according to this schema:
<type>(<scope>)<!>: <short summary>
│ │ │ │
│ │ │ └─⫸ Summary in present tense, not capitalized, no period at the end
│ │ │
│ │ └─⫸ [optional] `!` indicates a breaking change
│ │
│ └─⫸ [optional] Commit Scope: The affected area, e.g. gateway, user, ...
│
└─⫸ Commit Type: feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert
Examples: feat: support new avatar format or fix(gateway): use correct url for resuming connection.
Details about the specific commit types can be found on the conventional commits documentation.
This project follows PEP-8 guidelines (mostly) with a column limit of 100 characters, and uses the tools mentioned above to enforce a consistent coding style.
The installed prek hooks will automatically run before every commit, which will format/lint the code
to match the project's style. Note that you will have to stage and commit again if anything was updated!
Most of the time, running prek will automatically fix any issues that arise.
For type-checking, run uv run nox -s pyright (append -- -w to have it automatically re-check on every file change).
Note
If you're using VSCode and pylance, it will use the same type-checking settings, which generally means that you don't necessarily have to run pyright separately.
However, since we use a specific version of pyright (which may not match pylance's version), there can be version differences which may lead to different results.
We use towncrier for managing our changelogs. Each change is required to have at least one file in the changelog/ directory, unless it's a trivial change. There is more documentation in that directory on how to create a changelog entry.
We use Sphinx to build the project's documentation, which includes automatically generating the API Reference from docstrings using the NumPy style.
To build the documentation locally, use uv run nox -s docs and visit http://127.0.0.1:8009/ once built.
Changes should be marked with a version directive as documented on the Sphinx documentation.
For the version argument, provide |vnext| as the argument.
We have a custom role which replaces |vnext| with the next version of the library upon building the documentation.
We've recently migrated from pdm to [uv][uv] for dependency and environment management for local development, in hopes of a developer experience with less friction.
- delete
pdm.lockand.pdm-python, and the.noxdirectory. - run
uvx nox -s devto recreate the virtual environment, refresh installation of pre-commit
Previously, we were using pdm's scripts functions as a simple caller for our nox scripts. We are migrating to using nox directly, the tasks now look like the following:
$ pdm docs
$ pdm lint
$ pdm pyright
$ pdm test
$ pdm setup_envBecomes:
$ uv run nox -s docs
$ uv run nox -s lint
$ uv run nox -s pyright
$ uv run nox -s test
$ uv run noxfile.py -s devnox may also be installed to your path using either uv or pipx and used on the root: eg nox -s docs with no preceding uv run
# without global nox
$ uv run noxfile.py -s dev
# with global nox
$ uv tool install nox # or pipx install nox
$ nox -s devTip
To provide arguments to the selected sessions with nox, pass them after --. For example, to tell prek to only run ruff format, run nox -s lint -- ruff-format.