diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 38683669fa..ae4f48d270 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -38,4 +38,4 @@ Make sure you have removed your bot token (if visible). - [ ] I have made sure to remove ANY sensitive information (bot token, passwords, credentials, personal details, etc). - [ ] I have searched the issue tracker and have made sure it's not a duplicate. - If it is a follow up of another issue, I have specified it. \ No newline at end of file + If it is a follow up of another issue, I have specified it. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a2caafe38d..4c65c45ebd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,7 +7,7 @@ - [ ] I have made unittests according to the code I have added/modified/deleted. ### Related issues - \ No newline at end of file +--> diff --git a/docs/patched_pdoc.py b/docs/patched_pdoc.py new file mode 100644 index 0000000000..66ed1e8039 --- /dev/null +++ b/docs/patched_pdoc.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +def main(): + from pdoc import cli + + cli.main() + + +if __name__ == "__main__": + main() diff --git a/hikari/__init__.py b/hikari/__init__.py index 3545f54150..7370b6145a 100644 --- a/hikari/__init__.py +++ b/hikari/__init__.py @@ -27,12 +27,8 @@ the REST API. """ -# We need these imported explicitly for the __all__ to be visible due to -# Python's weird import visibility system. -from hikari import config -from hikari import errors -from hikari import events -from hikari import models +from __future__ import annotations + from hikari._about import __author__ from hikari._about import __ci__ from hikari._about import __copyright__ @@ -63,32 +59,3 @@ from hikari.utilities.undefined import UNDEFINED from hikari.utilities.undefined import UndefinedNoneOr from hikari.utilities.undefined import UndefinedOr - -_presorted_all = [ - "File", - "Pathish", - "Rawish", - "LazyByteIteratorish", - "Resourceish", - "Snowflake", - "Snowflakeish", - "SnowflakeishOr", - "SearchableSnowflakeish", - "SearchableSnowflakeishOr", - "Unique", - "UNDEFINED", - "UndefinedOr", - "UndefinedNoneOr", - *config.__all__, - *events.__all__, - *errors.__all__, - *models.__all__, -] - -# This may seem a bit dirty, but I have added an edge case to the documentation -# logic to *ignore* the sorting member rules for the root `hikari` module -# (this file) specifically. This way, we can force `Bot` and `RESTClientFactory` -# to the top of the list. -__all__ = ["Bot", "REST", *sorted(_presorted_all)] - -del _presorted_all diff --git a/hikari/api/__init__.py b/hikari/api/__init__.py index 5d4ff9b387..9e8c0d8a6d 100644 --- a/hikari/api/__init__.py +++ b/hikari/api/__init__.py @@ -26,4 +26,4 @@ relying on a distributed event bus or cache. """ -__all__ = [] # type: ignore[var-annotated] +from __future__ import annotations diff --git a/hikari/events/__init__.py b/hikari/events/__init__.py index 01955643e7..ca756b293d 100644 --- a/hikari/events/__init__.py +++ b/hikari/events/__init__.py @@ -23,19 +23,6 @@ from __future__ import annotations -import typing - -from hikari.events import channel_events -from hikari.events import guild_events -from hikari.events import lifetime_events -from hikari.events import member_events -from hikari.events import message_events -from hikari.events import reaction_events -from hikari.events import role_events -from hikari.events import shard_events -from hikari.events import typing_events -from hikari.events import user_events -from hikari.events import voice_events from hikari.events.base_events import Event from hikari.events.base_events import ExceptionEvent from hikari.events.channel_events import * @@ -49,18 +36,3 @@ from hikari.events.typing_events import * from hikari.events.user_events import * from hikari.events.voice_events import * - -__all__: typing.List[str] = ( - ["Event", "ExceptionEvent"] - + channel_events.__all__ - + guild_events.__all__ - + lifetime_events.__all__ - + member_events.__all__ - + message_events.__all__ - + reaction_events.__all__ - + role_events.__all__ - + shard_events.__all__ - + typing_events.__all__ - + user_events.__all__ - + voice_events.__all__ -) diff --git a/hikari/impl/__init__.py b/hikari/impl/__init__.py index 8b80232ee3..015aea768b 100644 --- a/hikari/impl/__init__.py +++ b/hikari/impl/__init__.py @@ -27,4 +27,4 @@ implementations. """ -__all__ = [] # type: ignore[var-annotated] +from __future__ import annotations diff --git a/hikari/models/__init__.py b/hikari/models/__init__.py index 93ef17cf81..613ad1a352 100644 --- a/hikari/models/__init__.py +++ b/hikari/models/__init__.py @@ -21,23 +21,8 @@ # SOFTWARE. """Data classes representing Discord entities.""" -from hikari.models import applications -from hikari.models import audit_logs -from hikari.models import channels -from hikari.models import colors -from hikari.models import colours -from hikari.models import embeds -from hikari.models import emojis -from hikari.models import gateway -from hikari.models import guilds -from hikari.models import intents -from hikari.models import invites -from hikari.models import messages -from hikari.models import permissions -from hikari.models import presences -from hikari.models import users -from hikari.models import voices -from hikari.models import webhooks +from __future__ import annotations + from hikari.models.applications import * from hikari.models.audit_logs import * from hikari.models.channels import * @@ -55,23 +40,3 @@ from hikari.models.users import * from hikari.models.voices import * from hikari.models.webhooks import * - -__all__ = ( - applications.__all__ - + audit_logs.__all__ - + channels.__all__ - + colors.__all__ - + colours.__all__ - + embeds.__all__ - + emojis.__all__ - + gateway.__all__ - + guilds.__all__ - + intents.__all__ - + invites.__all__ - + messages.__all__ - + permissions.__all__ - + presences.__all__ - + users.__all__ - + voices.__all__ - + webhooks.__all__ -) diff --git a/hikari/utilities/__init__.py b/hikari/utilities/__init__.py index 222ea7ca96..60e72e2a74 100644 --- a/hikari/utilities/__init__.py +++ b/hikari/utilities/__init__.py @@ -21,4 +21,4 @@ # SOFTWARE. """Package containing internal utilities used within this API.""" -__all__ = [] # type: ignore[var-annotated] +from __future__ import annotations diff --git a/pipelines/pdoc.nox.py b/pipelines/pdoc.nox.py index 2e79c817e6..4d1b061b74 100644 --- a/pipelines/pdoc.nox.py +++ b/pipelines/pdoc.nox.py @@ -44,8 +44,7 @@ def pdoc(session: nox.Session) -> None: session.run( "python", - "-m", - "pdoc", + "docs/patched_pdoc.py", config.MAIN_PACKAGE, "--html", "--output-dir", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 9cc64f8597..3c4bc1c338 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -7,7 +7,6 @@ python -m pip install \ setuptools \ wheel \ nox \ - mypy \ twine \ requests \ -r requirements.txt @@ -31,17 +30,6 @@ echo "========================================================================== cat hikari/_about.py echo "==========================================================================" -echo "===== GENERATING MYPY STUBS FOR --strict SUPPORT =====" - -find hikari -name "__init__.py" | while read -r f; do - base=$(dirname "${f}") - echo "Generating stub for ${f} as module ${base}" - stubgen -m "${base}" -o "." -done - -echo "===== REFORMATTING GENERATED MYPY STUBS =====" -python -m nox --sessions reformat-code - echo "===== DEPLOYING TO PYPI =====" python setup.py sdist bdist_wheel echo "-- Contents of . --"