Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*

!botcore/
!pydis_core/
!docs/
!tests/

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
--format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'"

- name: Run tests and generate coverage report
run: python -m pytest -n auto --cov botcore -q
run: python -m pytest -n auto --cov pydis_core -q

# Prepare the Pull Request Payload artifact. If this fails, we
# we fail silently using the `continue-on-error` option. It's
Expand Down
6 changes: 3 additions & 3 deletions dev/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Local Development & Testing

To test your features locally, there are a few possible approaches:

1. Install your local copy of botcore into a pre-existing project such as bot
1. Install your local copy of pydis_core into a pre-existing project such as bot
2. Use the provided template from the :repo-file:`dev/bot <dev/bot>` folder

See below for more info on both approaches.
Expand All @@ -17,12 +17,12 @@ vary by the feature you're working on.
Option 1
--------
1. Navigate to the project you want to install bot-core in, such as bot or sir-lancebot
2. Run ``pip install /path/to/botcore`` in the project's environment
2. Run ``pip install /path/to/pydis_core`` in the project's environment

- The path provided to install should be the root directory of this project on your machine.
That is, the folder which contains the ``pyproject.toml`` file.
- Make sure to install in the correct environment. Most Python Discord projects use
poetry, so you can run ``poetry run pip install /path/to/botcore``.
poetry, so you can run ``poetry run pip install /path/to/pydis_core``.

3. You can now use features from your local bot-core changes.
To load new changes, run the install command again.
Expand Down
4 changes: 2 additions & 2 deletions dev/bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import sys

import botcore
import pydis_core

if os.name == "nt":
# Change the event loop policy on Windows to avoid exceptions on exit
Expand All @@ -15,7 +15,7 @@
logging.getLogger("discord").setLevel(logging.ERROR)


class Bot(botcore.BotBase):
class Bot(pydis_core.BotBase):
"""Sample Bot implementation."""

async def setup_hook(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions dev/bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import dotenv
from discord.ext import commands

import botcore
import pydis_core
from . import Bot

dotenv.load_dotenv()
botcore.utils.apply_monkey_patches()
pydis_core.utils.apply_monkey_patches()

roles = os.getenv("ALLOWED_ROLES")
roles = [int(role) for role in roles.split(",")] if roles else []
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ services:
context: .
dockerfile: dev/Dockerfile
volumes: # Don't do .:/app here to ensure project venv from host doens't overwrite venv in image
- ./botcore:/app/botcore:ro
- ./pydis_core:/app/pydis_core:ro
- ./bot:/app/bot:ro
tty: true
depends_on:
Expand Down
26 changes: 15 additions & 11 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
Changelog
=========

- :release:`9.0.0 <5th November 2022>`
- :breaking:`157` Rename project to pydis_core to allow for publishing to pypi.


- :release:`8.2.1 <18th September 2022>`
- :bug:`138` Bump Discord.py to :literal-url:`2.0.1 <https://discordpy.readthedocs.io/en/latest/whats_new.html#v2-0-1>`.

Expand All @@ -13,7 +17,7 @@ Changelog


- :release:`8.1.0 <16th August 2022>`
- :support:`124` Updated :obj:`botcore.utils.regex.DISCORD_INVITE` regex to optionally match leading "http[s]" and "www".
- :support:`124` Updated :obj:`pydis_core.utils.regex.DISCORD_INVITE` regex to optionally match leading "http[s]" and "www".


- :release:`8.0.0 <27th July 2022>`
Expand All @@ -28,16 +32,16 @@ Changelog


- :release:`7.4.0 <17th July 2022>`
- :feature:`106` Add an optional ``message`` attr to :obj:`botcore.utils.interactions.ViewWithUserAndRoleCheck`. On view timeout, this message has its view removed if set.
- :feature:`106` Add an optional ``message`` attr to :obj:`pydis_core.utils.interactions.ViewWithUserAndRoleCheck`. On view timeout, this message has its view removed if set.


- :release:`7.3.1 <16th July 2022>`
- :bug:`104` Fix :obj:`botcore.utils.interactions.DeleteMessageButton` not working due to using wrong delete method.
- :bug:`104` Fix :obj:`pydis_core.utils.interactions.DeleteMessageButton` not working due to using wrong delete method.


- :release:`7.3.0 <16th July 2022>`
- :feature:`103` Add a generic view :obj:`botcore.utils.interactions.ViewWithUserAndRoleCheck` that only allows specified users and roles to interaction with it
- :feature:`103` Add a button :obj:`botcore.utils.interactions.DeleteMessageButton` that deletes the message attached to its parent view.
- :feature:`103` Add a generic view :obj:`pydis_core.utils.interactions.ViewWithUserAndRoleCheck` that only allows specified users and roles to interaction with it
- :feature:`103` Add a button :obj:`pydis_core.utils.interactions.DeleteMessageButton` that deletes the message attached to its parent view.


- :release:`7.2.2 <9th July 2022>`
Expand All @@ -46,7 +50,7 @@ Changelog

- :release:`7.2.1 <30th June 2022>`
- :bug:`96` Fix attempts to connect to ``BotBase.statsd_url`` when it is None.
- :bug:`91` Fix incorrect docstring for ``botcore.utils.member.handle_role_change``.
- :bug:`91` Fix incorrect docstring for ``pydis_core.utils.member.handle_role_change``.
- :bug:`91` Pass missing self parameter to ``BotBase.ping_services``.
- :bug:`91` Add missing await to ``BotBase.ping_services`` in some cases.

Expand Down Expand Up @@ -96,7 +100,7 @@ Changelog


- :release:`6.1.0 <20th April 2022>`
- :feature:`65` Add ``unqualify`` to the ``botcore.utils`` namespace for use in bots that manipulate extensions.
- :feature:`65` Add ``unqualify`` to the ``pydis_core.utils`` namespace for use in bots that manipulate extensions.


- :release:`6.0.0 <19th April 2022>`
Expand All @@ -112,7 +116,7 @@ Changelog
Feature 63 Needs to be explicitly included above because it was improperly released within a bugfix version
instead of a minor release

- :feature:`63` Allow passing an ``api_client`` to ``BotBase.__init__`` to specify the ``botcore.site_api.APIClient`` instance to use.
- :feature:`63` Allow passing an ``api_client`` to ``BotBase.__init__`` to specify the ``pydis_core.site_api.APIClient`` instance to use.


- :release:`5.0.3 <18th April 2022>`
Expand Down Expand Up @@ -140,19 +144,19 @@ Changelog


- :release:`3.0.1 <5th March 2022>`
- :bug:`37` Setup log tracing when ``botcore.utils.logging`` is imported so that it can be used within botcore functions.
- :bug:`37` Setup log tracing when ``pydis_core.utils.logging`` is imported so that it can be used within pydis_core functions.


- :release:`3.0.0 <3rd March 2022>`
- :breaking:`35` Move ``apply_monkey_patches()`` directly to `botcore.utils` namespace.
- :breaking:`35` Move ``apply_monkey_patches()`` directly to `pydis_core.utils` namespace.


- :release:`2.1.0 <24th February 2022>`
- :feature:`34` Port the Site API wrapper from the bot repo.


- :release:`2.0.0 <22nd February 2022>`
- :breaking:`35` Moved regex to ``botcore.utils`` namespace
- :breaking:`35` Moved regex to ``pydis_core.utils`` namespace
- :breaking:`32` Migrate from discord.py 2.0a0 to disnake.
- :feature:`32` Add common monkey patches.
- :feature:`29` Port many common utilities from our bots:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Reference
:maxdepth: 4
:caption: Modules:

output/botcore
output/pydis_core

.. toctree::
:caption: Other:
Expand Down
12 changes: 6 additions & 6 deletions docs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,20 @@ def cleanup() -> None:
included = __get_included()

for file in (get_build_root() / "docs" / "output").iterdir():
if file.name in ("botcore.rst", "botcore.exts.rst", "botcore.utils.rst") and file.name in included:
if file.name in ("pydis_core.rst", "pydis_core.exts.rst", "pydis_core.utils.rst") and file.name in included:
content = file.read_text(encoding="utf-8").splitlines(keepends=True)

# Rename the extension to be less wordy
# Example: botcore.exts -> Botcore Exts
title = content[0].split()[0].strip().replace("botcore.", "").replace(".", " ").title()
# Example: pydis_core.exts -> pydis_core Exts
title = content[0].split()[0].strip().replace("pydis_core.", "").replace(".", " ").title()
title = f"{title}\n{'=' * len(title)}\n\n"
content = title, *content[3:]

file.write_text("".join(content), encoding="utf-8")

elif file.name in included:
# Clean up the submodule name so it's just the name without the top level module name
# example: `botcore.regex module` -> `regex`
# example: `pydis_core.regex module` -> `regex`
lines = file.read_text(encoding="utf-8").splitlines(keepends=True)
lines[0] = lines[0].replace("module", "").strip().split(".")[-1] + "\n"
file.write_text("".join(lines))
Expand All @@ -164,7 +164,7 @@ def cleanup() -> None:

def build_api_doc() -> None:
"""Generate auto-module directives using apidoc."""
cmd = os.getenv("APIDOC_COMMAND") or "sphinx-apidoc -o docs/output botcore -feM"
cmd = os.getenv("APIDOC_COMMAND") or "sphinx-apidoc -o docs/output pydis_core -feM"
cmd = cmd.split()

build_root = get_build_root()
Expand Down Expand Up @@ -196,7 +196,7 @@ def get_all_from_module(module_name: str) -> set[str]:

return _modules

return get_all_from_module("botcore")
return get_all_from_module("pydis_core")


def reorder_release_entries(release_list: list[releases.Release]) -> None:
Expand Down
Loading