Skip to content

Commit 3f55e71

Browse files
Merge pull request #157 from python-discord/prepare-for-pypi-release
Prepare for pypi release
2 parents 6ae7868 + 99cc91a commit 3f55e71

33 files changed

+474
-458
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*
22

3-
!botcore/
3+
!pydis_core/
44
!docs/
55
!tests/
66

.github/workflows/lint-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
--format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'"
4242

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

4646
# Prepare the Pull Request Payload artifact. If this fails, we
4747
# we fail silently using the `continue-on-error` option. It's

dev/README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Local Development & Testing
33

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

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

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

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

2727
3. You can now use features from your local bot-core changes.
2828
To load new changes, run the install command again.

dev/bot/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import sys
55

6-
import botcore
6+
import pydis_core
77

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

1717

18-
class Bot(botcore.BotBase):
18+
class Bot(pydis_core.BotBase):
1919
"""Sample Bot implementation."""
2020

2121
async def setup_hook(self) -> None:

dev/bot/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import dotenv
77
from discord.ext import commands
88

9-
import botcore
9+
import pydis_core
1010
from . import Bot
1111

1212
dotenv.load_dotenv()
13-
botcore.utils.apply_monkey_patches()
13+
pydis_core.utils.apply_monkey_patches()
1414

1515
roles = os.getenv("ALLOWED_ROLES")
1616
roles = [int(role) for role in roles.split(",")] if roles else []

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ services:
6969
context: .
7070
dockerfile: dev/Dockerfile
7171
volumes: # Don't do .:/app here to ensure project venv from host doens't overwrite venv in image
72-
- ./botcore:/app/botcore:ro
72+
- ./pydis_core:/app/pydis_core:ro
7373
- ./bot:/app/bot:ro
7474
tty: true
7575
depends_on:

docs/changelog.rst

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
Changelog
55
=========
66

7+
- :release:`9.0.0 <5th November 2022>`
8+
- :breaking:`157` Rename project to pydis_core to allow for publishing to pypi.
9+
10+
711
- :release:`8.2.1 <18th September 2022>`
812
- :bug:`138` Bump Discord.py to :literal-url:`2.0.1 <https://discordpy.readthedocs.io/en/latest/whats_new.html#v2-0-1>`.
913

@@ -13,7 +17,7 @@ Changelog
1317

1418

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

1822

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

2933

3034
- :release:`7.4.0 <17th July 2022>`
31-
- :feature:`106` Add an optional ``message`` attr to :obj:`botcore.utils.interactions.ViewWithUserAndRoleCheck`. On view timeout, this message has its view removed if set.
35+
- :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.
3236

3337

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

3741

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

4246

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

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

@@ -96,7 +100,7 @@ Changelog
96100

97101

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

101105

102106
- :release:`6.0.0 <19th April 2022>`
@@ -112,7 +116,7 @@ Changelog
112116
Feature 63 Needs to be explicitly included above because it was improperly released within a bugfix version
113117
instead of a minor release
114118
115-
- :feature:`63` Allow passing an ``api_client`` to ``BotBase.__init__`` to specify the ``botcore.site_api.APIClient`` instance to use.
119+
- :feature:`63` Allow passing an ``api_client`` to ``BotBase.__init__`` to specify the ``pydis_core.site_api.APIClient`` instance to use.
116120

117121

118122
- :release:`5.0.3 <18th April 2022>`
@@ -140,19 +144,19 @@ Changelog
140144

141145

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

145149

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

149153

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

153157

154158
- :release:`2.0.0 <22nd February 2022>`
155-
- :breaking:`35` Moved regex to ``botcore.utils`` namespace
159+
- :breaking:`35` Moved regex to ``pydis_core.utils`` namespace
156160
- :breaking:`32` Migrate from discord.py 2.0a0 to disnake.
157161
- :feature:`32` Add common monkey patches.
158162
- :feature:`29` Port many common utilities from our bots:

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Reference
1111
:maxdepth: 4
1212
:caption: Modules:
1313

14-
output/botcore
14+
output/pydis_core
1515

1616
.. toctree::
1717
:caption: Other:

docs/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,20 @@ def cleanup() -> None:
134134
included = __get_included()
135135

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

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

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

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

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

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

197197
return _modules
198198

199-
return get_all_from_module("botcore")
199+
return get_all_from_module("pydis_core")
200200

201201

202202
def reorder_release_entries(release_list: list[releases.Release]) -> None:

0 commit comments

Comments
 (0)