-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add stubs for gunicorn #14690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add stubs for gunicorn #14690
Changes from all commits
Commits
Show all changes
106 commits
Select commit
Hold shift + click to select a range
e5171a0
[gunicorn] Initial commit: create_baseline_stubs
eugeneliukindev abab2e7
[gunicorn] Add metadata
eugeneliukindev 7ec2ee6
[gunicorn] Create _types.pyi file
eugeneliukindev 93780f5
[gunicorn] Update stubs for util.pyi
eugeneliukindev d863249
[gunicorn] Update stubs for systemd.pyi
eugeneliukindev cf928b2
[gunicorn] Update stubs for sock.pyi
eugeneliukindev 41a6c47
[gunicorn] Update stubs for reloader.pyi
eugeneliukindev 1d917a5
[gunicorn] Update stubs for pidfile.pyi
eugeneliukindev 4a0e58a
[gunicorn] Update stubs for glogging.pyi
eugeneliukindev ba4e46d
[gunicorn] Update stubs for errors.pyi
eugeneliukindev 5e538fb
[gunicorn] Update stubs for debug.pyi
eugeneliukindev ad1bfe2
[gunicorn] Add type alias for parse_address function in util.pyi
eugeneliukindev 7224967
[gunicorn] Add type construct (py3.12) instead TypeAlias
eugeneliukindev a4d6294
[gunicorn] Update stubs for config.pyi
eugeneliukindev af6f58a
[gunicorn] Fix load_class function type annotation
eugeneliukindev 2117471
[gunicorn] Fix logger_class property return type annotation
eugeneliukindev e1138bd
[gunicorn] Fix worker_class property return type annotation
eugeneliukindev b3f5b4f
[gunicorn] Update stubs for arbiter.pyi
eugeneliukindev f97a5f6
[gunicorn] Update stubs for __init__.pyi
eugeneliukindev bfabbcb
[gunicorn] Update stubs for workers/workertmp.pyi
eugeneliukindev b25a69a
[gunicorn] Fix ssl_context function return type annotation
eugeneliukindev f23abec
[gunicorn] Update stubs for workers/sync.pyi
eugeneliukindev fc17f3f
[gunicorn] Move _AddressType to file ._types.pyi
eugeneliukindev 9550632
[gunicorn] Update stubs for workers/gtornado.pyi
eugeneliukindev f444d1a
[gunicorn] Add override decorator
eugeneliukindev 9168bfa
[gunicorn] Add types-tornado in METADATA.toml requires
eugeneliukindev 43b02f0
[gunicorn] Update stubs for workers/gthread.pyi
eugeneliukindev e29de4a
[gunicorn] Update stubs for workers/ggevent.pyi
eugeneliukindev 401499a
[gunicorn] Update stubs for workers/geventlet.pyi
eugeneliukindev c513eb5
[gunicorn] Update stubs for workers/base_async.pyi
eugeneliukindev 268be54
[gunicorn] Delete EventMask type from reloader.pyi
eugeneliukindev 4ce39a0
[gunicorn] Add prefix '_' to types in reloader.pyi
eugeneliukindev 23d0ded
[gunicorn] Add type: ignore for inotify library in reloader.pyi
eugeneliukindev 24d5028
[gunicorn] Update stubs for workers/base.pyi
eugeneliukindev 32dc3eb
[gunicorn] Fix logger annotations
eugeneliukindev 2d75465
[gunicorn] Update stubs for workers/__init__.pyi
eugeneliukindev e529ff9
[gunicorn] Fix handle_request return type annotation
eugeneliukindev 5fe6ade
[gunicorn] Fix _LogLevelType type in glogging.pyi
eugeneliukindev d1efd54
[gunicorn] Update stubs for instrument/statsd.pyi
eugeneliukindev b133c64
[gunicorn] Add documentation for _EnvironType in _types.pyi
eugeneliukindev 6a2ac3c
[gunicorn] Update stubs for http/wsgi.pyi
eugeneliukindev afd9783
[gunicorn] Refactor: migrate from typing.Type to builtin type annotat…
eugeneliukindev 157a62c
[gunicorn] Update stubs for http/unreader.pyi
eugeneliukindev 800d710
[gunicorn] Update stubs for http/parser.pyi
eugeneliukindev a50e7b7
[gunicorn] Update stubs for http/message.pyi
eugeneliukindev 63b2fd0
[gunicorn] Update stubs for http/errors.pyi
eugeneliukindev 1c85564
[gunicorn] Update stubs for http/body.pyi
eugeneliukindev d3cb245
[gunicorn] Add _ASGIAppType in _types.pyi
eugeneliukindev 5c323bd
[gunicorn] Update stubs for app/base.pyi
eugeneliukindev a10038b
[gunicorn] Update stubs for app/pasterapp.pyi
eugeneliukindev 1f73313
[gunicorn] Update stubs for app/wsgiapp.pyi
eugeneliukindev 0aa6efd
[gunicorn] Add stubtest_allowlist.txt
eugeneliukindev d723565
[gunicorn] Add return type annotation for is_already_handled function
eugeneliukindev aff785b
[gunicorn] Add 'args', 'kwargs' type annotation for __init__ function
eugeneliukindev a74424e
[gunicorn] run script 'pre-commit run --all-files'
eugeneliukindev 35e4307
[gunicorn] Fix: flake8, ruff, black rules
eugeneliukindev d98998b
[gunicorn] Fix: mypy errors
eugeneliukindev cb7f7f4
[gunicorn] Fix: pyright errors
eugeneliukindev 23a6754
[gunicorn] Use _DictConfigArgs annotation instead custom TypedDict
eugeneliukindev ad13dea
[gunicorn] Supress mypy imports
eugeneliukindev 9d38f82
[gunicorn] Supress pyright, mypy imports
eugeneliukindev 2678a62
[gunicorn] Add ClassVar annotations
eugeneliukindev 0aa8e18
[gunicorn] Add supported_platforms and ci_platforms in METADATA.toml
eugeneliukindev 616d381
[gunicorn] Add [tool.stubtest]
eugeneliukindev 1e72ba7
[gunicorn] Fix: InotifyReloader.get_dirs return annotation
eugeneliukindev e68b65a
Merge branch 'main' into main
eugeneliukindev 99b2e89
[gunicorn] Add stub for UnixSocket
eugeneliukindev 1a91edf
[gunicorn] Suppress eventlet imports
eugeneliukindev 21716db
Merge remote-tracking branch 'origin/main'
eugeneliukindev 366f6fd
[gunicorn] Suppress tornado imports
eugeneliukindev 71121bc
[gunicorn] Add stubtest_allowlist_darwin.txt
eugeneliukindev eb159a7
[gunicorn] Delete types-tornado from requires
eugeneliukindev 0fb0617
[gunicorn] Remove suppress import error
eugeneliukindev 0445324
[gunicorn] Add stubtest_requirements versions
eugeneliukindev fa28ecf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0b1574d
Merge branch 'main' into main
eugeneliukindev 6aac2eb
[gunicorn] Add description for stubtest allowlist (InotifyReloader me…
eugeneliukindev 864a9c6
[gunicorn] Add different stubs for different OS for InotifyReloader
eugeneliukindev 568a9b7
[gunicorn] Add description about helper _types.pyi file
eugeneliukindev 86b3615
[gunicorn] Add link to pep instead of duplicating documentation
eugeneliukindev 85b153a
[gunicorn] Use collection.abc interface instead of its specific imple…
eugeneliukindev 7f4167c
[gunicorn] Change returning from `None` to `object`
eugeneliukindev c0294c8
[gunicorn] Fix parse_chunked func return type
eugeneliukindev e99ae0d
[gunicorn] Add function signature mapping to logging.Logger
eugeneliukindev 8564c9f
[gunicorn] Add stubs for respiter arg
eugeneliukindev f3d740e
[gunicorn] Delete __init__ method from ThreadWorker
eugeneliukindev f0a7685
[gunicorn] Add _ConfigValueType
eugeneliukindev d3cc1e2
[gunicorn] Add _AnyValidatorType
eugeneliukindev d497e64
[gunicorn] Fix Setting.type stub
eugeneliukindev c917fa4
[gunicorn] Delete Any annotations from validators
eugeneliukindev 07a1f3c
[gunicorn] Add comment for `Any` annotation
eugeneliukindev 60c219f
[gunicorn] Fix validate_callable annotation
eugeneliukindev 448c4bb
[gunicorn] Fix load_entry_point `Any` return annotation
eugeneliukindev 343f4f4
[gunicorn] Fix validate_post_request annotation
eugeneliukindev 3243431
[gunicorn] Add `_CallableValidatorType` type
eugeneliukindev 1d41e83
[gunicorn] Change Setting.validator to common stub with comment
eugeneliukindev a365ecc
[gunicorn] Add @overload decorators to validate_bool, validate_string…
eugeneliukindev b0735d1
[gunicorn] run `pre-commit run --all-files`
eugeneliukindev 588640a
[gunicorn] Remove extra argument
eugeneliukindev e134479
[gunicorn] delete allowlist darwin
eugeneliukindev abd30fb
[gunicorn] add comment about gunicorn.__main__
eugeneliukindev 79b3948
[gunicorn] Fix 'get_arity' func 'f' annotation
eugeneliukindev d7aeca8
[gunicorn] Fix 'SettingMeta' method '__new__' return type
eugeneliukindev aea18a2
[gunicorn] Fix '__version__' type
eugeneliukindev 003db6a
[gunicorn] Delete stubtest_allowlist_darwin.txt
eugeneliukindev 8cfa2ac
Merge branch 'main' into main
eugeneliukindev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Is not present in runtime. For more details, see the file itself. | ||
gunicorn._types | ||
|
||
# .pyi file doesn't exist | ||
gunicorn.__main__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version = "23.0.*" | ||
upstream_repository = "https://github.com/benoitc/gunicorn" | ||
requires = ["types-gevent"] | ||
|
||
[tool.stubtest] | ||
supported_platforms = ["linux", "darwin"] | ||
ci_platforms = ["linux", "darwin"] | ||
stubtest_requirements = ["gevent>=1.4.0", "eventlet>=0.24.1,!=0.36.0", "tornado>=0.2", "setproctitle", "PasteDeploy", "inotify"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version_info: tuple[int, int, int] | ||
__version__: str | ||
SERVER: str | ||
SERVER_SOFTWARE: str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
### This .pyi file is a helper for centralized storage types that are reused across different runtime modules. ### | ||
from _typeshed import FileDescriptor | ||
from collections.abc import Awaitable, Callable, Iterable, MutableMapping | ||
from typing import Any | ||
from typing_extensions import LiteralString, TypeAlias | ||
|
||
_StatusType: TypeAlias = str | ||
_HeadersType: TypeAlias = Iterable[tuple[str, str]] | ||
|
||
_EnvironType: TypeAlias = MutableMapping[str, Any] # See https://peps.python.org/pep-0333/ | ||
_StartResponseType: TypeAlias = Callable[[_StatusType, _HeadersType], None] | ||
_ResponseBodyType: TypeAlias = Iterable[bytes] | ||
_WSGIAppType: TypeAlias = Callable[[_EnvironType, _StartResponseType], _ResponseBodyType] # noqa: Y047 | ||
|
||
_ScopeType: TypeAlias = MutableMapping[str, Any] | ||
_MessageType: TypeAlias = MutableMapping[str, Any] | ||
_ReceiveType: TypeAlias = Callable[[], Awaitable[_MessageType]] | ||
_SendType: TypeAlias = Callable[[_MessageType], Awaitable[None]] | ||
_ASGIAppType: TypeAlias = Callable[[_ScopeType, _ReceiveType, _SendType], Awaitable[None]] # noqa: Y047 | ||
|
||
_UnixSocketPathType: TypeAlias = str | ||
_TcpAddressType: TypeAlias = tuple[LiteralString, int] # noqa: Y047 | ||
_AddressType: TypeAlias = _UnixSocketPathType | FileDescriptor | _TcpAddressType # noqa: Y047 |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from argparse import ArgumentParser, Namespace | ||
from typing import Any | ||
from typing_extensions import override | ||
|
||
from gunicorn.config import Config | ||
from gunicorn.glogging import Logger as GLogger | ||
|
||
from .._types import _ASGIAppType, _WSGIAppType | ||
|
||
class BaseApplication: | ||
usage: str | None | ||
cfg: Config | ||
callable: _WSGIAppType | _ASGIAppType | None | ||
prog: str | None | ||
logger: GLogger | ||
|
||
def __init__(self, usage: str | None = None, prog: str | None = None) -> None: ... | ||
def do_load_config(self) -> None: ... | ||
def load_default_config(self) -> None: ... | ||
def init(self, parser: ArgumentParser, opts: Namespace, args: list[str]) -> dict[str, Any] | None: ... | ||
def load(self) -> _WSGIAppType | _ASGIAppType: ... | ||
def load_config(self) -> None: ... | ||
def reload(self) -> None: ... | ||
def wsgi(self) -> _WSGIAppType | _ASGIAppType: ... | ||
def run(self) -> None: ... | ||
|
||
class Application(BaseApplication): | ||
def chdir(self) -> None: ... | ||
def get_config_from_filename(self, filename: str) -> dict[str, Any]: ... | ||
def get_config_from_module_name(self, module_name: str) -> dict[str, Any]: ... | ||
def load_config_from_module_name_or_filename(self, location: str) -> dict[str, Any]: ... | ||
def load_config_from_file(self, filename: str) -> dict[str, Any]: ... | ||
@override | ||
def load_config(self) -> None: ... | ||
@override | ||
def run(self) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from typing import Any | ||
|
||
from .._types import _WSGIAppType | ||
|
||
def get_wsgi_app(config_uri: str, name: str | None = None, defaults: dict[str, Any] | None = None) -> _WSGIAppType: ... | ||
def has_logging_config(config_file: str) -> bool: ... | ||
def serve(app: _WSGIAppType, global_conf: dict[str, Any], **local_conf: Any) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from argparse import ArgumentParser, Namespace | ||
from typing_extensions import override | ||
|
||
from gunicorn.app.base import Application | ||
|
||
from .._types import _WSGIAppType | ||
|
||
class WSGIApplication(Application): | ||
app_uri: str | None | ||
|
||
@override | ||
def init(self, parser: ArgumentParser, opts: Namespace, args: list[str]) -> None: ... | ||
@override | ||
def load_config(self) -> None: ... | ||
def load_wsgiapp(self) -> _WSGIAppType: ... | ||
def load_pasteapp(self) -> _WSGIAppType: ... | ||
@override | ||
def load(self) -> _WSGIAppType: ... | ||
|
||
def run(prog: str | None = None) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import socket | ||
from types import FrameType | ||
from typing import ClassVar | ||
|
||
from gunicorn.app.base import BaseApplication | ||
from gunicorn.config import Config | ||
from gunicorn.glogging import Logger as GLogger | ||
from gunicorn.workers.base import Worker | ||
|
||
from ._types import _AddressType | ||
from .pidfile import Pidfile | ||
|
||
class Arbiter: | ||
WORKER_BOOT_ERROR: ClassVar[int] | ||
APP_LOAD_ERROR: ClassVar[int] | ||
START_CTX: ClassVar[dict[int | str, str | list[str]]] | ||
LISTENERS: ClassVar[list[socket.socket]] | ||
WORKERS: ClassVar[dict[int, Worker]] | ||
PIPE: ClassVar[list[int]] | ||
SIG_QUEUE: ClassVar[list[int]] | ||
SIGNALS: ClassVar[list[int]] | ||
SIG_NAMES: ClassVar[dict[int, str]] | ||
log: GLogger | None | ||
pidfile: Pidfile | None | ||
systemd: bool | ||
worker_age: int | ||
reexec_pid: int | ||
master_pid: int | ||
master_name: str | ||
pid: int | ||
app: BaseApplication | ||
cfg: Config | ||
worker_class: type[Worker] | ||
address: list[_AddressType] | ||
timeout: int | ||
proc_name: str | ||
num_workers: int | ||
|
||
def __init__(self, app: BaseApplication) -> None: ... | ||
def setup(self, app: BaseApplication) -> None: ... | ||
def start(self) -> None: ... | ||
def init_signals(self) -> None: ... | ||
def signal(self, sig: int, frame: FrameType | None) -> None: ... | ||
def run(self) -> None: ... | ||
def handle_chld(self, sig: int, frame: FrameType | None) -> None: ... | ||
def handle_hup(self) -> None: ... | ||
def handle_term(self) -> None: ... | ||
def handle_int(self) -> None: ... | ||
def handle_quit(self) -> None: ... | ||
def handle_ttin(self) -> None: ... | ||
def handle_ttou(self) -> None: ... | ||
def handle_usr1(self) -> None: ... | ||
def handle_usr2(self) -> None: ... | ||
def handle_winch(self) -> None: ... | ||
def maybe_promote_master(self) -> None: ... | ||
def wakeup(self) -> None: ... | ||
def halt(self, reason: str | None = None, exit_status: int = 0) -> None: ... | ||
def sleep(self) -> None: ... | ||
def stop(self, graceful: bool = True) -> None: ... | ||
def reexec(self) -> None: ... | ||
def reload(self) -> None: ... | ||
def murder_workers(self) -> None: ... | ||
def reap_workers(self) -> None: ... | ||
def manage_workers(self) -> None: ... | ||
def spawn_worker(self) -> int: ... | ||
def spawn_workers(self) -> None: ... | ||
def kill_workers(self, sig: int) -> None: ... | ||
def kill_worker(self, pid: int, sig: int) -> None: ... |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.